Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8076489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:16:15+00:00 2026-06-05T15:16:15+00:00

I encounter error like this in my sql in running my program, How can

  • 0

I encounter error like this in my sql in running my program, How can I resol this error?

Error: 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 ‘s’, ‘s’, ‘s’,’s’,’s’,’s’,’s’, ‘s’)’ at line 3

This is the syntax I used.

<?php 
    include('config.php');
    ERROR_REPORTING("E_ALL");
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <title>AVAYA</title>
    <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" />

</head>
<body>
<div id="page" class="shell">
<div id="mainWrapper"> 
<div id="top">
        <div class="cl">&nbsp;</div>
        <h1><img src="css/images/dtsi-logo.jpg"></h1>
        <div class="cl">&nbsp;</div>
<div>
<?php include_once("template_header.php");?>
</div>

    </div>

<?php
$host="localhost"; // Host name 
$username="<myusername>"; // Mysql username 
$password="<mypassword>"; // Mysql password 
$db_name="inventory"; // Database name 
$tbl_name="avaya_pabx"; // Table name

mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DB");


$con = mysql_connect("localhost","root","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
mysql_select_db("inventory", $con);


$addavaya="INSERT INTO avaya_pabx
(item_no, critical_spare_id, serial_no, comcode, version, circuit_pack, classification, location, availability)
VALUES ('". $_POST['item_no'] . ", '". $_POST['critical_spare_id'] . "', '" . $_POST['serial_no']. "', '". $_POST['comcode'] . "','". $_POST['version'] . "','". $_POST['circuit_pack'] . "','". $_POST['classification'] . "','". $_POST['location'] . "', '". $_POST['availability'] . "')";


$result = mysql_query($addavaya,$con);

if (!$result) 
  {
  die('Error: ' . mysql_error());
  }
echo "1 record added";

mysql_close($con);

?>

<br /><a href='avayatable.php'><input type=button class='classname' value='Back'></a>

<?php include_once("template_footer.php");?>
</div>
<br />

</div>
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T15:16:17+00:00Added an answer on June 5, 2026 at 3:16 pm

    Hello SQL injection …

    Try to use the PDO instead of this approach

    http://php.net/manual/en/book.pdo.php

    However, the solution for your problem is that the first variable in your values must be like this

     VALUES ('". $_POST['item_no'] . "',
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a list in C that is something like this: typedef struct _node
In the Oracle PL/SQL , I have this coding, it gives me complier error.
i encounter an error like Error 1 fatal error LNK1107: invalid or corrupt file:
I'am very new to google-apps-script. I encounter this error TypeError: Cannot find function getValue
I have encountered an error, java.sql.SQLException: Column count doesn't match value count at row
I get the following exception, java.sql.SQLSyntaxErrorException: Syntax error: Encountered 80 at line 1, column
I'm familiar with this sort of syntax in SQL Server, to concatenate strings in
I am calling a PL/SQL procedure like this: execute util.verify(src_schema => '&username', stab =>
I frequently encounter this error in Mako templates using Pylons 0.9.7: AttributeError: 'NoneType' object
I have a bulk insert that works on SQL Server 2000 that I'm trying

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.