RE: [PHP] can't output sql query with php code.

From: Date: Mon, 06 Feb 2006 07:10:02 +0000
Subject: RE: [PHP] can't output sql query with php code.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-229919@lists.php.net to get a copy of this message
> Doesn't work > ------------------------------------------------- > <?php > $month_query = mysql_query("SELECT m_id, months FROM Month"); > while ($row = mysql_fetch_array($month_query)) > { > $val = $row["m_id"]; > $out = $row["months"]; > echo "<option value=$val>$out</option>"; > } > ?> You're missing the <select> tags. > while ($r = mysql_fetch_array($Equip_query)) > { > $val = $r["equip"]; > echo "<option value=$val>$val</option>\n"; > } On a seperate note, if all you are doing with the $val variable is using it to echo, it's not needed. Put brackets { } around the var to echo ie: {$r["equip]} - makes it easier to read later when you come back to tweak your code. Brady

« previous php.general (#229919) next »