Page is a not externally linkable
- Code, Content, and Presentation
-- PHP Server Side Scripting
---- Newbie needs help with polling app


stephen675 - 11:48 pm on Dec 29, 2008 (gmt 0)


Ok, found my answer. Thanks again for the suggestion.

Now the next question - is there a way to submit multiple updates in one query. Currently, I'm planning to do something like the following:

mysql_query("INSERT tbl_survey SET q1_answer_1=1, userid='$userid', item='$item' WHERE area='$q1_answer_1');

mysql_query("UPDATE tbl_survey SET q1_answer_2=1 WHERE userid='$userid' AND item='$item' AND area='$q1_answer_2');

mysql_query("UPDATE tbl_survey SET q1_answer_3=1 WHERE userid='$userid' AND item='$item' AND area='$q1_answer_3');

...

As you can see, the first query inserts the info and the following queries update the first insert. Obviously this can become quite cumbersome with 45 answers... Is there a simpler way of setting these into an array and executing one insert row all at once WHERE item='$item_nbr' and userid='$userid' ? Any help is appreciated.

Thanks,

Stephen


Thread source:: http://www.webmasterworld.com/php/3815819.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com