I need to return postid (auto-incrementing PK) strings when I insert it.
I am currently using this to get it
//get postid to return if($result = $db -> query('SELECT postid FROM posts WHERE title = \''.$title.'\' LIMIT 1')){ $row = $result->fetch_assoc(); $json['postid'] = $row['postid']; $result->free();
where $ title is the name of the name of the newly inserted record.
Is there a part of the mysqli class that will allow me to do this in a single query? $ Db → query () returns any information that will make it simpler and safer?
I tried looking at the mysqli documentation, but I could not find what I wanted. I'm sure he's out there somewhere.
Several headers will ruin this, and although they are not allowed, you cannot be too secure.
source share