tvanmaren Posted August 12, 2010 Report Share Posted August 12, 2010 I'm trying to insert a variable into my SELECT query. Is there something I'm missing with this? $invoice = mysql_insert_id(); $result = mysql_query ("SELECT * FROM applicant WHERE invoice = $invoice"); Everything works when I put a value instead of the variable $invoice, but want the query run on the last updated row. Is there another way to do this? Thanks! Quote Link to comment Share on other sites More sharing options...
Guest onintks Posted August 12, 2010 Report Share Posted August 12, 2010 Hi should it be $result = mysql_query ("SELECT * FROM applicant WHERE invoice ='$invoice'"); Quote Link to comment Share on other sites More sharing options...
falkencreative Posted August 12, 2010 Report Share Posted August 12, 2010 One other quick comment... You may want to check that your mysql_insert_id() function is returning the expected results. If onintks's advice above still doesn't work for you, you may want to try echoing out the $invoice variable to see if it's giving you unexpected information. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.