Hi,
I have the following php script which connects successfully to mysql....and create table.
<?php
$link = mysql_connect('localhost', '1345', '12345');
if (!$link) {
die('Could not connect: ' . mysql_error());}
$sql = 'CREATE DATABASE shop';
if (mysql_query($sql, $link)) {
echo "Database shop created successfully\n";
} else {
echo 'Error creating database: ' . mysql_error() . "\n";
}
?>
What scripts can i add to this, instead of automatically creating a database pre-defined early but give user to input the database name and also drop it.
My point is to avoid the user from doing any editing or modification to the script. Just click and get!
For instance: once connected it says: input and get feedback.
> Please enter your database name: ...................
> Your database (any name) is created successfully !
> drop the database,
> specify the name
> Are you sure you want to delete the database name (Y/N) ?
Could you please help me to implement the scripts...or provide examples or links.
thanks for reading...!
I have the following php script which connects successfully to mysql....and create table.
<?php
$link = mysql_connect('localhost', '1345', '12345');
if (!$link) {
die('Could not connect: ' . mysql_error());}
$sql = 'CREATE DATABASE shop';
if (mysql_query($sql, $link)) {
echo "Database shop created successfully\n";
} else {
echo 'Error creating database: ' . mysql_error() . "\n";
}
?>
What scripts can i add to this, instead of automatically creating a database pre-defined early but give user to input the database name and also drop it.
My point is to avoid the user from doing any editing or modification to the script. Just click and get!
For instance: once connected it says: input and get feedback.
> Please enter your database name: ...................
> Your database (any name) is created successfully !
> drop the database,
> specify the name
> Are you sure you want to delete the database name (Y/N) ?
Could you please help me to implement the scripts...or provide examples or links.
thanks for reading...!