Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DB navigator

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
i'm trying to build a db navigator in PHP like the one built in delphi.
my problem is that i don't know the syntax in php to make the table moves one record (next), previous,first or last record.
i would appreciate any help
Thanks
 
the results are stored in an array called mysql_fetch_array
use it like a "normal" array

for example (copied from where the doc is)

$query = "SELECT * FROM my_table";
$result = mysql_query ($query)
or die ("Query failed");

// printing HTML result

print &quot;<table>\n&quot;;
while($line = mysql_fetch_array($result)){
print &quot;\t<tr>\n&quot;;
while(list($col_name, $col_value) = each($line)){
print &quot;\t\t<td>$col_value</td>\n&quot;;
}
print &quot;\t</tr>\n&quot;;
}
print &quot;</table>\n&quot;;



hope this helps !! ------
please review FAQ183-874 - this will help you to get the best out of tt
[ &quot;you&quot; is not someone in particular - don't take it too personnal ]
 
Your problem here is that html(php) pages don't create a continous connection to the sql server. You can only get &quot;snapshots&quot; of the server per page. As a result, you must make another query everytime to move to the &quot;next&quot; or &quot;previous&quot; page.

Thus you must find a way to keep track of the current records you're viewing and modify the
LIMIT $offset,$limit statement. where $offset is the record start point and limit is howmany records to return.

cheers
devnull22

--
Apparently if you play the Windows NT CD backwards you hear satanic messages. If you think that's bad, play it forwards and it installs Windows NT !
 
i didn't understand you wanted to create a navigation system
then just make the array global (either in an included file or as a session variable) and the offset and limit variables as well
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top