Is it possible to use subquery and at the same time use data in values when Inserting in mysqli?
insert into articles(description) values('Information');
insert into blogs(blog, article_id) values('example.com/', SELECT LAST_INSERT_ID());
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
Yes you can. Simply wrap the subquery in parenthesis. Example:
But as @Pekka suggested in the comments above, in this case, you do not even need a subquery. This would have worked: