All pastes #93545 Raw Edit

Anonymous

public text v1 · immutable
#93545 ·published 2006-07-20 15:30 UTC
rendered paste body
<?php
$display_stock = $_REQUEST['show_total_stock'];
$display_entries = $_REQUEST['show_all_entries'];
 

print '<br />';
if ($display_stock)
	{
// Get all the data from the "tournament" table
$result = mysql_query("SELECT * FROM products") 
or die(mysql_error());  

echo "<table border='1'>";
echo "<tr> <th>Id</th> <th>Name</th> <th>Type</th> <th>Price</th></tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
	// Print out the contents of each row into a table
	echo "<tr><td>"; 
	echo $row['id'];
	echo "</td><td>"; 
	echo $row['name'];
	echo "</td><td>"; 
	echo $row['type'];
	echo "</td><td>"; 
	echo $row['price'];
	echo "</td></tr>"; 
} 
echo "</table>";
}
if ($display_entries)
	{
	// Get all the data from the "tournament" table
$result = mysql_query("SELECT * FROM tournament order by tickets desc") 
or die(mysql_error());  

echo "<table border='1'>";
echo "<tr> <th>Name</th> <th>Tickets</th> </tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
	// Print out the contents of each row into a table
	echo "<tr><td>"; 
	echo $row['name'];
	echo "</td><td>"; 
	echo $row['tickets'];
	echo "</td></tr>"; 
} 
echo "</table>";
}
?>