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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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';
?>

On 2/6/06, Brady Mitchell <bradym@xxxxxxxxxxx> wrote:
> > 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
>
>
>
>
>
>

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux