Current location: Hot Scripts Forums » Programming Languages » PHP » Create Database : Not working


Create Database : Not working

Reply
  #1 (permalink)  
Old 10-22-04, 01:56 AM
Romeo Romeo is offline
Newbie Coder
 
Join Date: Oct 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Create Database : Not working

This code is perfectly working in local host! but when i try this in web server, its not working! Connection Established! By Database Creation Failed!
I tried this in www.t35.com - Free web space with mysql support!
Help please



<html>
<head>
<title>Create Data Base</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?Php
echo ("Attempt To Create and Dump New Database FANew");
/*-----------------------------------------------*\
| Opening Connection |
\*-----------------------------------------------*/
$con_str = @mysql_connect();
if (!$con_str)
echo ("connection failed") ;
else
echo ("Connection Made successfully!") ;


/*-----------------------------------------------*\
| Checking for the Existance of Dbs of same name |
\*-----------------------------------------------*/

$database["sql"] = "DROP DATABASE IF EXISTS `fanew`";
if ( mysql_query($database["sql"]) ,$con_str )
echo ("<br> Checked and Cleared Existing Database of the same name") ;
else
echo ("<br>Attempt to check dabase of same name failed") ;

/*-----------------------------------------------*\
| Creating database FaNew |
\*-----------------------------------------------*/

$database["database"] = "fanew";
if ( mysql_create_db($database["database"]) ,$con_str )
echo ("<br>database created successfully");
else
echo ("<br>Attempt to create new database failed <br>" );
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 10-23-04, 01:50 PM
UnitedScripters UnitedScripters is offline
Newbie Coder
 
Join Date: Oct 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
on the local machine the proxy that you log (meaning by proxy the setting username/password/host) is arguably endowed with full administrative privileges: select, insert, update, create, drop etc.

But when you load online, the script runs no longer on your beloved pc of which you are the owner, but on someone's else machin e whose owner is somebody else. This ownwer has not enabled that account proxy setting username/passowrd/host with the privilege of dropping/creating databases.

U can contact the site administrator but it is nearly sure he/she will never allow you to delete whole databases: security reasons would strongly advice against giving this type of privilege.
Also creating though less dangerous is sth site administrator do not like granting.

This seems the only viable explanation, at least to me
ciao
__________________
ciao
Alberto
http://www.unitedscripters.com/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 10-27-04, 12:04 AM
Romeo Romeo is offline
Newbie Coder
 
Join Date: Oct 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Please

Quote:
Originally Posted by UnitedScripters
on the local machine the proxy that you log (meaning by proxy the setting username/password/host) is arguably endowed with full administrative privileges: select, insert, update, create, drop etc.

But when you load online, the script runs no longer on your beloved pc of which you are the owner, but on someone's else machin e whose owner is somebody else. This ownwer has not enabled that account proxy setting username/passowrd/host with the privilege of dropping/creating databases.

U can contact the site administrator but it is nearly sure he/she will never allow you to delete whole databases: security reasons would strongly advice against giving this type of privilege.
Also creating though less dangerous is sth site administrator do not like granting.

This seems the only viable explanation, at least to me
ciao

Alberto,

I have posted an thread on MySQL Problem
http://www.programmingtalk.com/showthread.php?t=13726

Could you help me to find out what shold be the User aname and Password of that sever

Actually i am studying PHP in a free host server who provide MySQL access.

site is www.t35.com
user name : aiby.t35.com
pass word : mamma

Attempt to creat database is in page http://aiby.t35.com/db_tb.php

if you get time.. please try to solve the issue..
my mail id is aiby@ hotmail.com / aibydas@ yahoo.co.in

Thank you.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 10-27-04, 12:26 AM
ThePatronus HP ThePatronus HP is offline
Newbie Coder
 
Join Date: Apr 2004
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Romeo,

The reason your code is not working from a website is because, from outside of your Administrative login where you can edit your site and MySQL databases, nobody has the permission to create and delete databases. You cannot use PHP code to create or delete whole databases because you are not granted this type of permission without being logged into the actual Administrative panel. The only thing you can create and delete would be tables of a database.

Unless you own your own server, and you make the rules, this will never change, as most hosting providers do not allow this type of permission. You usually have to login to your Admin panel and create and delete databases that way.

I'm afraid you're out of luck.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 10-27-04, 09:07 PM
Romeo Romeo is offline
Newbie Coder
 
Join Date: Oct 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Thank you ThePatronus HP !
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
create a database with myphpadmin jack42 PHP 4 10-13-04 11:37 PM
Update database table not working livemotion PHP 2 05-06-04 06:45 PM
Declared Functions skipper23 PHP 4 12-17-03 11:06 AM
index page not showing up skipper23 PHP 3 12-15-03 02:10 PM


All times are GMT -5. The time now is 01:08 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.