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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.