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

  • Home
  • SEARCH
  • 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 684421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:48:54+00:00 2026-05-14T01:48:54+00:00

I am using mysqli_stmt_bind_param() to create an INSERT statement. For some reason I am

  • 0

I am using mysqli_stmt_bind_param() to create an INSERT statement. For some reason I am getting an error. I used mysqli_error() to see the error message, but it’s not especially useful.

Is there a way to just see what query is actually being executed?

the resulting 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 ‘desc,date,expdate,mintix,maxtix,contactname,contactemail,contactphone) VALUES (?’ at line 1

  • 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-05-14T01:48:54+00:00Added an answer on May 14, 2026 at 1:48 am

    Prepared statements created by mysqli_prepare() are server-side prepared statements.
    When you execute such a prepared statement only the statement id and the parameters are transferred, not some query string as if you would replace the placeholders by the actual parameters (on the client-side, i.e. your php script).
    But you can see the result in the general log of the MySQL server, see Prepared Statement Logging

    edit: in your case the preparation of the statement fails because desc is a reserved keyword.
    For a list of keywords and how to use them as identifiers (if necessary) see http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html

    $q = '
      INSERT INTO
        `event`
        (
          `cityid`, `name`, `desc`, `date`,
          `expdate`, `mintix`, `maxtix`,
          `contactname`, `contactemail`, `contactphone`
        )
      VALUES
        (
          ?,?,?,?,
          ?,?,?,
          ?,?,?
        )
    ';
    
    if ( false===($stmt=mysqli_prepare($dblink, $q)) ) {
      /* 
        in production-code you might not want to reveal
        the error string to each and every user
        ...but for this example and for debugging purposes:
      */
      die('mysqli_prepare failed: '.htmlspecialchars(mysqli_error($dblink)));
    }
    
    $rc = mysqli_stmt_bind_param(
      $stmt,
      "issssiisss",
      $city,$name,$desc,$date,
      $expdate,$mintix,$maxtix,
      $contactname,$contactemail,$contactphone
    );
    if ( false===$rc ) {
      die('mysqli_stmt_bind_param failed: '.htmlspecialchars(mysqli_stmt_error($stmt)));
    }
    
    
    if ( false===mysqli_stmt_execute($stmt) ) {
      die('mysqli_stmt_execute failed: '.htmlspecialchars(mysqli_stmt_error($stmt)));
    }
    
    mysqli_stmt_close($stmt);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating some basic OO scripts using MySQLi and getting an Undefined Method error
I'm having some issues using mysqli to execute a script with SELECT,DELETE,INSERT and UPDATE
I am able to export mysql to csv file but i am not getting
I'm trying to insert some data into a local MySQL database by using MySQL
I am using mysqli to try and retrieve the teacher's username and then insert
I am Using Mysqli Driver. I am getting Command out of sync when i
I have some questions about using MySQLi queries, and related memory management. Suppose I
Is there still an injection risk when using prepared statements and mysqli_stmt_bind_param? For example:
When I insert 78.9 into Mysql (using JDBC) it gets rounded up to 79?
I'm using the MySQL Connector/C++ library to insert values into a database table. I'm

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.