graham23s Posted August 18, 2007 Share Posted August 18, 2007 Hi Guys, i know there are 2 ways to query mysql: 1st: longer $query_insert_2 = "INSERT INTO `forum_posts` (`topic_id`,`user_id`,`date`,`body`) VALUES ('','$poster',now(),'$for_id','$body')"; $result_insert_2 = mysql_query($query_insert_2) or die (mysql_error()); 2nd smaller mysql_query("SELECT `topic_id` FROM `forum_topics` WHERE `id`='$for_id'"); i usually use the first one and do this to fetch the rows: $row = mysql_fetch_array($result_insert_2) then do: $id = $row['id']; but im not sure how i would go about getting the rows using the 2nd way any help would be appreciated thanks guys Graham Quote Link to comment https://forums.phpfreaks.com/topic/65606-solved-question-on-querying-mysql/ Share on other sites More sharing options...
soycharliente Posted August 18, 2007 Share Posted August 18, 2007 The same way? Quote Link to comment https://forums.phpfreaks.com/topic/65606-solved-question-on-querying-mysql/#findComment-327620 Share on other sites More sharing options...
graham23s Posted August 18, 2007 Author Share Posted August 18, 2007 so basically this: $query = mysql_query("SELECT `topic_id` FROM `forum_topics` WHERE `id`='$for_id'"); then $row = mysql_fetch_array($query); right under my nose lol cheers Graham Quote Link to comment https://forums.phpfreaks.com/topic/65606-solved-question-on-querying-mysql/#findComment-327630 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.