RE: Re: Newbie Questions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 5 Sep 2004, Pete Holsberg wrote:

> Well, I have this:
> 
> $result=mysql_query('SELECT * FROM $table ORDER BY lastname, street, housenum ASC');
> 
> while ($row=mysql_fetch_assoc($result))
> { 
>    echo $row['lastname'].' '.$row['firstname'].' '.$row['housenum'].' '.$row['street'];
> }
> 
> and I get "Warning: mysql_fetch_assoc(): supplied
> argument is not a valid MySQL result resource in
> /home/.fanny/pjh/4seasonsatmapleton.org/4sam/directory/showForm-mod.php
> on line 26"
> 
> Line 26 is the while statement.
> 
> ????

<blush> I have to learn to keep a 3x5 card with my column
headings nearby!!

But having corrected that, I'm running into another
problem.

I added:

if (!$result) {
   echo "Could not successfully run query ($sql) from DB: ". mysql_error();
   exit;
}

if (mysql_num_rows($result) == 0) {
   echo "No rows found, nothing to print so am exiting";
   exit;
}

And they output nothing nowm so I assume that there are
things to print. But the "while" statement produces nothing
also.

Also, I think I misunderstood something someone saod
earlier.  Is it true that the above mysql_query call does
not change the way the database is stored by simply sorts
the copy that's in memory?

Thanks.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux