i am trying to insert a record via a form using php and mysql and when i try to submit the form it comes up with the following error
Column count doesn't match value count at row 1
if someone can please help me overcome this error i would be grateful.
the insert_shirt.php code is:
[PHP]<?php
$conn = mysql_connect("localhost","root","")
or die (mysql_error());
mysql_select_db("noble",$conn);
$insert = "INSERT INTO Shirts
VALUES('$_POST[Shirt_ID]','$_POST[Smart_ID]','$_POST[Shirt_Brand]','$_POST[Shirt_Type]',
'$_POST[Shirt_Colour]','$_POST[Shirt_Price]','$_POST[Shirt_image]',
'$_POST[Shirt_Description]')";
if (mysql_query($insert,$conn)) {
echo "Record Added";
} else {
echo mysql_error();
}
?>[/PHP]
the form code is :
[HTML]<body>
<h1><img src="Web Images/Banners/SuitFormTitle1.jpg"></img></h1>
<table>
<tr>
<td>
<h3>
<a href="Suit_Form.html"><img src="Web Images/Buttons/Smart.jpg"></img></a><br />
<a href="Casual_Form.html"><img src="Web Images/Buttons/Casual.jpg"></img></a><br />
<a href="Suit_Form.html"><img src="Web Images/Buttons/Urban.jpg"></img></a><br />
</h3>
</td>
</tr>
</table>
<div style='margin:0 auto;width:600px;'>
<form action="Insert_Shirt.php" method="post">
<div class="row">
<span class="item"><h2>Shirt ID</h2></span>
<span class="formw"><input type="text" name="Shirt_ID" size="5" /></span>
</div>
<div class="row">
<span class="item"><h2>Smart ID</h2></span>
<span class="formw"><input type="text" name="Smart_ID" value="2" size="5" /></span>
</div>
<div class="row">
<span class="item"><h2>Shirt Brand</h2></span>
<span class="formw"><input type="text" name="Shirt_Brand" size="20"/></span>
</div>
<div class="row">
<span class="item"><h2>Shirt Type</h2></span>
<span class="formw"><input type="text" name="Shirt_Type" size="20"/></span>
</div>
<div class="row">
<span class="item"><h2>Shirt Colour</h2></span>
<span class="formw"><input type="text" name="Shirt_Colour" size="20"/></span>
</div>
<div class="row">
<span class="item"><h2>Shirt Price</h2></span>
<span class="formw"><input type="text" name="Shirt_Price" size="10"/></span>
</div>
<div class="row">
<span class="item"><h2>Shirt Image</h2></span>
<span class="formw"><input type="text" name="Shirt_image" size="30" value="web images\Items\Shirts\" /></span>
</div>
<div class="row">
<span class="item"><h2>Shirt Description</h2></span>
<span class="formw"><textarea name="Shirt_Description" rows="5" cols="20"></textarea></span>
</div>
<div class="row">
<span class="item"></span>
<span class="formw"><input type="image" name="submit" src="Web Images/Buttons/Submit.jpg"/></span>
</form>
</div>
</body>[/HTML]
i am trying to insert the following values:
Expand|Select|Wrap|Line Numbers
- '1',
- '2',
- 'YSL',
- 'Pleated',
- 'Grey',
- '90.00',
- 'image_url',
- 'Description'.
ashraf