php - How to use INSERT with WHERE -


i need insert data mysql database depending on whether field in table in database true or false (bool). php code have far goes this:

//insert data database mysql_query("insert answers (name, answer, aqid, date)     values ('$name', '$answer', '$curdate')"); 

i wondering put clause. needs this

where approvedquestions status = true 

i hoping i'm explaining myself clearly. since not displaying data not believe need using union wrong.

edit: each question has unique id associated it. unqiue id present in answer table association purposes. thing relationships being done php wise , not mysql wise. best way assign unique questionid answer table?

you can use 0 false , 1 true values. it's simple.

ps instead of can change type of row in phpmyadmin "bool".


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -