|
|
|
| Web Hosting Guide |
![]() ![]() |
Database |
Sep 6 2008, 03:59 PM
Post
#1
|
|
|
Newbie [ Level 1 ] 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? |
|
|
|
Sep 6 2008, 04:15 PM
Post
#2
|
|
|
Super Member 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. |
|
|
|
Sep 6 2008, 04:23 PM
Post
#3
|
|
|
Newbie [ Level 1 ] 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 |
|
|
|
Sep 6 2008, 04:38 PM
Post
#4
|
|
|
Super Member Group: [HOSTED] Posts: 500 Joined: 5-November 06 Member No.: 17,016 myCENTs:79.88 |
Yap
|
|
|
|
Sep 6 2008, 04:40 PM
Post
#5
|
|
|
Newbie [ Level 1 ] 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. |
|
|
|
Sep 7 2008, 01:34 AM
Post
#6
|
|
|
Premium Member 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.
|
|
|
|
Sep 7 2008, 04:03 AM
Post
#7
|
|
|
Super Member 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. |
|
|
|
Sep 8 2008, 03:45 PM
Post
#8
|
|
|
Way Out Of Control - You need a life :) 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 |
|
|
|
![]() ![]() |
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
Similar Topics
| Topic Title | Replies | Topic Starter | Views | Last Action | |||
|---|---|---|---|---|---|---|---|
![]() |
3 | Kian Mike | 1,104 | 17th March 2010 - 07:41 PM Last post by: iG-K. Adjei |
|||
![]() |
5 | Eggie | 201 | 27th February 2010 - 01:51 PM Last post by: 8ennett |
|||
![]() |
10 | glodrop | 3,767 | 19th February 2010 - 06:29 AM Last post by: iG-upeka |
|||
![]() |
7 | kenjvalip | 2,749 | 13th February 2010 - 02:28 PM Last post by: magiccode9 |
|||
![]() |
10 | nakulgupta | 2,917 | 12th February 2010 - 06:25 AM Last post by: iG-Nancy Johnson |
|||
![]() |
5 | Niru | 4,557 | 14th January 2010 - 06:43 AM Last post by: iG-maryam |
|||
![]() |
11 | himanshurulez | 5,071 | 29th December 2009 - 07:34 PM Last post by: iG- |
|||
![]() |
5 | surfermac | 488 | 14th December 2009 - 09:04 AM Last post by: iG-Asif Ali |
|||
![]() |
11 | takerraj | 553 | 12th December 2009 - 04:09 PM Last post by: starscream |
|||
![]() |
19 | lonebyrd | 4,239 | 1st November 2009 - 03:49 PM Last post by: iGuest |
|||
![]() |
9 | TavoxPeru | 2,204 | 23rd October 2009 - 08:09 AM Last post by: surfermac |
|||
![]() |
12 | ScriptDevil | 825 | 23rd October 2009 - 07:55 AM Last post by: surfermac |
|||
![]() |
11 | nightfox | 2,255 | 23rd October 2009 - 07:52 AM Last post by: surfermac |
|||
![]() |
8 | Vyoma | 2,076 | 30th September 2009 - 07:48 AM Last post by: starscream |
|||
![]() |
6 | ruben | 1,769 | 27th August 2009 - 09:07 AM Last post by: iG-J vincent |
|||
|
Lo-Fi Version | Time is now: 20th March 2010 - 11:19 PM |
© 2010 AstaHost: Free Web Hosting & Technical Discussion, Free Web Hosting. a member of xisto.
Powered by Invision Board. Skin: IPB Forum Skins
Expand / Collapse Navigation



Sep 6 2008, 03:59 PM






