php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16903 CREATE DATABASE - No Database Selected
Submitted: 2002-04-29 09:44 UTC Modified: 2002-07-01 14:18 UTC
From: hz11 at nyu dot edu Assigned: zak (profile)
Status: Closed Package: MySQL related
PHP Version: 4.1.2 OS: FreeBSD 4.5
Private report: No CVE-ID: None
 [2002-04-29 09:44 UTC] hz11 at nyu dot edu
I've found what looks to be a wierd little problem.  When executing something like:

mysql_query('CREATE DATABASE mynewdb', $mysql_link);

I get the error 'No database Selected'.  In the mysql client (local, CLI) this of course works as it should.  I've looked at mysql_create_db() in the manual, but it says it's deprecated and that a 'CREATE DATABASE' query should be executed using mysql_query().  There's something wrong here.

On a sidenote, I'm curious if there is any way (or plans to allow) multiple queries per mysql_query() run?  For instance:

mysql_query('CREATE DATABASE mynewdb; CREATE TABLE newtable (id TINYINT NOT NULL);', $mysql_link);

Currently,  I would get a SQL syntax error at the first semicolon.  Is there a way to do this?  Or is there plans to add it in the future?

Thank you,

Hans

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-27 07:59 UTC] zak@php.net
Hi Hans, 
 
I cannot reproduce the problem under PHP-4.3.0 Dev   
  
Please try upgrading to the latest version of  
PHP. If the problem still exists, please also  
provide details on the version of MySQL that you  
are trying to access. 
 
Regarding your question, please submit a bug 
report with a category of Feature Request! 
 
Thanks! 
 [2002-06-27 08:15 UTC] alan_k@php.net
may also be worth noting whether you are using the mysql bundled code or the shared library
./configure --with-mysql=/usr/local or just ./configure ?
 [2002-07-01 14:18 UTC] hz11 at nyu dot edu
I have since upgraded to 4.2.1 and the problem has dissapated.  Just as a note, I always use the MySQL client libs.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 20 23:01:31 2024 UTC