Re: $result = mysql_query($query);
| From: | Paul Nicholson | Date: | Sat, 14 Sep 2002 16:43:02 +0000 |
| Subject: | Re: $result = mysql_query($query); | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-116387@lists.php.net to get a copy of this message | ||
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hey,
I think what your after is mysql_num_rows().
- ----
if(mysql_num_rows($result) != 0){
- ----
or you could try:
- ----
if($result){
- ----
HTH!
~Pauly
On Saturday 14 September 2002 12:22 pm, you wrote:
> Hi,
>
> I did a query like this:
>
> $query = "SELECT * from TABLE WHERE CHAMP = 'truc' order by NO LIMIT 0,10";
> $result = mysql_query($query);
>
> what i'm trying to do is if the result is !=0 echo the result else echo
> nothing
> i tried this
>
> if($result != 0){
> ?>
> HTML here if we have result
> <?
> while($row = mysql_fetch_array($result)){?>
>
> a href="http://<?=$row[WEB];?>"
> target="_blank"><?=$row[DESCRIPTION];?></a>
>
> <?php
> }
> }?>
>
> thanx for your help
- --
~Paul Nicholson
Design Specialist @ WebPower Design
"The web....the way you want it!"
paul@webpowerdesign.net
"It said uses Windows 98 or better, so I loaded Linux!"
Registered Linux User #183202 using Register Linux System # 81891
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE9g2cYDyXNIUN3+UQRAmgoAJ0YXCok8YPhkTaXHGRCvehIYOu+FgCfdSQh
iGUuo84dqxXXk5PK6D55kaY=
=AY78
-----END PGP SIGNATURE-----