How can I display data in web after mysql_query() ??
| From: | crazyman | Date: | Sun, 03 Dec 2000 04:18:40 +0000 |
| Subject: | How can I display data in web after mysql_query() ?? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-28404@lists.php.net to get a copy of this message | ||
Hello, Iam new bie of PHP. I have write a little php that can connect mysql
server, write data in table,
(beast frist step ! :P), but i dunno how to display the data on the web
after query.. here is my code.
<?
mysql_connect("localhost", "root", "abc") or die("Unable to
connect DataBase
Server");
mysql_select_db("email_list") or die("Unable to connect the database");
$sql="select * from list where location='$choice' order by ename ASC";
$result= mysql_query($sql) or die("Unable to query result");
echo "<Table broder=\"1\">";
echo "<tr><TH>English Name</TH><TH>E-mail</TH>";
echo "<TH>Chinese
Name</TH><TH>Location</th><TH>UserID</TH></tr>";
while ($row =mysql_fetch_arrary($result)) {
$cname =$row["cname"];
$email =$row["email"];
$ename =$row["ename"];
$location=$row["location"];
$userid=$row["userid"];
echo
"<tr><TD>$cname</TD><TD>$email/TD><TD>$ename</TD>";
echo "<TD>$location</TD><TD>$userid</TD>";
}
and i got earr about this.....
Henry Chan from Hong Kong ^_^
echo "</table>";
mysql_free_result($result);
?>