Hi everyone,
I'm working on an inventory display. The first page is almost complete; however the pagination is not working properly. My first page simple gets all of the records from my database and displays minimal information about each item. Next to each record I have a detail button built. What I need help with is the beginning of the script for the detail page. I want my clients to be able to click on the detail button and get redirected to a new page that displays all details for the specific record they requested. I know that I need to start the script with an if statement, but beyond that I'm clueless. Can anyone provide direction?
My index page is this:
<?php
// Connects to your Database
require_once('inc/dbstuff.php');
include('ps_pagination.php');
$rs = mysql_query($sql)
or die(mysql_error());
Echo "<table width=400 class=thrColLiqHdr>";
while($row = mysql_fetch_array($rs))
{
Echo "<tr>";
Echo "<th>".$row['year'] . ' ' . $row['make'] . ' ' . $row['model'] . "</th>";
Echo "<th></th>";
Echo "<th></th>";
Echo "<th></th>";
Echo "<th>". (empty($row['price'])? $row['callforprice'] : '$' . $row['price']) . "</th></tr>\n";
Echo "<td><img src=\"$image_dir{$row['pix']}\" width=\"132\" height=\"99\" /></td>";
Echo"<td><strong>Location:</strong> ".$row['location'] . "</td> ";
Echo"<td><strong>Condition:</strong> ".$row['new_pre'] . "</td> ";
Echo"<td><strong>Engine:</strong> ".$row['engine_make'] . "</td> ";
Echo"<td>".'<form id="search-form" action="invdetail.php" method="get">'
.'<input name="boat_details" type="submit" value="Details" />'
."</form></td></tr>\n";
}
Echo "</table>";
/*
* Create a PS_Pagination object
*
* $conn = MySQL connection object
* $sql = SQl Query to paginate
* 10 = Number of rows per page
* 5 = Number of links
* "param1=valu1¶m2=value2" = You can append your own parameters to paginations links
*/
$pager = new PS_Pagination($conn, $sql, 10, 5);
/*
* Enable debugging if you want o view query errors
*/
$pager->setDebug(true);
/*
* The paginate() function returns a mysql result set
* or false if no rows are returned by the query
*/
$rs = $pager->paginate();
if(!$rs) die(mysql_error());
//Display the full navigation in one go
echo $pager->renderFullNav();
echo "<br />\n";
?>
This is what I have for the detail page so far. Not much, except for what I want to display from the record. It is a combination of php and html.
<div id="col_5">
<div id="infobar"><h1><?php Echo .$row['year'] . ' ' . $row['make'] . ' ' . $row['model'] . ?></h1></div><?php
Echo "<img src=\"$image_dir{$row['pix6']}\" width=\"550\" height=\"410\" hspace=\"1.5px\"/>";
Echo "<img src=\"$image_dir{$row['pix2']}\" width=\"132\" height=\"99\" hspace=\"1.5px\"/>"
"<br/>";
Echo "<img src=\"$image_dir{$row['pix3']}\" width=\"132\" height=\"99\" hspace=\"1.5px\"/>";
Echo "<img src=\"$image_dir{$row['pix4']}\" width=\"132\" height=\"99\" hspace=\"1.5px\"/>";
Echo "<img src=\"$image_dir{$row['pix5']}\" width=\"132\" height=\"99\" hspace=\"1.5px\"/>";
?>
<div id="infobar">Factory Specifications | <a href="contact.html" title="contact us" target="_self" style="color:#FFF">Contact Us</a> | Printable Version</div>
<h2><strong><em>Boat Description</em></strong></h2>
<p><?php Echo .$row['description'] . ?></p>
<h2><strong><em>Specifications</em></strong></h2>
<table width="400">
<tr>
<th width="121" scope="row">Location</th>
<td width="261"><?php Echo .$row['location'] . ?></td>
</tr>
<tr>
<th scope="row">Condition</th>
<td><?php Echo .$row['condition'] . ?></td>
</tr>
<tr>
<th scope="row">Availability</th>
<td><?php Echo .$row['availability'] . ?></td>
</tr>
<tr>
<th scope="row">Price</th>
<td><?php Echo . (empty($row['price'])? $row['callforprice'] : '$' . $row['price']) . ?></td>
</tr>
</table><br />
<table width="400">
<tr>
<th width="121" scope="row">Hull Material</th>
<td width="261"><?php Echo .$row['hull_material'] . ?></td>
</tr>
<tr>
<th scope="row">Hull Type</th>
<td><?php Echo .$row['hull_type'] . ?></td>
</tr>
<tr>
<th scope="row">Length</th>
<td><?php Echo .$row['length'] . ?></td>
</tr>
<tr>
<th scope="row">Beam</th>
<td><?php Echo .$row['beam'] . ?></td>
</tr>
<tr>
<th scope="row">Draft</th>
<td><?php Echo .$row['draft'] . ?></td>
</tr>
<tr>
<th scope="row">Dry Weight</th>
<td><?php Echo .$row['dry_weight'] . ?></td>
</tr>
<tr>
<th scope="row">Max Capacity</th>
<td><?php Echo .$row['max_capacity'] . ?></td>
</tr>
<tr>
<th scope="row">Fuel Type</th>
<td><?php Echo .$row['fuel_type'] . ?></td>
</tr>
<tr>
<th scope="row">Fuel Capacity</th>
<td><?php Echo .$row['fuel_capacity'] . ?></td>
</tr>
</table><br />
<table width="400">
<tr>
<th width="121" scope="row">Engine Make</th>
<td width="267"><?php Echo .$row['engine_make'] . ?></td>
</tr>
<tr>
<th scope="row">Engine Type</th>
<td><?php Echo .$row['engine_type'] . ?></td>
</tr>
<tr>
<th scope="row">Horsepower</th>
<td><?php Echo .$row['horsepower'] . ?></td>
</tr>
<tr>
<th scope="row">Number of Engines</th>
<td><?php Echo .$row['number_engines'] . ?></td>
</tr>
</table><br />
<table width="400">
<tr>
<th width="121" scope="row">Trailer</th>
<td width="267"><?php Echo .$row['trailer'] . ?></td>
</tr>
</table>
<h2><strong><em>Additional Features</em></strong></h2>
<p><?php Echo .$row['additional_features'] . ?></p>
</div>