473,407 Members | 2,326 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

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 1601
On 30 Jul 2004 05:47:54 -0700, lk******@geocities.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_globals 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_globals 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******@geocities.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_globals 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_globals 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
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...
0
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...
0
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...
0
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...
10
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...
2
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...
46
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...
2
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...
2
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...
1
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.