Re: can't output sql query with php code.

From: Date: Mon, 06 Feb 2006 07:59:44 +0000
Subject: Re: can't output sql query with php code.
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-229926@lists.php.net to get a copy of this message
Paul Goepfert wrote:
This is the full code for the code that doesn't work. <?php echo '<select name="month" >\n'; $month_query = mysql_query("SELECT m_id, months FROM Month"); while ($r = mysql_fetch_array($month_query)); { $v = $r["m_id"]; $out = $r["months"]; echo "<option value=$v>$out</option>\n"; } echo '</select>\n'; ?>
dear sir, overall, i can see no visible error. but u must debug the process. 1. please add print_r($r) within the while loop to see the contents. 2. check the num of rows returned by mysql_query. 3. check it mysql_query is not returning an error. -- Sumeet Shroff http://www.prateeksha.com Web Design and Ecommerce Development, Mumbai India

« previous php.general (#229926) next »