This should be simple, but I'm stuck
MySQL Table structure-
I spent two days trying to figure this out, but I haven't gotten anywhere
Code:
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db('joshdye', $con);
$winner = mysql_real_escape_string($_POST['winner']);
$loser = mysql_real_escape_string($_POST['loser']);
$num = mysql_real_escape_string($_POST['games']);
$sql=("INSERT INTO tictactoe VALUES (NULL,'$winner,'$loser','$games',NOW())");
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con)
?>
<form action="<?php echo $SCRIPT_NAME . " method="post">
Winners Name: <input type="text" name="winner" />
Losers Name: <input type="text" name="loser" />
Number of games played: <input type="text" name="games" />
<input type="submit" />
</form>
Code:
-- -- Table structure for table `tictactoe` -- CREATE TABLE IF NOT EXISTS `tictactoe` ( `ID` int(11) NOT NULL auto_increment, `Winner` text NOT NULL, `Loser` text NOT NULL, `Games` double NOT NULL, `When` datetime NOT NULL, PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
Comment