On Tue,  4 Dec 2001 08:29, Lee Philip Reilly wrote:
> Hi,
>
> I wonder if someone could point out what is wrong with the following
> piece of code (taken directly from the 'PHP - fast & easy web
> development' book) , which gives the following warning :
>
> Warning: Supplied argument is not a valid MySQL result resource in
> c:\program files\apache group\apache\htdocs\cms\pick_modcontact.php on
> line 23
>
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> $result = mysql_query($sql,$connection);    <--line 23

Use mysql_error() here to return the error string from mysql, which will 
tell you more about your problem; it will be in the code before line 23

>
> while ($row = mysql_fetch_array($result)) {

Using extract($row) here will save you typing :-)

>  $id = $row['id'];
>  $fname = $row['fname'];
>  $lname = $row['lname'];
>
>  $option_block .= "<option value=\"$id\">$lname, $fname</option>";
> }
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
> The mySQL query that is executed returns a result set when I use the
> mySQL shell, and the connection string is valid. If someone could
> advise me as to the error, I would greatly appreciate it.
>
> - Best regards,
>
> Lee

-- 
David Robley      Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES      Flinders University, SOUTH AUSTRALIA  

   He who always plows a straight furrow is in a rut.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to