I Have A An Error On This Script

Discussion on SQL and MySQL
no avatar
spluskhan
 
Posts: 2
Joined: Thu Mar 07, 2013 2:01 am

I Have A An Error On This Script

by spluskhan » Thu Mar 07, 2013 2:06 am

This is error:

Parse error: syntax error, unexpected '.', expecting ']' in /home/eccop.com.pk/main_u_pk/userppoo09923/insert.php on line 12

This is code:
Code: Select all
<?php
$con=mysqli_connect("exapmle.com","user","pass","d atabase");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
 
$sql="INSERT INTO Products (name, available_conditions, v.good, good, poor, faulty)
VALUES
('$_POST[name]','$_POST[available_conditions]','$_POST[v.good]','$_POST[good]','$_POST[poor]','$_POST[faulty]')";
 
if (!mysqli_query($con,$sql))
{
die('Error: ' . mysqli_error());
}
echo "1 record added";
 
mysqli_close($con);
?>



And This is Forrm:

Code: Select all
<div id="wb_Form1" style="position:absolute;width:361px;height:270px;">
<form name="Add_New_Items" method="post" action="insert.php" enctype="text/plain" id="Form1">
<div id="wb_Text1" style="position:absolute;left:10px;top:15px;width:121px;height:16px;z-index:30;text-align:left;">
<span style="color:#000000;font-family:Arial;font-size:13px;">name:</span></div>
<input type="text" id="Editbox1" style="position:absolute;left:141px;top:15px;width:198px;height:23px;line-height:23px;z-index:31;" name="Editbox1" value="">
<div id="wb_Text2" style="position:absolute;left:10px;top:45px;width:121px;height:32px;z-index:32;text-align:left;">
<span style="color:#000000;font-family:Arial;font-size:13px;">available_conditions:</span></div>
<input type="text" id="Editbox2" style="position:absolute;left:141px;top:45px;width:198px;height:23px;line-height:23px;z-index:33;" name="Editbox2" value="">
<div id="wb_Text3" style="position:absolute;left:10px;top:75px;width:121px;height:16px;z-index:34;text-align:left;">
<span style="color:#000000;font-family:Arial;font-size:13px;">v.good:</span></div>
<input type="text" id="Editbox3" style="position:absolute;left:141px;top:75px;width:198px;height:23px;line-height:23px;z-index:35;" name="Editbox3" value="">
<div id="wb_Text4" style="position:absolute;left:10px;top:105px;width:121px;height:16px;z-index:36;text-align:left;">
<span style="color:#000000;font-family:Arial;font-size:13px;">good:</span></div>
<input type="text" id="Editbox4" style="position:absolute;left:141px;top:105px;width:198px;height:23px;line-height:23px;z-index:37;" name="Editbox4" value="">
<div id="wb_Text5" style="position:absolute;left:10px;top:135px;width:121px;height:16px;z-index:38;text-align:left;">
<span style="color:#000000;font-family:Arial;font-size:13px;">poor:</span></div>
<input type="text" id="Editbox5" style="position:absolute;left:141px;top:135px;width:198px;height:23px;line-height:23px;z-index:39;" name="Editbox5" value="">
<div id="wb_Text7" style="position:absolute;left:10px;top:165px;width:121px;height:16px;z-index:40;text-align:left;">
<span style="color:#000000;font-family:Arial;font-size:13px;">faulty:</span></div>
<input type="text" id="Editbox6" style="position:absolute;left:141px;top:165px;width:198px;height:23px;line-height:23px;z-index:41;" name="Editbox6" value="">
<input type="submit" id="Button1" name="" value="Submit" style="position:absolute;left:141px;top:195px;width:96px;height:25px;z-index:42;">
<input type="reset" id="Button2" name="" value="Reset" style="position:absolute;left:141px;top:225px;width:96px;height:25px;z-index:43;">
</form>
</div>

Return to SQL and MySQL