Re: [PHP] Why doesn't the second instance work?

2002-09-02 Thread Tom Rogers

Hi,

Tuesday, September 3, 2002, 6:49:25 AM, you wrote:

MK> Everything is good, Everything is fine, so I decide to put the same=20
MK> snippet of code in again, this time pointing to a different page -- 
MK> One=20=

MK> page lets you edit the fields, the other shows you the final output,=20
MK> the item from the database featured on a web page.

MK> preview an endpage:

MK>  //create a list of editible items
MK> echo "";
MK> echo "";
MK> for ($i=3D0; $i <$num_results; $i++)
MK> {
MK> $row =3D mysql_fetch_array($result);
MK> echo " $row[id], =
MK> $row[productname]";
MK> }
MK> echo "";
MK> echo "";
MK> echo "";
?>>=00=00

MK> The second instance does not work, I get a select with "," as each=20
MK> option, no population with the id or productname. Clearly, I don't=20
MK> understand something here, can anyone tell me what?

MK> Thanks for the time,

MK> Michael

To use the result a second time you will need to reset the internal mysql
pointer like this:

mysql_data_seek($result,0);

After the first loop through.

-- 
regards,
Tom


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




[PHP] Why doesn't the second instance work?

2002-09-02 Thread Michael Knauf


I'm creating a list/menu form item and populating it from a database,=20
the code snippet looks like this:
=00
Edit an item:
";
echo "";
for ($i=3D0; $i <$num_results; $i++)
{
$row =3D mysql_fetch_array($result);
echo " $row[id], =
$row[productname]";
}
echo "";
echo "";
echo "";
?>=00=00

Everything is good, Everything is fine, so I decide to put the same=20
snippet of code in again, this time pointing to a different page -- 
One=20=

page lets you edit the fields, the other shows you the final output,=20
the item from the database featured on a web page.

preview an endpage:

";
echo "";
for ($i=3D0; $i <$num_results; $i++)
{
$row =3D mysql_fetch_array($result);
echo " $row[id], =
$row[productname]";
}
echo "";
echo "";
echo "";
?>=00=00

The second instance does not work, I get a select with "," as each=20
option, no population with the id or productname. Clearly, I don't=20
understand something here, can anyone tell me what?

Thanks for the time,

Michael


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