473,573 Members | 3,223 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

can't create databases

In the code below, the mysql_connect commands work correctly (though
I've changed the passwords here). I get the "We were able to
establish a connection" message. But then the code hangs and does
nothing. What am I doing wrong? The username and password are root, so
I should have the right permissions. The same username and password,
when I put them into phpMyAdmin, allow me to create databases without
a trouble.




$link = mysql_connect(' localhost', 'u345', '2134');
if ($link) {
echo "<p>We were able to establish a connection to the
database.</p>";
} else {
die('Could not connect: ' . mysql_error());
}
$result = mysql_create_db ($website);
if ($results) {
echo "The database '$website' was created.";
} else {
die("There was a problem. We were not able to create the database.
It is possisble that a database of the same name already existed, or
perhaps someone recently changed the configuration of the database
server. YOu might want to contact whoever is in charge of the database
and ask them what is up :". mysql_error());
}
Jul 17 '05 #1
3 1610
On 30 Jul 2004 05:47:54 -0700, lk******@geocit ies.com (lawrence)
wrote:
In the code below, the mysql_connect commands work correctly (though
I've changed the passwords here). I get the "We were able to
establish a connection" message. But then the code hangs and does
nothing. What am I doing wrong? The username and password are root, so
I should have the right permissions. The same username and password,
when I put them into phpMyAdmin, allow me to create databases without
a trouble. $result = mysql_create_db ($website);
if ($results) {
echo "The database '$website' was created.";


You have two variables: $result and $results. Typo?

Where does $website come from? Recent versions of PHP have
register_global s disabled by default, so you could try using either
$_POST["website"] or $_GET["website"] as appropriate. Echo $website to
check it isn't empty.

--
David ( @priz.co.uk )
Jul 17 '05 #2
lawrence wrote:
In the code below, the mysql_connect commands work correctly (though
I've changed the passwords here). I get the "We were able to
establish a connection" message. But then the code hangs and does
nothing. What am I doing wrong? The username and password are root, so
I should have the right permissions. The same username and password,
when I put them into phpMyAdmin, allow me to create databases without
a trouble.




$link = mysql_connect(' localhost', 'u345', '2134');
if ($link) {
echo "<p>We were able to establish a connection to the
database.</p>";
} else {
die('Could not connect: ' . mysql_error());
}
$result = mysql_create_db ($website);
if ($results) {
echo "The database '$website' was created.";
} else {
die("There was a problem. We were not able to create the database.
It is possisble that a database of the same name already existed, or
perhaps someone recently changed the configuration of the database
server. YOu might want to contact whoever is in charge of the database
and ask them what is up :". mysql_error());
}


apparently your mysqld daemon is not running. Which OS? Register_global s is
another issue, but this one says the mysql server is not running.
--
Michael Austin.
Consultant - Available.
Donations welcomed. Http://www.firstdbasource.com/donations.html
:)
Jul 17 '05 #3
David Mackenzie <me@privacy.net > wrote in message news:<2d******* *************** **********@4ax. com>...
On 30 Jul 2004 05:47:54 -0700, lk******@geocit ies.com (lawrence)
wrote:
In the code below, the mysql_connect commands work correctly (though
I've changed the passwords here). I get the "We were able to
establish a connection" message. But then the code hangs and does
nothing. What am I doing wrong? The username and password are root, so
I should have the right permissions. The same username and password,
when I put them into phpMyAdmin, allow me to create databases without
a trouble.

$result = mysql_create_db ($website);
if ($results) {
echo "The database '$website' was created.";


You have two variables: $result and $results. Typo?

Where does $website come from? Recent versions of PHP have
register_global s disabled by default, so you could try using either
$_POST["website"] or $_GET["website"] as appropriate. Echo $website to
check it isn't empty.


Sorry that I left so much out. $website is submitted from a form. The
database is given the same name as the site. We working with PHP
4.0.6, so register_global s is still on by default.
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1906
by: Fred Johnson | last post by:
Hi folks: I need to give a special user admin rights to the databases he creates. As there is no dedicated MySQL database server for his needs yet, we created a special user on a multi-purpose MySQL server; this special user has the rights to do everything only on databases he creates. To distinguish his databases among others, we...
0
1224
by: DFS | last post by:
It installed as a service, and seemed to start just fine, but on the 'databases' tab of the WinMySQLAdmin ver 1.4, I can't create databases. It shows 'test' but no tables. Right clicking gives me a menu with 4 flush choices Contents of C:\Windows\my.ini follows: #This File was made using the WinMySQLAdmin 1.4 Tool #8/5/2004 12:48:19...
0
504
by: Andrew Crook | last post by:
how can I limit the number of databases a user can create? I wish to create an account in mysql for each site on my host computer and set the max number of databases each site can create. can this be done? AndiC
0
2427
by: Mark Huebner | last post by:
I have Visual Studio 2003 Professional and MS SQL Server 2000 installed on my laptop. For some reason, I can't create a new database with the Visual Studio Server Explorer. The error message is "Cannot create databases on this server". I made sure I started up my instance of SQL Server called T30-THINKPAD so it is running. However, I can...
10
3235
by: Rada Chirkova | last post by:
Hi, at NC State University, my students and I are working on a project called "self-organizing databases," please see description below. I would like to use an open-source database system for implementation and would really appreciate your opinion on whether PostgreSQL is suitable for the project. In general, I am very impressed by the...
2
2241
by: Chris | last post by:
I think I already know that the answer is that this can't be done, but I'll ask anyways. Suppose you want to use an RDBMS to store messages for a threaded message forum like usenet and then display the messages. A toy table definition (that I've tried to make standards compliant) might look like: create table messages ( message_id...
46
5964
by: Steve | last post by:
Access97 Database The database is split into a frontend and backend and not connected to any other database. The database has an unbound report with 15 subreports. Some of the subreports include Excel charts in unbound object frames. When I add 3 additional subreports, I get the error message that Access can't open any more databases. Can...
2
2053
by: mivey4 | last post by:
Hi. I am having a problem trying to find the proper way to assign a system object (or rather in this case a system object name) to a variable to use in my T-SQL code. I have to run a report across 20 or more databases and need to create a loop to run the same report execution on every database. This is a snippet of the code I am trying...
2
1174
by: Sudantha | last post by:
Hi, I need to get some selected columns of two tables in TWO DATABASES , AND get those data to an excel file. Think the best way is to create a DTS. But dont know how to create it for this situation (having two databases) . Please help me to solve this problem. Thanks
1
1625
by: praom2104 | last post by:
i m newbie to linux......wen ever i create database it returns an error as "mysql> create databases new; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'databases new' at line 1" i dunno wats problem.....i get this even if i try this...
0
7687
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8201
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7777
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6413
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5585
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5290
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3731
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3731
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1300
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.