not real sure of the setup of the form but if you have mutiple groups of
items to be updated then you should make the rank an array -- rank[pid#]

you should make all the items -- that are related part of the same group
-- by using [] 

On Mon, 2002-12-09 at 15:06, Jason Dulberg wrote:
> I am displaying a list of data (from an sql query) and some of the fields in
> that list are editable through a form. If the user chooses to edit one or
> more of the rows of data, they must click on a checkbox to add that row to
> an "update array". The problem is that when I read that array to pass to an
> UPDATE sql statement, it only passes the last entry of the array.
> 
> Here's an example of the data being passed:
> 13 - 4 - UPDATE ranking SET category='Prep School', rank='30' WHERE pid=4
> 14 - 169 - UPDATE ranking SET category='Prep School', rank='30' WHERE
> pid=169
> 15 - 166 - UPDATE ranking SET category='Prep School', rank='30' WHERE
> pid=166
> 
> The above is created based on the following html code:
> //the last row
> <input type="text" name="category" value="Prep School">
> <input type="text" name="rank" value=30 size=4>
> <input type="checkbox" name="rankid[15]" value="166">
> 
> So as you can see, its only reading the last row and assigning its values to
> the data above as well.
> 
> Here's what I'm using for the sql query:
> 
> while(list($key,$val)=each($rankid)) {
>    $upd=mysql_query("UPDATE ranking SET category='$category', rank='$rank'
> WHERE pid=$val");
> }
> 
> If anyone has any suggestions for fixing this problem, please let me know :)
> THanks
> 
> 
> __________________
> Jason Dulberg
> Extreme MTB
> http://extreme.nas.net
-- 
Jimmy Brake <[EMAIL PROTECTED]>


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

Reply via email to