hi
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.ph p code is:
[PHP]<?php
$conn = mysql_connect(" localhost","roo t","")
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_Descripti on]')";
if (mysql_query($i nsert,$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_Fo rm.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:600p x;'>
<form action="Insert_ Shirt.php" method="post">
<div class="row">
<span class="item"><h 2>Shirt ID</h2></span>
<span class="formw">< input type="text" name="Shirt_ID" size="5" /></span>
</div>
<div class="row">
<span class="item"><h 2>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"><h 2>Shirt Brand</h2></span>
<span class="formw">< input type="text" name="Shirt_Bra nd" size="20"/></span>
</div>
<div class="row">
<span class="item"><h 2>Shirt Type</h2></span>
<span class="formw">< input type="text" name="Shirt_Typ e" size="20"/></span>
</div>
<div class="row">
<span class="item"><h 2>Shirt Colour</h2></span>
<span class="formw">< input type="text" name="Shirt_Col our" size="20"/></span>
</div>
<div class="row">
<span class="item"><h 2>Shirt Price</h2></span>
<span class="formw">< input type="text" name="Shirt_Pri ce" size="10"/></span>
</div>
<div class="row">
<span class="item"><h 2>Shirt Image</h2></span>
<span class="formw">< input type="text" name="Shirt_ima ge" size="30" value="web images\Items\Sh irts\" /></span>
</div>
<div class="row">
<span class="item"><h 2>Shirt Description</h2></span>
<span class="formw">< textarea name="Shirt_Des cription" 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:
thanks in advance
ashraf
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.ph p code is:
[PHP]<?php
$conn = mysql_connect(" localhost","roo t","")
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_Descripti on]')";
if (mysql_query($i nsert,$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_Fo rm.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:600p x;'>
<form action="Insert_ Shirt.php" method="post">
<div class="row">
<span class="item"><h 2>Shirt ID</h2></span>
<span class="formw">< input type="text" name="Shirt_ID" size="5" /></span>
</div>
<div class="row">
<span class="item"><h 2>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"><h 2>Shirt Brand</h2></span>
<span class="formw">< input type="text" name="Shirt_Bra nd" size="20"/></span>
</div>
<div class="row">
<span class="item"><h 2>Shirt Type</h2></span>
<span class="formw">< input type="text" name="Shirt_Typ e" size="20"/></span>
</div>
<div class="row">
<span class="item"><h 2>Shirt Colour</h2></span>
<span class="formw">< input type="text" name="Shirt_Col our" size="20"/></span>
</div>
<div class="row">
<span class="item"><h 2>Shirt Price</h2></span>
<span class="formw">< input type="text" name="Shirt_Pri ce" size="10"/></span>
</div>
<div class="row">
<span class="item"><h 2>Shirt Image</h2></span>
<span class="formw">< input type="text" name="Shirt_ima ge" size="30" value="web images\Items\Sh irts\" /></span>
</div>
<div class="row">
<span class="item"><h 2>Shirt Description</h2></span>
<span class="formw">< textarea name="Shirt_Des cription" 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:
Code:
'1', '2', 'YSL', 'Pleated', 'Grey', '90.00', 'image_url', 'Description'.
ashraf
Comment