Welcome Guest ( Log In | Register )




                Web Hosting Guide

 
Reply to this topicNew Topic
Database
mattyk3001
post Sep 6 2008, 03:59 PM
Post #1


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 5
Joined: 6-September 08
Member No.: 32,472


<?php
$c = mysql_connect('localhost', 'root', 'p1kap1ka');
mysql_select_db('lite2', $c);
$mykey=256573440;
?>

In this code where shall I post my database name (and my database name should it contain my hosting name so before it there should be a165_game For example? or should it just be game?) and where shall I put the user password?
Go to the top of the page
 
+Quote Post
faulty.lee
post Sep 6 2008, 04:15 PM
Post #2


Super Member
Group Icon

Group: [HOSTED]
Posts: 500
Joined: 5-November 06
Member No.: 17,016
myCENTs:79.88


QUOTE(mattyk3001 @ Sep 6 2008, 11:59 PM) [snapback]128004[/snapback]
<?php
$c = mysql_connect('localhost', 'root', 'p1kap1ka');
mysql_select_db('lite2', $c);
$mykey=256573440;
?>

In this code where shall I post my database name (and my database name should it contain my hosting name so before it there should be a165_game For example? or should it just be game?) and where shall I put the user password?


According to MySQL manual

mysql_connect ( [string server [, string username [, string password [, bool new_link [, int client_flags]]]]] )

So clearly "root" in your code is the username and "p1kap1ka" is your password.

As for database name,

mysql_select_db ( string database_name [, resource link_identifier] )

So, it would be "lite2".

When you create your database in cpanel, you should have the database name generated for you. The lasttime I did, it appended my username along with it like you suggested. Anyway, you should check the generated name in cpanel instead of mere guessing.
Go to the top of the page
 
+Quote Post
mattyk3001
post Sep 6 2008, 04:23 PM
Post #3


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 5
Joined: 6-September 08
Member No.: 32,472


The name of the database that is given to me by mysql is a1663202_game should it be a1663202_game or just "game". And in the script should the database name be entered where the script says "lite2"?


EDIT:
So what you are saying is the database name should be written in localhost and the username and password in the other sections? or should it just be left as local host username password?

for example looking like this.

<?php
$c = mysql_connect('localhost', 'a1663202_user', 'PASSWORD');
mysql_select_db('a1663202_game', $c);
$mykey=256573440;
?>


This post has been edited by mattyk3001: Sep 6 2008, 04:34 PM
Go to the top of the page
 
+Quote Post
faulty.lee
post Sep 6 2008, 04:38 PM
Post #4


Super Member
Group Icon

Group: [HOSTED]
Posts: 500
Joined: 5-November 06
Member No.: 17,016
myCENTs:79.88


Yap
Go to the top of the page
 
+Quote Post
mattyk3001
post Sep 6 2008, 04:40 PM
Post #5


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 5
Joined: 6-September 08
Member No.: 32,472



Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'a1663202_user'@'localhost' (using password: YES) in /home/a1663202/public_html/mysql.php on line 2

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/a1663202/public_html/mysql.php on line 3

These are the two error messages i'm then getting when i am trying to access the game and sign up.
Go to the top of the page
 
+Quote Post
Darasen
post Sep 7 2008, 01:34 AM
Post #6


Premium Member
Group Icon

Group: [HOSTED]
Posts: 214
Joined: 3-April 08
From: Milling about
Member No.: 29,596
myCENTs:66.55


Using local host is assuming that the database is stored on the same physical server that is serving the PHP pages. This is not always the case.

Go to the top of the page
 
+Quote Post
faulty.lee
post Sep 7 2008, 04:03 AM
Post #7


Super Member
Group Icon

Group: [HOSTED]
Posts: 500
Joined: 5-November 06
Member No.: 17,016
myCENTs:79.88


QUOTE(mattyk3001 @ Sep 7 2008, 12:40 AM) [snapback]128008[/snapback]
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'a1663202_user'@'localhost' (using password: YES) in /home/a1663202/public_html/mysql.php on line 2

Access denied means your login or password is wrong. Check the database creation page for more information on this. Sometime, they also provide the connection string which you can refer to.

QUOTE(mattyk3001 @ Sep 7 2008, 12:40 AM) [snapback]128008[/snapback]
Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/a1663202/public_html/mysql.php on line 3

Since you can't connect to the server, you do not have a valid MySQL-Link resource that you can select your database with. You need to get pass line 2 before line 3 will execute properly.
Go to the top of the page
 
+Quote Post
yordan
post Sep 8 2008, 03:45 PM
Post #8


Way Out Of Control - You need a life :)
Group Icon

Group: [MODERATOR]
Posts: 3,106
Joined: 16-August 05
Member No.: 7,896
myCENTs:52.10


Probably your user name is also a1663202_game
Did you try connecting with PhpMyadmin in order to see what happens ?
Usually, when kind people create a database for you, they provide you with :
1) server name (usually localhost, but sometime it's something different)
2) database name
3) database username
4) database username password
Go to the top of the page
 
+Quote Post

Reply to this topicNew Topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts   3 Kian Mike 1,104 17th March 2010 - 07:41 PM
Last post by: iG-K. Adjei
No New Posts   5 Eggie 201 27th February 2010 - 01:51 PM
Last post by: 8ennett
No New Posts   10 glodrop 3,767 19th February 2010 - 06:29 AM
Last post by: iG-upeka
No New Posts   7 kenjvalip 2,749 13th February 2010 - 02:28 PM
Last post by: magiccode9
No New Posts   10 nakulgupta 2,917 12th February 2010 - 06:25 AM
Last post by: iG-Nancy Johnson
No New Posts 5 Niru 4,557 14th January 2010 - 06:43 AM
Last post by: iG-maryam
No New Posts   11 himanshurulez 5,071 29th December 2009 - 07:34 PM
Last post by: iG-
No New Posts 5 surfermac 488 14th December 2009 - 09:04 AM
Last post by: iG-Asif Ali
No New Posts   11 takerraj 553 12th December 2009 - 04:09 PM
Last post by: starscream
No new   19 lonebyrd 4,239 1st November 2009 - 03:49 PM
Last post by: iGuest
No New Posts   9 TavoxPeru 2,204 23rd October 2009 - 08:09 AM
Last post by: surfermac
No New Posts   12 ScriptDevil 825 23rd October 2009 - 07:55 AM
Last post by: surfermac
No New Posts   11 nightfox 2,255 23rd October 2009 - 07:52 AM
Last post by: surfermac
No New Posts   8 Vyoma 2,076 30th September 2009 - 07:48 AM
Last post by: starscream
No New Posts   6 ruben 1,769 27th August 2009 - 09:07 AM
Last post by: iG-J vincent


Web Hosting Powered by ComputingHost.com.
HONESTY ROCKS! truth rules.
Creative Commons License