What error do you see, George?


Maxim Maletsky
www.PHPBeginner.com



-----Original Message-----
From: Sheridan Saint-Michel [mailto:[EMAIL PROTECTED]] 
Sent: mercoledý 26 settembre 2001 17.01
To: George Pitcher; [EMAIL PROTECTED]
Subject: Re: [PHP] Building Dynamic Value list using ohp


----- Original Message -----
From: "George Pitcher" <[EMAIL PROTECTED]>
To: "Maxim Maletsky (PHPBeginner.com)" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Wednesday, September 26, 2001 9:42 AM
Subject: Re: [PHP] Building Dynamic Value list using ohp


> Thanks for everyone's help but this is still failing to work.
>
> Revised code is:
>
> <?php
> $link = mysql_connect ('localhost', '****', '****')
>    or die ("Could not select db");
> mysql_select_db ('Heronsql')
>    or die ("Could not connect");
> $query="select distinct HEI from heronuser";
>    $result = mysql_query ($query); // I've also tried with ($query,
$link)
>      if(mysql_num_rows($result)) {
>        // show all HEIs as options in select form
>        while($row = mysql_fetch_row($result))
>        {
>           print("<option value=\"{$row[0]}\">{$row[0]}</option>");
>        }
>      }
> mysql_close($link);
> ?>
>
> Any more suggestions (please)?
>
> George

I don't see anything glaringly wrong with your code.
I would change this:

$result = mysql_query ($query)

into:

if( !($result = mysql_query ($query)) )
  echo "Error: " . mysql_error() . "<BR>";

as I find that most of my errors in something this simple
are in something fairly simple with the query itself (misspelled table
or something).

also make sure that if you copy your query and paste it directly into
MySQL that it works.

Sheridan Saint-Michel
Website Administrator
FoxJet, an ITW Company
www.foxjet.com


-- 
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]



--
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