mysql return
Posted: Wed Mar 29, 2006 8:52 pm
for a script I am making, I am unable to echo. is there any possible way to rewrite the following code without echo or print and still maintain the same functionality?
Code: Select all
<?php
mysql_connect("localhost", "user","pass") or die(mysql_error());
mysql_select_db("main") or die(mysql_error());
$query="SELECT * FROM chat";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
$i=0;
while ($i < $num) {
$postby=mysql_result($result,$i,"postby");
$msg=mysql_result($result,$i,"msg");
$date=mysql_result($result,$i,"date");
$ip=mysql_result($result,$i,"ip");
$time=mysql_result($time,$i,"time");
echo "$postby ";
$i++;
}
?>