Ive been toying with this script for quite some time now, i am trying to not only timestamp incoming data to MySQL but also assign a random variable. What's wrong with this...
<?
/* declare some relevant variables */
$hostname = "localhost";
$username = "root";
$dbName = "drs";
$userstable = "document";
/* make connection to database */
mysql_connect($hostname,$username,$password) or die("Unable to connect to database"
;
@mysql_select_db("$dbName"
or die("Unable to select database"
;
print "<center>";
print "Data is Being Processed, please wait....";
print "</center>";
/* Insert information into table */
$today= date("m-d-Y"
;
$query = "insert into $userstable ( id, subject,importance, comment, time )" .
"values ("
"'" . mt_rand (10000, 999999) . "'," .
"'" . $_post['subject'] . "'," .
"'" . $_post['importance'] . "'," .
"'" . $_post['comment'] . "'," .
"'" . $today . "'," .
"
";
$result = mysql_query($query);
/* Close the database connection */
mysql_close();
?>
<?
/* declare some relevant variables */
$hostname = "localhost";
$username = "root";
$dbName = "drs";
$userstable = "document";
/* make connection to database */
mysql_connect($hostname,$username,$password) or die("Unable to connect to database"
@mysql_select_db("$dbName"
print "<center>";
print "Data is Being Processed, please wait....";
print "</center>";
/* Insert information into table */
$today= date("m-d-Y"
$query = "insert into $userstable ( id, subject,importance, comment, time )" .
"values ("
"'" . mt_rand (10000, 999999) . "'," .
"'" . $_post['subject'] . "'," .
"'" . $_post['importance'] . "'," .
"'" . $_post['comment'] . "'," .
"'" . $today . "'," .
"
$result = mysql_query($query);
/* Close the database connection */
mysql_close();
?>