Jump to content

[SOLVED] Question on querying mysql


graham23s

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/65606-solved-question-on-querying-mysql/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.