|
|
|
|
![]() ![]() |
May 25 2007, 11:46 AM
Post
#1
|
|
|
Member [Level 1] ![]() ![]() ![]() ![]() Group: Members Posts: 73 Joined: 18-May 07 Member No.: 43,278 |
I created a table in phpmyadmin, i copied the code in a file and uploaded this file onto the host. Now it says that it cannot connect to the database. The error lies within "mysql_select_db($db)" => so i think this means that it cant find the database? If anyone knows how to let my login and register forms connect to the database, please help me. I used a login system from this site, ill post the link later.
|
|
|
|
May 25 2007, 11:50 AM
Post
#2
|
|
|
A computer once beat me at chess, but it was no match for me at kick boxing. ![]() Group: [MODERATOR] Posts: 3,882 Joined: 24-July 05 From: In Trouble Again... still? Member No.: 9,787 ![]() |
Got any code for us to look at?
|
|
|
|
May 25 2007, 12:23 PM
Post
#3
|
|
|
Member [Level 1] ![]() ![]() ![]() ![]() Group: Members Posts: 73 Joined: 18-May 07 Member No.: 43,278 |
Here is the exact code i used (from the tutorial):
http://www.trap17.com/forums/complete-logi...stem-t7247.html |
|
|
|
May 25 2007, 12:24 PM
Post
#4
|
|
|
apt-get moo ![]() Group: [MODERATOR] Posts: 2,056 Joined: 28-May 05 From: Hertfordshire, England Member No.: 7,593 ![]() |
Without seeing the code this is pretty hard to diagnose; it could be any one of hundreds of problems. However, check the basics: are your username and password correct? Is the database name correct? Is the server name correct?
|
|
|
|
May 25 2007, 12:52 PM
Post
#5
|
|
|
A computer once beat me at chess, but it was no match for me at kick boxing. ![]() Group: [MODERATOR] Posts: 3,882 Joined: 24-July 05 From: In Trouble Again... still? Member No.: 9,787 ![]() |
That's not what I meant.
We need to see the "ACTUAL" code you are using. QUOTE i copied the code in a file Did you change the Database Connection information in conn.php? for example???? There are several things which could be incorrect. We need to see the actual code you have copied and pasted, exactly as it exists on your account. |
|
|
|
May 25 2007, 01:53 PM
Post
#6
|
|
|
Member [Level 1] ![]() ![]() ![]() ![]() Group: Members Posts: 73 Joined: 18-May 07 Member No.: 43,278 |
The code in conn.php:
CODE <?php $host = 'localhost'; $user = ''; $pass = ''; $db = 'loginsystem'; mysql_connect($host,$user,$pass) or die ("Database is unavailable. Please try again later.1"); mysql_select_db($db) or die ("Database is unavailable. Please try again later."); ?> I cut out my username and pass. I get the 2nd error message so my user and pass are right. This is the code in the database file (loginsystem.sql) CODE CREATE TABLE `loginsystem` ( `FullName` VARCHAR( 50 ) NOT NULL , `Email` VARCHAR( 50 ) NOT NULL , `Age` VARCHAR( 2 ) NOT NULL , `Login` VARCHAR( 15 ) NOT NULL , `Password` VARCHAR( 15 ) NOT NULL ) ENGINE = MYISAM; But im not sure about the method im using: on the phpmyadmin, when i created the table, i copied the code that was given. I pasted it into notepad and saved it as loginsystem.sql This file i uploaded to the directory where my site is.
Reason for edit: see moderator's note
|
|
|
|
May 25 2007, 02:04 PM
Post
#7
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 377 Joined: 27-April 07 From: Texas! Member No.: 42,252 ![]() |
i havent had this exact problem, b ut i have had problemd with connecting to the database
|
|
|
|
May 25 2007, 05:37 PM
Post
#8
|
|
|
Ancient Enigma ![]() Group: [MODERATOR] Posts: 1,753 Joined: 11-July 04 From: under the stars Member No.: 76 |
you trying to run this on trap17 servers? you need to review your $db name. after you create a database with a name you assign (as you indicated in your case, loginsystem), your cpanel username is prefixed into that. hence, the proper db name the server will recognize, and which should appear in your configuration/settings file is something which looks like this: yourcpanelusername_loginsystem.
another thing is this: having your loginsystem.sql reside on the server itself will not be automagically recognized as your database. you can then proceed to test your script, and hopefully you can now connect successfully to your database. |
|
|
|
May 25 2007, 07:15 PM
Post
#9
|
|
|
Member [Level 1] ![]() ![]() ![]() ![]() Group: Members Posts: 73 Joined: 18-May 07 Member No.: 43,278 |
another thing is this: having your loginsystem.sql reside on the server itself will not be automagically recognized as your database. you can then proceed to test your script, and hopefully you can now connect successfully to your database. Hmm, this isnt working, because I made the table in phpmyadmin which means that i get an error when i try to Run that query: this table already exists... Can anyone please help me, feeling so desperate |