srhino Posted March 19, 2010 Share Posted March 19, 2010 I have been staring at the computer all day and I can't see what I am missing....Can anyone tell me why I can't insert this info. Here is the code <?php include("includes/connection.php"); ?> <?php $matchid = $_POST['matchid']; $round = $_POST['round']; $school1 = $_POST['school1']; $school2 = $_POST['school2']; $query = "INSERT INTO match (matchid, round, school1, school2) " . " VALUES ('$matchid', '$round', '$school1', '$school2')"; $result = mysql_query($query) or die('Sorry, we could not post your tournament to the database at this time'. mysql_error()); if ($result) echo "<a href=\"index.php\"><h2>Tournament posted</h2></a>\n"; else echo "<h2>Sorry, there was a problem posting your tournament</h2>\n"; ?> Here is the form that is sending over the variables <?php $matchid = $_POST['matchid']; $round = $_POST['round']; $school1 = $_POST['school1']; $school2 = $_POST['school2']; echo "<table width=\"100%\" border=\"1\" align=\"center\"><form action=\"newmatch.php\" method=\"post\"> <tr><td colspan=\"9\" align=\"center\">New Schools</TD></tr> <tr> <td width=\"10%\">Match</td> <td width=\"5%\">Round</td> <td width=\"75%\">Teams</td> </tr> <tr> <td rowspan=\"2\"><input type=\"text\" name=\"matchid\" ></td> <td rowspan=\"2\"><input type=\"text\" name=\"round\"></td> <td><input type=\"text\" name=\"school1\" value=\"$school1\"></td> <tr><td><input type=\"text\" name=\"school2\" value=\"$school2\"></td> <tr><td colspan=\"4\" align=\"center\"><input type=\"submit\" value=\"Submit\"> <input type=\"hidden\" name=\"content\" value=\"newmatch\"></td></tr> </form></table>" ?> Quote Link to comment https://forums.phpfreaks.com/topic/195865-please-help/ Share on other sites More sharing options...
PFMaBiSmAd Posted March 19, 2010 Share Posted March 19, 2010 match is a reserved mysql keyword and an unfortunate name to pick for a mysql table. I recommend you rename it to something else. You should also post the errors you get when you run your code. Quote Link to comment https://forums.phpfreaks.com/topic/195865-please-help/#findComment-1028804 Share on other sites More sharing options...
srhino Posted March 19, 2010 Author Share Posted March 19, 2010 OMG I am so stupid....Thanks! I knew I was looking at this too long Quote Link to comment https://forums.phpfreaks.com/topic/195865-please-help/#findComment-1028806 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.