i then display it on another page when i click the submit button
this all works fine
I then have a link in a nav bar that should display the contents of the database in a table , but it only shows the first data entry,
how can i make the page refresh,
i,ve tried the various bits of code i,ve read from some of the posts on here but struggling
can anyone help
thanx in advance
ducca
Code: Select all
<HTML>
<HEAD>
<LINK REL=stylesheet TYPE="text/css" HREF="wmd.css">
<HTML>
<TITLE>reading Data from a Database</TITLE>
</HEAD>
<BODY><center>
<?php
// Set the variables for the database access:
$host="localhost";
$user="Paul";
$password="";
$database = "auction";
$TableName = "auctiondata";
$connection = mysql_connect($host,$user,$password)
or die ("couldn't connect to server");
$db = mysql_select_db($database,$connection)
or die ("Couldn't select database");
$query = "SELECT * FROM auctionData";
$result = mysql_query($query)
or die ("Couldn't execute query.");
/* Display results in a table */
print ("<TABLE BORDER=1 WIDTH="95%" CELLSPACING=2 CELLPADDING=2 ALIGN=CENTER>\n");
print ("<TR ALIGN=CENTER VALIGN=TOP>\n");
print ("<th ALIGN=CENTER VALIGN=TOP>AuctionId</th>\n");
print ("<th ALIGN=CENTER VALIGN=TOP>Name</th>\n");
print ("<th ALIGN=CENTER VALIGN=TOP>Item</th>\n");
print ("<th ALIGN=CENTER VALIGN=TOP> Item Description</th>\n");
print ("<th ALIGN=CENTER VALIGN=TOP>Startprice</th>\n");
print ("<th ALIGN=CENTER VALIGN=TOP>Startdate</th>\n");
print ("<th ALIGN=CENTER VALIGN=TOP>Expiresdate</th>\n");
print ("</TR>\n");
while ($row = mysql_fetch_array($result))
{
extract($row);
print ("<TR ALIGN=CENTER VALIGN=TOP>\n");
print ("<TD ALIGN=CENTER VALIGN=TOP>$auctionId</TD>\n");
print ("<TD ALIGN=CENTER VALIGN=TOP>$userId</TD>\n");
print ("<TD ALIGN=CENTER VALIGN=TOP>$item</TD>\n");
print ("<TD ALIGN=CENTER VALIGN=TOP>$itemDesc</TD>\n");
print ("<TD ALIGN=CENTER VALIGN=TOP>$startPrice</TD>\n");
print ("<TD ALIGN=CENTER VALIGN=TOP>$startDate</TD>\n");
print ("<TD ALIGN=CENTER VALIGN=TOP>$expiresDate</TD>\n");
print ("<TR>\n");
}
echo "</table>\n";
mysql_close ($connection);
?>
</center>
</body>
</html>
<!--$datastring=-->