countdrac Posted December 5, 2007 Share Posted December 5, 2007 im trying to do an INSERT then right away a SELECT (on that insert ) and for some reason the SELECT it returns nothing... im kinda new to mysql... $query = "INSERT INTO category (category_name) VALUES('".$category."')"; $result = mysql_query($query) or die(mysql_error()); $query = "SELECT category_id FROM category WHERE category_name = '".$category."'"; $result = @mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { $category_id = $row['$category_id']; } thanks Quote Link to comment https://forums.phpfreaks.com/topic/80259-solved-insert-and-select-help/ Share on other sites More sharing options...
~n[EO]n~ Posted December 5, 2007 Share Posted December 5, 2007 Your $category_id = $row['$category_id']; should be $category_id = $row['category_id']; Quote Link to comment https://forums.phpfreaks.com/topic/80259-solved-insert-and-select-help/#findComment-406752 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.