Forming an SQL query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
Thanks to everyone's help, that multipage monster of a form is now working properly (yay!).

One problem I have though is that I stick the answers as each page is completed into a table. If the user hits the back button, rather than adding a new row to the table I'd rather update it if it's there. That's fairly straightforward when it's 1:1 questions to answers:

  $q_a_sql='INSERT INTO $userAnswerTable
                  ( q_id, a_id )
                  VALUES ' . (implode(",",$qanda))
                  . ' on duplicate key UPDATE a_id = VALUES(a_id);';

But when it's 1:n, such as with checkboxes, this neat little plan of mine is thwarted.

So if I change the userAnswerTable to three columns, u_id, q_id and a_id, is there a way I can do all the 1:1 and 1:n in the manner I wish?

TIA,
JJ

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux