Re: Printing sql rows
| From: | Philip Olson | Date: | Wed, 10 Oct 2001 01:55:05 +0000 |
| Subject: | Re: Printing sql rows | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-70572@lists.php.net to get a copy of this message | ||
Select the row you want. For example, assuming your database had
a column named 'id', you could do something like :
SELECT * FROM tablename WHERE id='$id';
In this case you know the id, the results will be all data found within
its row. This is basic SQL syntax, some basic SQL information can be
seen :
http://www.sqlcourse.com/
http://www.onlamp.com/pub/ct/19
http://w3.one.net/~jhoffman/sqltut.htm
With the following being an example :
$result = mysql_query("SELECT * FROM foo WHERE id='$id'");
$row = mysql_fetch_assoc($result);
print $row['column_name'];
Regards,
Philip Olson
On Wed, 10 Oct 2001, Devon wrote:
> I can print seperate coloums out of a mysql database using PHP but I cant
> print out seperate rows. Any ideas?
>
> Cheers
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>