List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:October 27 2000 8:45pm
Subject:Re: Empty or not?
View as plain text  
At 4:15 PM -0400 10-27-2000, Gary wrote:
>Hi Don,
>  I modified the !results to
>
>     if (! ($result) ) {
>     echo "<BR><B>MySQL error :" .mysql_errno() ."</B>\n";
>     return(false);
>}
>
>The problem seem to be with the first query. I am getting MySQL error 0:. Does
>0 mean false and the query is bad?

No, actually, 0 means "no error", so your query is probably okay.
If you want to check whether or not the result set is empty,
test the value of mysql_num_rows().  It'll return the number of rows
selected by your SELECT statement.

>
>Thanks
>Gary
>
>Don Read wrote:
>
>>  On 27-Oct-00 Gary wrote:
>>  > Hello Everyone,
>>  > I have a problem with displaying a table with php and mysql. I am trying
>>  > to go through this step by step. I have check the syntax of the queries
>>  > with echo mysql_error(); and it seem to be ok. What I need to know, if
>>  > the queries i am using are the problem (empty) or do i need to look at
>>  > how I am printing the table?
>>  > <snip>
>>
>>  always test your handles.
>>
>>  >
>>  >  // get results
>>  > $result=mysql_query("SELECT id,checkbox,username,email,password
>>  >     FROM members WHERE id = '$id'
>>  >     ORDER BY id DESC limit $offset,$limit");
>>  >
>>
>>  if (! ($result) ) {
>>      echo "<BR><B>MySQL error :" .mysql_error() ."</B>\n";
>>      return(false);
>>  }
>>
>>  > // display the results returned
>>  > while ($data=mysql_fetch_array($result)){
>>  >
>>  > <snip>
>>  >
>>
>>  If your table is "blank", check for the closing </td>'s &
> </tr>'s
>>  weblint is your friend (or should be).
>>
>>  Regards,
>>  --
>>  Don Read                     dread@stripped
>>  There are old sailors, and there are foolish
>  > sailors; but damn few old foolish sailors.

-- 
Paul DuBois, paul@stripped
Thread
Empty or not?Gary27 Oct
  • RE: Empty or not?Don Read27 Oct
    • Re: Empty or not?Gary27 Oct
      • Re: Empty or not?Paul DuBois27 Oct
    • Re: Empty or not?Gary28 Oct
Re: Empty or not?Richard Ellerbrock28 Oct