Loading...


bookmark - Database

Database

 
 Discussion by mattyk3001 with 7 Replies.
 Last Update: September 8, 2008, 3:45 pm
 
bookmark - Database  
Quickly Post to Database  w/o signup Share Info about Database  using Facebook, Twitter etc. email your friend about Database Print
Reply / Comment New Discussion / Topic Share / Bookmark E-Mail a Friend Print

<?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?








   Sat Sep 6, 2008    Reply         

QUOTE (mattyk3001)

<?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?
Link: view Post: 128004


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.

   Sat Sep 6, 2008    Reply         

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;
?>

   Sat Sep 6, 2008    Reply         


Yap

   Sat Sep 6, 2008    Reply         

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.

   Sat Sep 6, 2008    Reply         

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.

   Sun Sep 7, 2008    Reply         


QUOTE (mattyk3001)

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
Link: view Post: 128008

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)

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

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.

   Sun Sep 7, 2008    Reply         

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

   Mon Sep 8, 2008    Reply         

Quickly Post to Database  w/o signup Share Info about Database  using Facebook, Twitter etc. email your friend about Database Print
Reply / Comment New Discussion / Topic Share / Bookmark E-Mail a Friend Print

Similar Topics:

Database Setups Errors Settings...

A SMALL INTRODUCTION TO DATABASE ============================= I have seen that many members have problems with Database. Here is a small INFO which should give you the IDEA. mySQL is a DATABASE server. You can access it using the [MySQL Database] ...more

   05-Feb-2005    Reply         

XML Database

Hi all, Am in need of XML Database. The requirments are as follows, QUOTE<xml>       <fname>SomeName</fname>       <lname>OtherName</lname> </xml> ...more

   22-Mar-2005    Reply         

What Is A Database How Do I Use One...

Hello All Let's start off by talking about what a database is and how it would be efficient in using it. It wasn't until about a year and half ago now that I was first introduced to this new age of Database. I discovered a lot of neat things and even learned about databases ...more

   26-Jun-2006    Reply         

Browser Based Text Games    Browser Based Text Games (2) (0) Mccodes, What Else?   Mccodes, What Else?