> Then you can use:
> if (mysql_num_rows($result) == 0) {
> stuff here
> }
> This will check the number of rows returned from your query. If zero,
> then do somethingmodify as you need.
What I generally do is this:
if(( !$result ) || ( mysql_errno() > 0 )) {
// error code here
}
OR
cool! thanks Sam and Jeff, for your responses!
best,
a
> -Original Message-
> From: Sam Masiello [mailto:[EMAIL PROTECTED]]
> Sent: Monday, September 10, 2001 1:48 PM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: RE: [PHP] test for empty $result??
>
>
]
-Original Message-
From: Andrew [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 10, 2001 1:45 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP] test for empty $result??
thansk, but $result here is a Resource ID, and will be present even if
the
result set associated with it is
D]
> Subject: RE: [PHP] test for empty $result??
>
>
> Just use:
>
> if (!$result){
> code here
> }
>
> Jeff
>
> > -Original Message-
> > From: Andrew [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, September 10, 2001 1:34 PM
> > To: [EMAIL
Just use:
if (!$result){
code here
}
Jeff
> -Original Message-
> From: Andrew [mailto:[EMAIL PROTECTED]]
> Sent: Monday, September 10, 2001 1:34 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] test for empty $result??
>
>
> I know that this has been discussed b
I know that this has been discussed before, but I cannot find the threads
so...
I have a function that does a mysql_query and want to break if the SQL query
didn't return any rows in $result.
empty(), isset() will not work, for obvious reasons.
Can anyone suggest an alternative?
$sql="select r
6 matches
Mail list logo