Jump to content

I Have A An Error On This Script


spluskhan

Recommended Posts

Parse error: syntax error, unexpected '.', expecting ']' in /home/pk.co.pk/uk.pko/insert.php on line 125

 

++++++++++

inser.php

+++++++++

 

    <?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 Here is the form:

+++++++++++++++++++++++++++++++++++++++

    <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>
Link to comment
Share on other sites

<?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);

?>
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.