Greetings all,
First off, I am new here. This seems like a tremendous resource to the PHP community and I hope to be able to contribute something to it.
However, being new to PHP and MySQL on the coding side, I have already run into a snag.
I am trying to create a database with PHP using the following code:
<?
$sql = "CREATE DATABASE obms";
$connection = @mysql_connect("localhost","name","pword") or die(mysql_error());
$result = @($sql,$connection) or die(mysql_error());
if ($result) {
$msg ="<P>Database has been created!</P>";
}
?>
<HTML>
<HEAD>
<TITLE>Create a MySQL Database</TITLE>
</HEAD>
<BODY>
<? echo "$msg"; ?>
</BODY>
</HTML>
I what I am getting is not an error but rather, it is telling me that the database was created but when I go to look and see if it actually was, it isn't there. So, I am getting a false message.
I am using Mandriva Linux free version(2006 I think) and have apache, PHP4, MySQL all installed and playing well together. I also have given my user account permission to do anything at all on the box.
So, what am I doing wrong? I suspect it is either in the code or in the permissions but I don't know enough to know what to look for.
Ogier