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
?>
controlling a pointer from mysql_fetch_row
Moderator: General Moderators
there is e.g. bool mysql_data_seek ( resource result_identifier, int row_number) but you don't need it. Since you want to show only one recored at a time query only one from the db.
take a look at http://www.mysql.com/doc/en/SELECT.html and search for "The LIMIT clause"
take a look at http://www.mysql.com/doc/en/SELECT.html and search for "The LIMIT clause"
I guess my concern with querying and displaying only one project at a time would be that the content would then be more of a static based type. Meaning...if I ran the query "select project from tblprojects where pjid = '1' " and I had 40 projects loaded, I would have to create 40 different queries on 40 different pages. Right? My thinking now is...if I run one large query " select * from tblprojects " I can now display all the info I want on one page with one query. My challenge is how do I step through each row based on a users input (e.g using the << and >> buttons)?
- please read (for example)
- Sticky: Before Post Read: Frames, JavaScript, and PHP Overview
- http://forums.devnetwork.net/viewtopic.php?t=4004
- many more threads on this board I'm too lazy to search

Or you create links with a appropriate id so a script can create new documents from the according database entries.