Steve Leader
05-01-2005, 11:27 PM
This routine is supposed to list all presentr databases and give you the oipertunity to start a new one.
Mysql, php and Apache all installed ok. Asume that user=steve and password=leader and routine is being saved to apache's htdoc dir. Here's the code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<?php
$conn=@mysql_connect("localhost","steve","leader")
or die ("Sorry no connection to MySQL".mysql_error( ));
$rs1=@mysql_create_db($db);
$rs2=@mysql_list_dbs($conn);
for ($row=0; $row <mysql_num_rows($rs2); $row++)
{$list .= mysql_tablename($rs2, $row)." | ";}
?>
<html>
<head><title>Create Database Using PHP</title></head>
<body>
<form action="<?php echo($PHP_SELF); ?>" method="post">Current Databases:
<?php echo ($list); ?><hr> Name: <input type="text" name="db"><input type="submit" value="Create database">
</form>
</body>
</html>
Mysql, php and Apache all installed ok. Asume that user=steve and password=leader and routine is being saved to apache's htdoc dir. Here's the code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<?php
$conn=@mysql_connect("localhost","steve","leader")
or die ("Sorry no connection to MySQL".mysql_error( ));
$rs1=@mysql_create_db($db);
$rs2=@mysql_list_dbs($conn);
for ($row=0; $row <mysql_num_rows($rs2); $row++)
{$list .= mysql_tablename($rs2, $row)." | ";}
?>
<html>
<head><title>Create Database Using PHP</title></head>
<body>
<form action="<?php echo($PHP_SELF); ?>" method="post">Current Databases:
<?php echo ($list); ?><hr> Name: <input type="text" name="db"><input type="submit" value="Create database">
</form>
</body>
</html>