mysql error #1064 while insert from php page [duplicate]

This question already has an answer here:

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 ‘add, country, telNo, fax, mobile, paperID, addPaper, workshop, social, trip) ‘ at line 1

   <?php include("../include/dbscd.php");

   $i=0;

  foreach ( $_POST as $sForm => $value )
{
$postedValue = htmlspecialchars( stripslashes( $value ), ENT_QUOTES ) ;
$valuearr[$i] = $postedValue; 
$i++;
}
$addrecord = "INSERT INTO register_paper (pre_name, design, email, org, add, country, telNo, fax, mobile, paperID, addPaper, workshop, social, trip)
  VALUES('$valuearr[0]', '$valuearr[1]', '$valuearr[2]', '$valuearr[3]', '$valuearr[4]', '$valuearr[5]', '$valuearr[6]', '$valuearr[7]', '$valuearr[8]', '$valuearr[9]', '$valuearr[10]', $valuearr[11], '$valuearr[12]', '$valuearr[13]')";
  //echo $addrecord;
  $result = mysql_query($addrecord) or die(mysql_error()); 

    ?>
  <script type="text/javascript">
    window.location = "callforpaper.php"
  </script>

all of the attribute are varchar while workshopID is INT(10) and the FK from another table, same goes to paperID

      <form action="add_regiPaper.php" method="post" >

      <table table summary="Summary Here" cellpadding="0" cellspacing="0">
        <tr class="light">
            <td>Name:</td>
            <td><input type="text" name="pre_name" /></td>
        </tr>
        <tr class="dark">
            <td>Designation:</td>
            <td><select name="design">
            <option value=""</option>
            <option value="ms">Ms</option>
            <option value="mdm">Madam</option>
            <option value="mr">Mr</option>
            <option value="sir">Sir</option>
            
            </select> </td>
        </tr>
        <tr class="light">
            <td>Email:</td>
            <td><input type="text" name="email" /></td>
        </tr >
        <tr class="dark">
            <td>Organization:</td>
            <td><input type="text" name="org" /></td>
        </tr>
        <tr class="light">
            <td>Postal Address:</td>
            <td><textarea name="add" ></textarea></td>
        </tr>
        <tr class="dark">
            <td>Country:</td>
            <td>
                <input type="radio" name="country" value="Malaysia" /> Malaysia<br/>
                <input type="radio" name="country" value="Malaysia" /> Others
            </td>
        </tr>
        <tr class="light">
            <td>Telephone Number:</td>
            <td><input type="text" name="telNo" /></td>
        </tr>
        <tr class="dark">
            <td>Fax Number:</td>
            <td><input type="text" name="fax" /></td>
        </tr>
        <tr class="light">
            <td>Mobile Number:</td>
            <td><input type="text" name="mobile" /></td>
        </tr>
        <tr class="dark">
            <td>Code Paper:</td>
            <td><input type="text" name="paperID" />              *sent to your email</td>
        </tr>

       
        
     <tr class="light">
        <td>Additional Paper:</td>
        <td>                
            <input type="radio" name="addPaper" value="1 Paper (RM 1100)" /> 1 Paper (RM 1100)<br/>
            <input type="radio" name="addpaper" value="2 Paper (RM 2200)" /> 2 Paper (RM 2200)<br/>
            <input type="radio" name="addPaper" value="More than 3 papers (multiply number of papers by RM 1100)" /> More than 3 papers (multiply number of papers by RM 1100)<br/>
            <input type="radio" name="addPaper" value=" No Additional Paper" /> No Additional Paper
        </td>
    </tr>
    <tr class="dark">
    <td>Workshop:</td>
    <td><input type="checkbox" name="workshop" value="3" />Not Attending <br />
    
    <input type="checkbox" name="workshop" value="1" />Many Eyes<br />
    <input type="checkbox" name="workshop" value="2" />Python<br /></td>

    <tr class="light">
        <td>Social/Gala Dinner:</td>
        <td>                
            <input type="radio" name="social" value="Will Attend (RM 165 per person)" /> Will Attend (RM 165 per person)<br/>
            <input type="radio" name="social" value="Will Not Attend" /> Will Not Attend
        </td>
    </tr>
    
    <tr class="dark">
    
    <td>Social Trips:</td>
    <td><input type="radio"  name="trip" value="Yes" />Yes
         <input type="radio" name="trip" value="No" />No</td>
    </tr>

    

     <tr class="light">
        <td></td>
        <td><input type="submit" value="Save and Proceed" /></td>
    </tr>
</table>

    </form>


Source: wampserver

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.