Simon336697
asked on
Displaying output of success or failure of creating a database
Hi guys!
Im a total newbie to PHP so please bare with me.
I have the following php script (create.php) that creates a database called test001 in mysql.
When I launch this in a web browser:
http://localhost/create.php
I dont get anything on the page, just blank, but if I go into mysql, the new database has been created.
What Id like to learn how to do, is to put in:
An if statement to test success and failure of creating the database, and display this on the web page.
Any help greatly appreciated. Here is my script:
========================== ==
<?php
include 'config.php';
include 'opendb.php';
$query = "CREATE DATABASE test001";
$result = mysql_query($query);
include 'closedb.php';
?>
========================== ========== =========
Im a total newbie to PHP so please bare with me.
I have the following php script (create.php) that creates a database called test001 in mysql.
When I launch this in a web browser:
http://localhost/create.php
I dont get anything on the page, just blank, but if I go into mysql, the new database has been created.
What Id like to learn how to do, is to put in:
An if statement to test success and failure of creating the database, and display this on the web page.
Any help greatly appreciated. Here is my script:
==========================
<?php
include 'config.php';
include 'opendb.php';
$query = "CREATE DATABASE test001";
$result = mysql_query($query);
include 'closedb.php';
?>
==========================
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Appreciate it, just tried out both, and both work.
Thanku :>)