Re: What is wrong with this?

From: Date: Mon, 24 Feb 2003 10:04:03 +0000
Subject: Re: What is wrong with this?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-136871@lists.php.net to get a copy of this message
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... Anyone knows why? ----- Original Message ----- From: "Ernest E Vogelsinger" <ernest@vogelsinger.at> To: "Miguel Brás" <molino26@netcabo.pt> Cc: <php-general@lists.php.net> 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/

« previous php.general (#136871) next »