Skip to content
Advertisement

Tag: pdo

Connection failed: SQLSTATE[HY093]: Invalid parameter number

Hello everyone, I’ve got a problem with my php code. I keep getting this error 0 1 2 3Connection failed: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens. As I understand it means that the number of parameters doesn’t match. I rewrited it many times and I’m pretty sure, that everything in this line

Get a value from two tables

I am trying to get the value of the colum “name” from the clubs table. First table:(Clubs) id* name (what i need!!!) email password Second table:(club_posts) id club_id* zip_id kategory type stadt plz Controller: This is my query: The result is an array with ten values, but need only one. Answer Create a relation club in you ClubPost Model so

Using PHP/PDO to set a NULL as value when UPDATE by array

i am executing SQL statement like this with PDO. and $_POSTData_array is like this the problem is i can’t get the null as null in db, its update as blank. any help??? UPDATE ! as per comment by Álvaro González i tried var_dump(). var_dump() is much better. I need to insist: how do you know that you’re getting NULL values

PDO changes query

I want to have result of my query as it was before I replaced db connection using PDO. How can I get the query as i t was before I implemented PDO? This is my query: $query = “SELECT `…

MySQL INSERT inserting BIT to 1 instead of 0

I have the following query which should insert a 0 but instead inserts 1. It is executed with prepared statements in PHP: All inserts are performed fine, except a 1 is inserted in column6 instead of a 0. Column 6 has the datatype BIT. The query works fine, however, when executing directly in the phpmyadmin ‘MySQL’ tab. What am I

SQL database value to variable

So, I am kinda new to php and mysql, but I have found a login form and adapted it to my needs as I dont have the knowledge to make one my self yet. I added a firstname and surname column into the database and the register form adds the values into the database fine. Now I want to be

Extract Parameters from pdo query

I have this query using pdo: SELECT * FROM users WHERE name LIKE :name AND age > :age1 AND age < :age2 how can I extract the parameters from this query with a regular expression in order to …

PHP SQL Views counter using PDO prepare()

I have a variable $id which gives me the id of the current article and this can help me to make an update query in my database on current article. This is my code: I don’t get any errors but my code is still not working… Answer Your correct code is here: ; from the end of sql is not

Advertisement