Jump to content
Larry Ullman's Book Forums
Sign in to follow this  

How to create prepared statements for incremental value in a query

Recommended Posts


I am having problem in creating prepared statements for the below code example. The $s_id has auto incremental value.

Will someone point me with an example on how to do this according to the code below?

$s_id = $db->insert_id;
$update = $db->query("UPDATE mb SET s_id = {$s_id} WHERE id = {$cs}");

Thank you.

Share this post

Link to post
Share on other sites

I'm not quite following the use case here (why you'd update a table to an auto-increment value) but, more importantly, this isn't a prepared statement? Could you provide a bit more code? Also, when you say you're having a problem, what is happening that shouldn't? Are you seeing any error messages? 

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

Sign in to follow this  

  • Create New...