while loop help

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

 



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



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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux