The very first record will be the very first time you assign the $row a
query result.  So basically:

$row = mysql_fetch_array($sql_result);

$row will now only have the very first results data in it, if you want the
next rows data you would just call it again:

$row = mysql_fetch_array($sql_result);

Your while statement is just doing this a bunch of times until it reaches
the end of your results.

Enjoy!

Rick

"If I accept you as you are, I will make you worse; however, if I treat you
as though you are what you are capable of becoming, I help you become that."
- Johann Wolfgang von Goethe

> From: "Philip J. Newman" <[EMAIL PROTECTED]>
> Organization: Philip's Domain - Internet Project
> Reply-To: "Philip J. Newman" <[EMAIL PROTECTED]>
> Date: Mon, 25 Feb 2002 12:15:36 +1300
> To: <[EMAIL PROTECTED]>
> Subject: [PHP]  [NEWMAN] Collecting information from a my sql table.
> 
> <?php
> 
> $sql = "SELECT * FROM `publisher` WHERE 1 AND `pub_id` = $pub_id LIMIT 1";
> $sql_result = mysql_query($sql, $connection) or die ("Could not get Query");
> 
> while ($row = mysql_fetch_array($sql_result)) {
> $pub_id = $row["pub_id"];
> $pub_headline = $row["pub_headline"];
> $pub_dateline = $row["pub_dateline"];
> $pub_info = $row["pub_info"];
> $pub_image = $row["pub_image"];
> 
> }
> 
> ?>
> 
> When I want to get just one record is there an easyer way than using the while
> loop that I have been using?
> 
> 
> Philip J. Newman
> Philip's Domain - Internet Project.
> http://www.philipsdomain.com/
> [EMAIL PROTECTED]
> Phone: +64 25 6144012
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to