dislaying and updating results from MySQL dbase
Moderator: General Moderators
dislaying and updating results from MySQL dbase
hi ya - post from a newbie! am writing a script that returns results from a mysql dbase which i have got working and returning reults. however - there are loads of results and each record contains 16 fields so there is a lot of data to display. How is it possible to display results but have each record displayed on a different page? any help in pseudocode would help and then i'll come back with the code. thanks for any help - an example would be superb! 
this is a rough version of the code that displays the results from the table in the MySQL dbase based on what the user searches for. This code already works but it displays all the results on one page - how do you put the results on a different page for each record?
Code: Select all
<?php
include ("connect.inc");
//Select statement to find the corresponding number to the Status_ID, E.G. Open corresponds to number 3
$STATUS = mysql_query("SELECT STATUS_ID FROM STATUS where STATUS_NAME='$STATUS_NAME'");
$num_rows = mysql_num_rows($STATUS);
while ($get_info = mysql_fetch_row($STATUS)){
foreach ($get_info as $STATUS_NO)
echo "$STATUS_NO";
$query = "SELECT * FROM track WHERE STATUS_ID = '$STATUS_NO'";
$result = mysql_query($query)
or die ("Couldn't execute query");
echo "<table border=1>";
while ($row = mysql_fetch_array($result,MYSQL_ASSOC) )
{
echo "<tr><td>Track ID</td></tr>\n";
echo "<tr>\n";
echo "<td>{$row['TRACK_ID']}</td>\n";
echo "<td>{$row['PRODUCT_ID']}</td>\n";
echo "<td>{$row['REPORT_ID']}</td>\n";
echo "<td>{$row['REP_VERSION']}</td>\n";
echo "<td>{$row['REL_VERSION']}</td>\n";
echo "<td>{$row['STATUS_ID']}</td>\n";
echo "<td>{$row['SUBMITTED BY']}</td>\n";
echo "<td>{$row['ASSIGNED TO']}</td>\n";
echo "<td>{$row['RESOLVED BY']}</td>\n";
echo "<td>{$row['TITLE']}</td>\n";
echo "<td>{$row['CRIT FAULT']}</td>\n";
echo "<td>{$row['CUST_ID']}</td>\n";
echo "<td>{$row['EXT_REF']}</td>\n";
echo "<td>{$row['DOC_CHANGE']}</td>\n";
echo "<td>{$row['INJECTION_ID']}</td>\n";
echo "<td>{$row['INVESTIGATE']}</td>\n";
echo "<\table>\n";
}
}
?>-
Illusionist
- Forum Regular
- Posts: 903
- Joined: Mon Jan 12, 2004 9:32 pm
pagination
thanks for th reply. gone thru the code and have a problem with the hyperlinks showing up as plain text. code is as follows:
any help would be great. cheers
any help would be great. cheers
Code: Select all
<?php
if(($totalrows - ($limit * $page)) > 0){
$pagenext = $page++;
echo("<a href="test.php?page=$pagenext">NEXT".$limit."</a>");
}else{
echo("NEXT".$limit);
}
mysql_free_result($result);
?>
<?php
?>I personaly prefer:
If that helps...
Code: Select all
echo '<a href="test.php?page=' . $pagenext . '">NEXT' . $limit . '</a>';