controlling a pointer from mysql_fetch_row
Posted: Sun Nov 10, 2002 8:07 pm
Perhaps this has been discussed previously, but for the sanity of my fingers, I need a break from typing.
Here's the problem:
I have multiple projects loaded in a mysql database. I'm creating a frontend that my project managers can use to change the status of the projects. Not interested in any "already developed" products as this is more of a learning experience for my class than anything.
What I want:
to be able to view one project at a time and use << and >> buttons to navigate through the projects. Basically I'm thinking that if I use a for() loop to iteriate through the ouputs I simply need to control the value of the counter to manually move through the projects. example:
//for($i = 0; $i < something; $i++)
// {
////$res = mysql_fetch_row($query);
// step through the output here, etc...
// }
so, a simplified resoultion would thus be to control the value of $i. I think I've got the code structure to handle this, but what I'm lacking is the pointer in the mysql_fetch_row. From what I understand each iteration of
//$res = mysql_fetch_row($query) // will pull one result row at a time from the query and make it accessable as a numerically indexed row. Upon the second iteration of the for() loop the next cooresponding row ( [0][1][2] etc...) will be made accessable because the internal pointer in $res keeps track of the current position. This thus leads me to believe that this is some sort of an array, perhaps an abstract type ??? not really sure.
Here's what I need to know:
How do I control that pointer within //$res? Do i use functions like prev() or end()? I've already tried them, but I must have used them wrong, becuase I got no desired output. Should I manually populate a second array with the values of each //$res? Suggestions / direcction would be greatly appreciated. Sorry this was so long, just trying to give all I could for possible misunderstanding.
-- rath
?>
Here's the problem:
I have multiple projects loaded in a mysql database. I'm creating a frontend that my project managers can use to change the status of the projects. Not interested in any "already developed" products as this is more of a learning experience for my class than anything.
What I want:
to be able to view one project at a time and use << and >> buttons to navigate through the projects. Basically I'm thinking that if I use a for() loop to iteriate through the ouputs I simply need to control the value of the counter to manually move through the projects. example:
//for($i = 0; $i < something; $i++)
// {
////$res = mysql_fetch_row($query);
// step through the output here, etc...
// }
so, a simplified resoultion would thus be to control the value of $i. I think I've got the code structure to handle this, but what I'm lacking is the pointer in the mysql_fetch_row. From what I understand each iteration of
//$res = mysql_fetch_row($query) // will pull one result row at a time from the query and make it accessable as a numerically indexed row. Upon the second iteration of the for() loop the next cooresponding row ( [0][1][2] etc...) will be made accessable because the internal pointer in $res keeps track of the current position. This thus leads me to believe that this is some sort of an array, perhaps an abstract type ??? not really sure.
Here's what I need to know:
How do I control that pointer within //$res? Do i use functions like prev() or end()? I've already tried them, but I must have used them wrong, becuase I got no desired output. Should I manually populate a second array with the values of each //$res? Suggestions / direcction would be greatly appreciated. Sorry this was so long, just trying to give all I could for possible misunderstanding.
-- rath
?>