I am trying to display three columns from my table using this code. My columns emailid sometimes is blank so the code is screwing up. I am able to connect to the DB and am able to pull the record set, the part which I am missing is when I try to display. The display does not occur properly.
Any thoughts??
This is my code.
<?
$username="hello";
$password="";
$database="hello";
mysql_connect('localhost','hello','');
@mysql_select_db('hello') or die( "Unable to select database");
$query="SELECT emailid, mirs_aspects, mirs_likeleast FROM mirs_survey1";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
echo "<b><center>Comments so far made from all the response - Only for John</center></b><br><br>";
$i=1;
//$result=0;
$emailid=mysql_result($result,$i,"emailid");
$mirs_aspects=mysql_result($result,$i,"mirs_aspects");
$mirs_likeleast=mysql_result($result,$i,"mirs_likeleast");
echo "<table border=1>\n";
echo "<tr><td>emailid</td><td>mirs_aspects</td><td>mirs_likeleast</td></tr>\n";
while ($myrow = mysql_fetch_row($result)) {
printf("<tr><td>%s </td><td>%s</td><td>%s </td></tr>\n",$myrow[1], $myrow[2], $myrow[3]);
}
echo "</table>\n";
?>