Hey all. I am trying to make a script that will allow me to update my gaming teams roster page w/ out have to edit any more html in profiles. i have created a form thats suposed to post to a mysql db. when i fill out the form i get the following error:
I am using mysql version 4.1.19
Cannot query the database.
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 '','','','','','','','','','','','','','','','','','','','')' at line 1
submit.php (form)
<?php
include("./dbconnect.php");//include the file that connects to the database
if(!empty($name)) {//if the name is not empty, than do this function
$name = addslashes($name);
$age = addslashes($age);
$sex = addslashes($sex);
$country = addslashes($country);
$status = addslashes($status);
$game = addslashes($game);
$website = addslashes($website);
$xfire = addslashes($xfire);
$biography = addslashes($biography);
$manufacturer = addslashes($manufacturer);
$os = addslashes($os);
$cpu = addslashes($cpu);
$memory = addslashes($memory);
$harddrive = addslashes($harddrive);
$videocard = addslashes($videocard);
$soundcard = addslashes($soundcard);
$headphones = addslashes($headphones);
$monitor = addslashes($monitor);
$mouse = addslashes($mouse);
$mousepad = addslashes($mousepad);
$keyboard = addslashes($keyboard);
$sql = "INSERT INTO members (id, name, age, sex, status, game, website, xfire, biography, manufacturer, os, cpu, memory, harddrive, videocard, soudcard, headphones, monitor, mouse, mousepad, keyboard) VALUES ('NULL',$name','$age','$sex','$status','$game','$website','$xfire','$biography','$manufacturer','$os','$cpu','$memory','$harddrive','$videocard','$soundcard','$headphones','$monitor','$mouse','$mousepad','$keyboard')";//Insert all of your information into the members table in your database
$query = mysql_query($sql) or die("Cannot query the database.<br>" . mysql_error());
echo "Database Updated.";
} else {//However, if the title variable is empty, than do this function
?>
<form name="news" method="post" action="<?php echo $PHP_SELF; ?>">
<p>Please fill out all of the following fields:</p>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="117"><font size="1">Name*:</font></td>
<td width="577">
<font size="1">
<input type="text" name="name" size="50">
</font>
</td>
</tr>
<tr>
<td width="117"><font size="1">Age*:</font></td>
<td width="577">
<font size="1">
<input type="text" name="age" size="2">
</font>
</td>
</tr>
<tr>
<td width="117"><font size="1">Sex*:</font></td>
<td width="577">
<font size="1">
<input type="text" name="sex" size="6">
</font>
</td>
</tr>
<tr>
<td width="117"><font size="1">country*:</font></td>
<td width="577">
<font size="1">
<input type="text" name="country" size="3">
</font>
</td>
</tr>
<tr>
<td width="117"><font size="1">status*:</font></td>
<td width="577">
<font size="1">
<input type="text" name="status" size="6">
</font>
</td>
</tr>
<tr>
<td width="117"><font size="1">game*:</font></td>
<td width="577">
<font size="1">
<input type="text" name="game" size="15">
</font>
</td>
</tr>
<tr>
<td width="117"><font size="1">website*:</font></td>
<td width="577">
<font size="1">
<input type="text" name="website" size="20">
</font>
</td>
</tr>
<tr>
<td width="117"><font size="1">xfire*:</font></td>
<td width="577">
<font size="1">
<input type="text" name="xfire" size="15">
</font>
</td>
</tr>
<tr>
<td width="117"><font size="1">Biography*:</font></td>
<td width="577">
<font size="1">
<textarea name="biography" rows=10 cols=43></textarea>
</font>
</td>
</tr>
<tr>
<td width="117"><font size="1">Manufacturer*:</font></td>
<td width="577">
<font size="1">
<input type="text" name="manufacturer" size="15">
</font>
</td>
</tr>
<tr>
<td width="117"><font size="1">Operating System*:</font></td>
<td width="577">
<font size="1">
<input type="text" name="os" size="10">
</font>
</td>
</tr>
<tr>
<td width="117"><font size="1">CPU*:</font></td>
<td width="577">
<font size="1">
<input type="text" name="cpu" size="10">
</font>
</td>
</tr>
<tr>
<td width="117"><font size="1">Memory*:</font></td>
<td width="577">
<font size="1">
<input type="text" name="memory" size="10">
</font>
</td>
</tr>
<tr>
<td width="117"><font size="1">Harddrive*:</font></td>
<td width="577">
<font size="1">
<input type="text" name="harddrive" size="10">
</font>
</td>
</tr>
<tr>
<td width="117"><font size="1">Video card*:</font></td>
<td width="577">
<font size="1">
<input type="text" name="videocard" size="10">
</font>
</td>
</tr>
<tr>
<td width="117"><font size="1">Sound card*:</font></td>
<td width="577">
<font size="1">
<input type="text" name="soundcard" size="10">
</font>
</td>
</tr>
<tr>
<td width="117"><font size="1">Monitor*:</font></td>
<td width="577">
<font size="1">
<input type="text" name="monitor" size="10">
</font>
</td>
</tr>
<tr>
<td width="117"><font size="1">mouse pad*:</font></td>
<td width="577">
<font size="1">
<input type="text" name="mousepad" size="10">
</font>
</td>
</tr>
<tr>
<td width="117"><font size="1">key board*:</font></td>
<td width="577">
<font size="1">
<input type="text" name="keyboard" size="10">
</font>
</td>
</tr>
</table>
<p>
<font size="1">
<input type="submit" name="Submit" value="Submit"></font>
</p>
</form> <?php
}//end this function
?>
and here is the sql.txt i made for the db.
CREATE TABLE `members` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(255) NOT NULL default '',
`age` varchar(22) NOT NULL default '',
`sex` varchar(22) NOT NULL default '',
`country` varchar(22) NOT NULL default '',
`status` varchar(22) NOT NULL default '',
`game` varchar(22) NOT NULL default '',
`website` varchar(22) NOT NULL default '',
`xfire` varchar(22) NOT NULL default '',
`biography` text NOT NULL,
`manufacturer` varchar(22) NOT NULL default '',
`os` varchar(22) NOT NULL default '',
`cpu` varchar(22) NOT NULL default '',
`memory` varchar(22) NOT NULL default '',
`harddrive` varchar(22) NOT NULL default '',
`videocard` varchar(22) NOT NULL default '',
`soundcard` varchar(22) NOT NULL default '',
`monitor` varchar(22) NOT NULL default '',
`mouse` varchar(22) NOT NULL default '',
`mousepad` varchar(22) NOT NULL default '',
`keyboard` varchar(22) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM AUTO_INCREMENT=1;