You are here: Forming an SQL query « PHP « IT news, forums, messages
Forming an SQL query

Posted by Jack Jackson on 08/02/05 21:13

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация