using php within a div tag
Posted: Tue Mar 30, 2010 3:11 pm
Hi I am trying to fetch values from the database and place it in the listbox within a div using php. This is what I am trying.
But the php code doesnt seem to be functioning. The div is displaying the following
Someone please tell me what I am doing wrong!!!
Thanks!
Code: Select all
<DIV>
<P>Cancer Data</P>
<UL id="Cancer Data">
<?php
$link = connectToDB(); // this is a funciton to connect to DB
$strQuery = "select * from cancertype";
$result = mysql_query($strQuery) or die(mysql_error());
if ($result) {
while($rs1= mysql_fetch_array($result)) {
$value = $rs1['cancername'];
echo("<LI id= ".$value."> ".$value."</LI> ");
}
}
mysql_close($link);
?>
</UL>
</DIV>Code: Select all
.$value.""); } }
mysql_close($link);
?>
Thanks!