RE: [PHP] What is wrong with this?

From: Date: Mon, 24 Feb 2003 15:25:03 +0000
Subject: RE: [PHP] What is wrong with this?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-136915@lists.php.net to get a copy of this message
hi, i think there is an error in the html part: $drop_down_list .= "<optionvalue=$aviao>$aviao</option>"; ^ should that not be?: $drop_down_list .= "<option value='$aviao'>$aviao</option>"; HTH t. > -----Message d'origine----- > De : Miguel Brás [mailto:molino26@netcabo.pt] > Envoyé : lundi 24 février 2003 11:04 > À : Ernest E Vogelsinger > Cc : php-general@lists.php.net > Objet : Re: [PHP] What is wrong with this? > > > 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/ > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#136915) next »