All pastes #277003 Raw Edit

Miscellany

public text v1 · immutable
·published 2006-12-12 21:01 UTC
rendered paste body
?
$db=mysql_connect("localhost","root","")
or die("cannot connect to the database");
if($db)
{
	echo"Successfully connected\n";
}
$result=mysql_db_query("hum","select * from bio")
or die("cannot execute query");
?>
<html>
<head><title> php is simple and can be used to connect to a db like this! </title></head>
<body bgcolor=#00ff0f>
<table border=1>
<tr>
<th>nick</th>
<th>fav no</th>
<th>company</th>
</tr>
<pre>
<?
while($array=mysql_fetch_row($result)):
?>
<tr>
<th><?echo $array[0];?></th>
<th><?echo $array[1];?></th>
<th><?echo $array[2];?></th>
</tr>
<?endwhile;?>
</pre>
</table>
</body>
</html>
<?
mysql_close($db);
?>