Free Web Hosting Forum
(#1 (permalink))
Old
Member
Darryus is on a distinguished road
 
Posts: 32
Join Date: Aug 2011
Default MySQL problem again - 09-17-2011, 07:40 AM

hi what happen with MySQL ? i can't create table to my php myadmin?

the error said: Warning: mysql_query() [function.mysql-query]: Access denied for user 'a4334067'@'localhost' (using password: NO) in /home/a4334067/public_html/create_Table.php on line 14

my php script:

PHP Code:
<?php

include_once "teskonek.php";

print(
"Succesfully connect to server");



$result "CREATE TABLE my_Members(
id int(11) NOT NULL auto_increment,
firstname varchar(255) NOT NULL,
middlename varchar(255) NULL,
lastname varchar(255) NOT NULL)"
;

if(
mysql_query($result)){
    print 
"Success in table creation!";
}
else{
    print 
"no Table created";
}
exit();

?>

the connect server script below
PHP Code:
<?php
$server
="mysql5.000webhost.com";
$user "a4334067_tester";
$password "xxxxx"//my password hidden
$db_name "a4334067_test";

$id_mysqlmysql_connect($server$user$password);


mysql_select_db($db_name,$id_mysql);



//Akhir pembacaan data 
mysql_close($id_mysql);


?>

Last edited by Darryus; 09-17-2011 at 07:44 AM.
Reply With Quote
Sponsored Links
(#2 (permalink))
Old
Member
Passionless is on a distinguished road
 
Posts: 48
Join Date: Sep 2011
Default 09-17-2011, 07:58 AM

Hi,
If the connection script successfully connected with the DB may be the problem is that you close the connection at the end of the included script:
//Akhir pembacaan data
mysql_close($id_mysql);
I don't understand if you are trying to create tables with your own PHP scrips or with phpMyAdmin.
Reply With Quote
(#3 (permalink))
Old
Member
Darryus is on a distinguished road
 
Posts: 32
Join Date: Aug 2011
Default 09-17-2011, 08:13 AM

i am creating with my own php script, please help me, i have deleted the mysql closing connection function but still not work

PHP Code:
<?php
$server
="mysql5.000webhost.com";
$user "a4334067_tester";
$password "xxxxx";
$db_name "a4334067_test";

$id_mysqlmysql_connect($server$user$password);


mysql_select_db($db_name,$id_mysql);




?>

Last edited by Darryus; 09-17-2011 at 08:15 AM.
Reply With Quote
(#4 (permalink))
Old
Senior Member
grace1004 is on a distinguished road
 
Posts: 544
Join Date: Dec 2010
Default 09-17-2011, 08:32 AM

Were you able to enter into your phpmyadmin through control panel? If not, there's
something wrong with the server. Please check first if you can enter into your phpmyadmin
even if there's no table in your database.
Reply With Quote
(#5 (permalink))
Old
Senior Member
grace1004 is on a distinguished road
 
Posts: 544
Join Date: Dec 2010
Default 09-17-2011, 09:09 AM

When I tested your code at my site in free hosting, I got "no Table created" message, not
"Access denied ..." message like you. With--id int(11) NOT NULL auto_increment--there should
be--primary key (id), otherwise table will not be created. After running the following code,
I got "Success in table creation!" message. So, please try this code.

PHP Code:
<?php
//Database connection script

$query "CREATE TABLE my_Members(
id int(11) NOT NULL auto_increment,
firstname varchar(255) NOT NULL,
middlename varchar(255) NULL,
lastname varchar(255) NOT NULL,
primary key (id)
)"
;

$result mysql_query($query);

if(
$result){
    print 
"Success in table creation!";
}
else{
    print 
"no Table created";
}
exit();
?>
Reply With Quote
Reply

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.5.2
vBulletin Skin developed by: vBStyles.com