Link to home
Start Free TrialLog in
Avatar of Simon336697
Simon336697Flag for Australia

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';
?>
=============================================
SOLUTION
Avatar of gamebits
gamebits
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Simon336697

ASKER

Thanks so much guys to both of you for your really fast and great responses!
Appreciate it, just tried out both, and both work.
Thanku :>)