At 02:04 24/02/03, you wrote:
Hi,

yes in fact it worked...I also had the $numrows with wrong mysql command, it
should be mysql_num_rows() instead of the mysql_fetch_rows().
Thx Ernest

But now that this is working, i have another big problem...my
$drop_down_list isn't assuming the value of the shown option...right here on
the below part

********
for ($i = 0; $i < $num; $i++) {
            $aviao = mysql_result($resultaviao, $i, "aviao");
            $sk = mysql_result($resultaviao, $i, "sk");
            $drop_down_list .= "<optionvalue=$aviao>$aviao</option>";
        }
**********

So he isn't getting the data from DB. He displays all records on DB
available at aviao field, but he is not making the correct mysql query...

For debugging:
- please show us the query if you believe it is wrong (echo $query;).
- if you think something goes wrong at the mysql side, also do echo mysql_error(); after the mysql_query line, to get the mysql error.
- echo $num .
Also have a look at the html source to see whether it has the right options but another error than you expected.



$drop_down_list .= "<optionvalue=$aviao>$aviao</option>";
Put some quotes around the tag value for just in case the $aviao has a space in it:
$drop_down_list .= "<optionvalue=\"$aviao\">$aviao</option>";


FInally, why do you extract $sk when you do not use it?


Anyone knows why?

----- Original Message -----
From: "Ernest E Vogelsinger" <[EMAIL PROTECTED]>
To: "Miguel Brás" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, February 24, 2003 9:45 AM
Subject: Re: [PHP] What is wrong with this?


At 10:37 24.02.2003, Miguel Brás said: --------------------[snip]-------------------- >//logical request >if ($nome) { >$sql="aviao = '$nome' "; >} >if ($code) { >$sql="code = '$code' "; >} > $query = "SELECT * FROM ssr WHERE"; > $query .= $sql; --------------------[snip]--------------------

Hi,

I've copied only the relevant lines of your program.

The issue here is that your string concatenation results in
    SELECT * FROM ssr WHEREaviao = 'Airbus'

Note the missing space after "WHERE". Your code should better read
   $query = "SELECT * FROM ssr WHERE ";
   $query .= $sql;
Have an eye on the added blank after WHERE.

HTH,

--
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/



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


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



Reply via email to