php and MySQL problems

galacnet

Verified User
Joined
Jan 17, 2006
Messages
25
Hello,

I am experiencing some problems with a script I programmed on a DirectAdmin system. Script has been running ok on the older Cobalr RaQ4, RaQ550 and also BlueQuartz servers.

I noticed that mysql_create_db() and mysql_createdb() returns an error so I used mysql_query() instead but still, I get stuck....

Part of the script
$db = mysql_connect("$dbhost", "$dbusername", "$dbpassword") or die("Could not connect.");
$createdatabase = 'CREATE DATABASE '.$fullname;

if (mysql_query($createdatabase,$db))
{ print "Database Creation <font color=#00FF00>SUCCESSFUL</font><br>"; }
else
{ die("Could not create database - $fullname"); }

Where the DB values are preset in a config file and also $fullname are determined by a form entry.

It will continue to return Could not create database - $fullname where $fulname is displayed properly as whats defined in the form.

I played around with it and the Databases either don't get created or gets created as "$fullname" and not whats defined in the form....

When I port the script back to my Cobalt or BlueQuartz servers it continue to run properly....

Is there something or some modules I need to install or missed out?

Thank you for any advice.
 
check the permission of the user that u r using to connect to mysql. Usually the user created by directadmin only has the permission to specific DB(s) only and doesn't have the rights to create databases. U might need to login as admin and to go mysql table and check the users table.
 
Permissions are ok as it creates a database called $fullname instead of what I specify $fullname as.... But when I try to print $fullname it comes out as what I specified....

I used both the da_admin user and also a user I created with phpmyadmin with full permissions.
 
Back
Top