php mysql question
Posted: Tue Jan 28, 2003 3:57 pm
OK I have a small form that inserts ten entries into a database table with 7 fileds in it. Each time the form is submitted the 10 rows are deleted and replaced with the new values. Now I have a page where I want to retrieve the information on the ten rows and asign a variable to each row and field.
Usually when I select data I use the 'where' keyword to specify which row I want to select. Than I would do
$row = mysql_fetch_array($result);
$var = stripslashes($row["field_name"]);
Now since I'm retrieveing the entire table how would I asign variables for each row/field combonation.
I'd imagine the array stores all the values in a multidimensional array so could I do something like this?
$var = stripslashes($row[1, 1]); than do [1, 2] and so on for the 7 fileds than do the next row like [2, 1] and so on.
I'm off to work and I will try that when I get home but oif anyone can confirm if I can do it that way or if there is a better way to do it let me know. Thanks in advance.
-Dave
Usually when I select data I use the 'where' keyword to specify which row I want to select. Than I would do
$row = mysql_fetch_array($result);
$var = stripslashes($row["field_name"]);
Now since I'm retrieveing the entire table how would I asign variables for each row/field combonation.
I'd imagine the array stores all the values in a multidimensional array so could I do something like this?
$var = stripslashes($row[1, 1]); than do [1, 2] and so on for the 7 fileds than do the next row like [2, 1] and so on.
I'm off to work and I will try that when I get home but oif anyone can confirm if I can do it that way or if there is a better way to do it let me know. Thanks in advance.
-Dave