Problem In Creating A Database Using Php, Unable to Create a database using PHP |
||
Welcome to the Zymic webmaster forums. Our forums are here to provide people the free ability to discuss a range of websites related topics such as design, development coding and marketing.
In order to post you will need to register for a zymic account or if you already have one simply login by using the form on the left.
Zymic Webmaster Forums Zymic Free Web Hosting Databases & MySQL |
||
![]() |
Problem In Creating A Database Using Php, Unable to Create a database using PHP |
||
May 25 2009, 10:22 PM
Post
#1
|
|
|
Newbie ![]() Group: Members Posts: 2 Joined: 21-May 09 Member No.: 96,070 |
Hi Everyone,
I have a problem to create a database using PHP in my website in Zymic, though I have no problem to do so in my own computer which has the Apache, PHP and MYSQL installed. But in my mechine, I need to use "root" to replace "myusername" to make this work. After I uploaded my codes with some modifications of my username and my password, the code did not work. I have no problem in creating databases using my database management panel of this website. I am just curious about whether I can use PHP codes to create databases. I am just wondering whether I have the privilege to create database using PHP. The following is the codes I used. Could anybody give some help on this? php $mysqli = new mysqli("localhost", "myusername_myusername", "mypassword"); if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } else { echo " First, connected!!!"; } $sql0 = "CREATE DATABASE myusername_ttt99"; $res = mysqli_query($mysqli, $sql0); if($res){ echo " SUCCESS!!!!!!!"; } mysqli_close($mysqli) ?> Thank you very much. Your kind help is highly appreciated! |
|
|
May 25 2009, 11:14 PM
Post
#2
|
|
|
Outrageously Uber Ninja ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Moderators Posts: 1,740 Joined: 10-July 08 From: UK Member No.: 44,994 |
I'm afraid you don't have the permissions to create db's/users - you can only use the db management we give you.
swordz |
|
|
May 25 2009, 11:24 PM
Post
#3
|
|
|
Newbie ![]() Group: Members Posts: 2 Joined: 21-May 09 Member No.: 96,070 |
|
|
|
![]() |
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users) |
||
| 0 Members: | ||
Forum Jump |
||
| Lo-Fi Version | Time is now: 21st November 2009 - 01:03 PM |