forms/variables/create database
| From: | bigmark | Date: | Mon, 11 Oct 2004 02:23:33 +0000 |
| Subject: | forms/variables/create database | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-199135@lists.php.net to get a copy of this message | ||
hi, does anyone know why this is not working, i have married 2 pieces of
code together and i have no idea what im doing--any help is appreciated.
I get an error that says it cant find the host--$host so obviusly its not
passing it from the form.
/////////////////////////////////////////
<?php
$host = $_POST['host'];
$user = $_POST['user'];
$pass = $_POST['pass'];
$db_name = $_POST['db-name'];
$link = mysql_connect('$host', '$user', '$pass');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
if (mysql_create_db('db_name')) {
echo "Database created successfully\n";
} else {
echo 'Error creating database: ' . mysql_error() . "\n";
}
?>
/////////////////////////////////////////////