Forum Moderators: coopster
$query = "SELECT * FROM table WHERE id>0 ORDER BY id";
$result = mysql_query($query) or die(mysql_error());
$fetched = mysql_fetch_row($result);
foreach ($fetched as $row) {
echo($row); //THIS IS ONLY ECHOING ONE ROW INSTEAD OF LOOPING. FOR INSTANCE, WITH THREE ROWS IN THE TABLE, THIS ECHOS ONLY THE FIRST ONE AND STOPS
}
Ultimately, I want to loop through all the rows in the table, then dip into the contents of each row to extract a single value for use in constructing links, but I'd be happy for the moment being able to just echo the full contents of each row. Accomplishing this will almost certainly lead me toward my ultimate goal.
Could anyone shed some light here on getting all the rows echoed? Am I using my SELECT syntax wrong, or is it the foreach() loop that isn't right?
I feel like I've been asking a lot of really newbie questions over the last few days, so thanks for your patience and understanding.
cEM
Bonus, I'm not sure I'm ready to get into using php objects. I'm still trying to get the basics down and feel the object side might be over my head at the moment (to use an area where I have some measure of experience, it'd be like trying to design a complicated css-p layout while you're still learning how to style fonts and backgrounds). Am I right, or are PHP objects easy enough to learn right off the bat?
Thanks again for your help!
cEM