Im new to php and I dont realy know a lot I have been stuck trying to fix this problem for a long time.
here is the error code.
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'and Date, Number of rounds, Number of players) VALUES ('guns','lipsmacky','11:15' at line 1
here is the html code.
<html>
<head>
<style type="text/css">
body
{
background-color:#73a65a;
}
div.banner
{
width:450px;
height:80px;
background:url('http://gamewars.x10hosting.com/images/xbox360banner.jpg') no-repeat;
border:0px solid black;
margin:0px 125px;
}
div.form
{
width:500px;
height:250px;
border:0px solid black;
margin:80px 250px;
}
</style>
</head>
<body>
<div class="banner">
</div>
<div class="form">
<form action="postwarsxbox360.php" method="post">
Game:
<input type="text" name="firstname" />
<br />
Gamertag:
<input type="text" name="lastname" />
<br>
Time and date 00:00 0/0/09:
<input type="text" name="quantity" />
<br>
<h4>Number Of Rounds</h4>
<select name="items">
<option value="1" selected="selected">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="more">more</option>
</select>
<br>
<h4>Number Of Players</h4>
<select name="players">
<option value="1" selected="selected">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="more">more</option>
</select>
<br>
<input type="submit" />
</form>
<br>
<a href="http://gamewars.x10hosting.com">
<img border="0" src="http://gamewars.x10hosting.com/images/gamewarshomebutton.jpg" width="100" height="25">
</a>
</div>
</body>
</html>
here is the php code.
<?php
$con = mysql_connect("localhost", "gamewars_gamewars","xxxxxx");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("gamewars_xbox360postedwars", $con);
$sql="INSERT INTO xbox360 (Game, Gamertag, Time and Date, Number of rounds, Number of players)
VALUES
('$_POST[firstname]','$_POST[lastname]','$_POST[quantity]','$_POST[items]','$_POST[players]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con)
?>
to get the error click on this link. http://gamewars.x10hosting.com/postwarsxbox360.html
I dont have a lot so for exchange for the help ill make any kind of graphics and code them.
here is the error code.
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'and Date, Number of rounds, Number of players) VALUES ('guns','lipsmacky','11:15' at line 1
here is the html code.
<html>
<head>
<style type="text/css">
body
{
background-color:#73a65a;
}
div.banner
{
width:450px;
height:80px;
background:url('http://gamewars.x10hosting.com/images/xbox360banner.jpg') no-repeat;
border:0px solid black;
margin:0px 125px;
}
div.form
{
width:500px;
height:250px;
border:0px solid black;
margin:80px 250px;
}
</style>
</head>
<body>
<div class="banner">
</div>
<div class="form">
<form action="postwarsxbox360.php" method="post">
Game:
<input type="text" name="firstname" />
<br />
Gamertag:
<input type="text" name="lastname" />
<br>
Time and date 00:00 0/0/09:
<input type="text" name="quantity" />
<br>
<h4>Number Of Rounds</h4>
<select name="items">
<option value="1" selected="selected">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="more">more</option>
</select>
<br>
<h4>Number Of Players</h4>
<select name="players">
<option value="1" selected="selected">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="more">more</option>
</select>
<br>
<input type="submit" />
</form>
<br>
<a href="http://gamewars.x10hosting.com">
<img border="0" src="http://gamewars.x10hosting.com/images/gamewarshomebutton.jpg" width="100" height="25">
</a>
</div>
</body>
</html>
here is the php code.
<?php
$con = mysql_connect("localhost", "gamewars_gamewars","xxxxxx");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("gamewars_xbox360postedwars", $con);
$sql="INSERT INTO xbox360 (Game, Gamertag, Time and Date, Number of rounds, Number of players)
VALUES
('$_POST[firstname]','$_POST[lastname]','$_POST[quantity]','$_POST[items]','$_POST[players]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con)
?>
to get the error click on this link. http://gamewars.x10hosting.com/postwarsxbox360.html
I dont have a lot so for exchange for the help ill make any kind of graphics and code them.
Last edited: