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 7968371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:03:57+00:00 2026-06-04T07:03:57+00:00

How do you write a prepared update statement? Reference: mysqli::prepare I’ve tried writing it

  • 0

How do you write a prepared update statement? Reference:mysqli::prepare

I’ve tried writing it as described:

  if ($stmt = $mysqli->prepare("UPDATE tblFacilityHrs SET title =? description = ? WHERE uid = ?")){
            $stmt->bind_param('sss', $title, $desc, $uid2);

            //Get params
            $title=$_POST['title'];
            $desc=$_POST['description'];
            $uid2=$_GET['uid'];     

$stmt->execute();
            $stmt->close();
    }
    else {
        //Error
        printf("Prep statment failed: %s\n", $mysqli->error);
    }

Error:

Prep statment failed: 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 ‘description = ? WHERE uid = ?’ at line 1 Edited
row.

  • 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-04T07:03:58+00:00Added an answer on June 4, 2026 at 7:03 am

    You’re just missing a comma between the set columns:

    UPDATE tblFacilityHrs SET title = ?, description = ? WHERE uid = ?
                                    ^^^^^^
    

    When MySQL reports an error the likes of check the manual for syntax to use near ‘something, look most often to the character immediately preceding the ‘something, as that is where your error occurs.

    $sql = "UPDATE tblFacilityHrs SET title = ?, description = ? WHERE uid = ?";
    $stmt = $mysqli->prepare($sql);
    $stmt->bind_param('sss', $title, $desc, $uid2);
    $stmt->execute();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using mysqli prepared statments and I am trying to write a prepared
How to write a Java prepared statement for MySQL so that it would pick
I currently have a prepared statement in Java which uses the following SQL statement
Is there any way to access the prepared statement as sent to the SQL
There is a good way to use a prepared statement in java where there
How to prepare a text content to be readily saved by the user? document.write(this
What does precompiling a statement do, because I have seen that if I write
I have been reusing the same variable $stmt in my PHP script to write
I have heard that prepared statements with SQLite should improve performance. I wrote some
Write a program to determine whether a computer is big-endian or little-endian. bool endianness()

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.