Hi Thorpe!
Yep, I have an auto-incrementing field in my db, called 'id'. Here is the code for an abbreviated version of my much larger project:
This page sums the info entered:
<?PHP
$connect= mysql_connect("localhost","root")
or die("Could not connect to database in localhost !");
$result=mysql_select_db("testdiw")
or die("Could not select that database !");
$depmonth=$HTTP_POST_VARS['depmonth'];
$depday=$HTTP_POST_VARS['depday'];
$depyear=$HTTP_POST_VARS['depyear'];
$diwtitle=$HTTP_POST_VARS['diwtitle'];
$date_string = $depyear . "-" . $depmonth . "-" . $depday;
$sqlquery = "INSERT INTO mktime VALUES('','". $depmonth ."','". $depday ."','".$depyear."','". $diwtitle. "','".$date_string."')";
$queryresult = mysql_query($sqlquery) or die(" Could not execute mysql query !");
$sqlquery = "SELECT * from mktime ";
echo '<table>
<tr>
<td>Deposition Date</td>
<td>'.$date_string.'</td>
</tr>
<TR>
<TD COLSPAN=2><form method=get action="spoon3.php">
<input type="submit" value="next"> </form></TD></FORM>
</TR> ';
?>
This page is where I view the orders which are current:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>NEW DIW</title>
</head>
<body>
<?PHP
$connect= mysql_connect("localhost","root")
or die("Could not connect to database in localhost !");
$result=mysql_select_db("testdiw")
or die("Could not select that database !");
$curdate = date("F j, Y");
$sqlquery = "SELECT id, diwtitle, date_string FROM mktime WHERE date_string >= CURDATE() ORDER BY date_string";
$queryresult = mysql_query($sqlquery) or die(" Could not execute mysql query !");
$row = mysql_fetch_row($queryresult);
$date_string = $row[0];
$diwtitle = $row[1];
$id = $row[2];
$tdcount = 1;
$numtd = 1; // number of cells per row
echo '<table border="0" width="" bgcolor="">
<tr>
<td colspan=3 bgcolor="#000080"><font face="Tahoma" size="5" color="white"> I-DEP - Current Depositions</font></td>
</tr>
<tr>
<td bgcolor="#ccccff" width=100><font face="Tahoma" size=2 color="black"><b> Date of Dep </b></font></td>
<td bgcolor="#ccccff" width=400><font face="Tahoma" size=2 color="black"><b> Title </b></font></td>
<td bgcolor="#ccccff" width=60><font face="Tahoma" size=2 color="black"><b> Dep ID </b></font></td>';
while($row = mysql_fetch_array($queryresult)) {
if ($tdcount == 1) echo "<tr>";
echo "<td>",$row['date_string'],"</td><td>",$row['diwtitle'],"</td><td>",$row['id'],"</td>";
if ($tdcount == $numtd) {
echo "</tr>";
$tdcount = 1;
} else {
$tdcount++;
}
}
// time to close up our table
if ($tdcount!= 1) {
while ($tdcount <= $numtd) {
echo "<td> </td>";
$tdcount++;
}
echo "</tr>";
}
echo "</table>";
?>
</body>
</html>
From the sound of your post, it doesn't seem to be an extremely complicated thing.. That makes me happy 😉