My data entry is passed from a text field form on one page to the next where upon successful write, displays a message as to what has just successfully written to the db.
The PHP code:
- Code: Select all
<?php
require_once(connect.php'); // user & password
$DBname = "history";
$table = "history_tbl";
$id = $_POST['id'];
$event = $_POST['event'];
$date = $_POST['date'];
$name = $_POST['name'];
mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect to database");
mysql_select_db($DBname) or die("Unable to select database $DBname");
$sqlquery = "INSERT INTO $table VALUES('$id', '$event', '$date', '$name')";
if ($results = mysql_query($sqlquery)) {
$event = stripslashes($event);
}
mysql_close();
print "<center><table border=\"0\"
width=\"500\"><tr><td>";
print "<p><font face=\"verdana\" size=\"+0\"> <center>You
Just Entered This Information <p><blockquote>";
print "Event: $event<p>Date: $date<p> Name: $name</blockquote></td></tr></table>
</CENTER>
</body>
</html>";
?>
PHP is version 5.47
DB/Table structure:
id = int, auto-increment, primary key
event = varchar 250
date = date
name = varchar 20
Engine InnoDB
Collation utf8_general-ci w/UTF-8 Unicode character set
Anyone have any ideas what might be causing this occasional failure to write? Usually writes fine but occasionally the data isn't in the table even though the entry screen indicates a successful write. Again, not sure if it's WAMP/XAMPP or something to do with 64 bit buffers, etc.
Thanks for any ideas,
cov