Gossamer Forum
Home : General : Databases and SQL :

php & mysql

Quote Reply
php & mysql
When I use php code
mysql_create_db ('dbCompany');
return true, i.e. I was successful.
But After that, I type SHOW DATABASES; in the mysql command line, this created table does not realy exist

I have mysql and php installed in Mandrake Linux.
I may create database in the command line using root as user.
Quote Reply
Re: [jinwu] php & mysql In reply to
Are you returning the error after attempting to create this?

Code:
$error = mysql_error();
if ($error) { echo "SQL Error: $error"; exit; }

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] php & mysql In reply to
Won't php let you do this...

Code:
if (my $error = mysql_error()) {
echo "Error: $error";
return;
}
Quote Reply
Re: [Paul] php & mysql In reply to
Not really. Firstly I'm not sure you can declare a variable within an 'if' statement (most likely can, I just havn't done it before), and also, why do a return? An exit; is better because it stops the script dead, so the user doesn't see any more errors (only real problem is that the mysql_close() command is not run).

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] php & mysql In reply to
BTW: Wouldn't this thread be better in the Internet Technologies forum, as its more related to PHP that MySQL Unsure

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates