Re: MySQL frustration
| From: | Greg Donald | Date: | Tue, 18 Jul 2000 03:25:36 +0000 |
| Subject: | Re: MySQL frustration | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-7014@lists.php.net to get a copy of this message | ||
On Tue, 18 Jul 2000, Tom Peck wrote:
> // The frustrating code
>
> $tempName = "This Person";
>
> $sql = "SELECT * FROM tblPlayers WHERE fldName='$tempName'";
> $result = mysql_query($sql);
>
> if ( $result ) {
> echo "<br> RESULT TRUE!";
> }
>
> else
>
> echo "<br> RESULT FALSE!";
> }
$tempName="destiney";
$result=mysql_query("select *
from tblPlayers
where fldName='$tempName'
",$db);
if($myrow=mysql_fetch_array($result)){
echo "<br> RESULT TRUE!";
} else {
echo "<br> RESULT FALSE!";
}
You should be testing for the existance of a populated array rather than
the for the query itself.
Greg
--
------------------------------------------------------------------------
destiney - (des-ti-ny) - n. 1. deity of all things "html", 2. common
internet addict, 3. lover of late 80's heavy metal music, 4. Activist
for the terminally un-elite; see also - cool guy, des, mr. php...
It's 4:00am, your web site is still up, why are you?
http://destiney.com/
------------------------------------------------------------------------