while loop help

From: Date: Sat, 15 Feb 2003 23:44:59 +0000
Subject: while loop help
Groups: php.db 
Request: Send a blank email to php-db+get-25655@lists.php.net to get a copy of this message
I would appreciate some help with the following code. I have presented a user with a table of session workshops for a conference. There is a select list called "rank", and the value is the workshop letter and number with the user's ranking, e.g. "B12-1 B12-2, B12-3" for each workshop. The following code is triggered by the submit button on that layout: if (isset($_POST['workshop_select'])) { print $header_string; $user = $HTTP_POST_VARS['username']; ***** this is the section that needs some sort of loop ************ $rank_all = $HTTP_POST_VARS['rank']; $rank = substr($rank_all, -1); $workshop_ID = (ereg ('[0-9]-', $rank_all)); mysql_query=("INSERT INTO choices(user_id, workshop_ID, rank) VALUES ($user, $workshop_ID, $rank) WHERE $rank >0"); ********************************************************************* } The above code needs to retrieve the ranked workshops. I am assuming that there needs to be some sort of for and/or while loop, but I am unsure what the syntax needs to be. In other words, I would like the code to read the table records one by one, inserting the $user, $workshop_ID and $rank for each (where the user has selected that workshop). Many thanks Peter Gumbrell

« previous php.db (#25655) next »