PHP/MySQL Using Variables and INSERT INTO syntax -


I am trying to pass variable values ​​in a MySQL database table. I am using a PDO to get access to the database, and I am able to resize the variable values ​​that I want to include in my browser. The only thing I can think of is that my syntax is wrong. I'm a newbie on using PHP / MySQL clearly.

I have not found any errors in the information that is not going into my table values ​​('$ version', $ numeric, value, value, number, $ Pass_percent, $ earn_score, '$ username' '$ Email', '$ quiz_title', CURDATE ()) "; Create a MySQL table: Question ID INT not pure AutoConnect primary key, version text, INT points, passing passing times, received_core score, username text, email text, quiz text, date Default notation) default detector set UTF8 engine = InnoDB

If your database is the connection object $ dbo , then it will generally like it.

By calling the method prepared on your database connection object, A Create a statement: <(> version, number, passing, edge, score, username, email, quiz, date) value (: version, number :: pass_parent, received_score, username: email, quiz , Kurt ()) ");

As you can see, instead of going to the variable, I want to get straight values, I have created placeholders. Then, call the method executed on $ sql obect and pass the values ​​for the placeholder as the key-value pair in the array.

  $ sql-> Execute (= "version" = & gt; $ version, ": numerals" => $ points, ": passing_percent" => $ pass_percent, ": received_core" => $ gained_score, " : Username "= $ username,": email "= email;"; email: ": quiz_title" => $ quiz_title));   

This code passes through the values ​​you define instead of the placeholder, and when it executes your INSERT statement, the system automatically saves the variable you passed for security and Secures



Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -