Add to Google

How To Connect Site To Database? [resolved]

Pages: 1, 2
free web hosting

Read Latest Entries..: (Post #12) by Unstoppable on Jun 1 2007, 01:35 PM. (Line Breaks Removed)
that is a very useful tutorial, thanks to provide this link for me noobie, serverph.
Read the FIRST post of this Topic. - Express your Opinion! Contribute Knowledge :-).

Open Discussion > CONTRIBUTE > Computers > Database

How To Connect Site To Database? [resolved]

Unstoppable
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.

Reply

jlhaslip
Got any code for us to look at?

Reply

Unstoppable
Here is the exact code i used (from the tutorial):
http://www.trap17.com/forums/complete-logi...stem-t7247.html

Reply

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

Reply

jlhaslip
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.

Reply

Unstoppable
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.

Notice from serverph:
code tags added. please use appropriate bbcodes as needed.

 

 

 


Reply

Mermaid711
i havent had this exact problem, b ut i have had problemd with connecting to the database

Reply

serverph
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. wink.gif go back to your phpmyadmin control panel, and select your loginsystem database from the dropdown menu (if you don't have your loginsystem db yet, click MySQL icon from cpanel first to create one). after selecting your database, click on the SQL tab, then copy and paste your SQL code (the one you have in your loginsystem.sql) on the form provided, then RUN it (press GO wink.gif). after this, you will be greeted with this: "Your SQL query has been executed successfully" which means you can then congratulate yourself. biggrin.gif

you can then proceed to test your script, and hopefully you can now connect successfully to your database.

Reply

Unstoppable
QUOTE(serverph @ May 25 2007, 07:37 PM) *
another thing is this: having your loginsystem.sql reside on the server itself will not be automagically recognized as your database. wink.gif go back to your phpmyadmin control panel, and select your loginsystem database from the dropdown menu (if you don't have your loginsystem db yet, click MySQL icon from cpanel first to create one). after selecting your database, click on the SQL tab, then copy and paste your SQL code (the one you have in your loginsystem.sql) on the form provided, then RUN it (press GO wink.gif). after this, you will be greeted with this: "Your SQL query has been executed successfully" which means you can then congratulate yourself. biggrin.gif

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

Reply

yuriman
search on google

Notice from BuffaloHELP:
This post is considered spam in our board. Improve immediately.

Reply

Latest Entries

Unstoppable
that is a very useful tutorial, thanks to provide this link for me noobie, serverph.

Reply

serverph
QUOTE(Unstoppable @ May 26 2007, 03:15 AM) *
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


still agonizing with your database? you can DROP the whole database and start from scratch if need be. and to give you a walkthrough on databases, here is a guide on Mysql Database Setup:
http://www.trap17.com/forums/mysql-databas...base-t6665.html

it's as plain as can be explained already with that, you just need to follow the steps correctly.

and next time you encounter any errors, kindly include the error (via a screenshot or a verbatim/word-for-word recap of the error) so we can better assist you with the problem.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Pages: 1, 2
Recent Queries:-
  1. how connect database to website - 27.84 hr back. (1)
  2. youtube how to create my own login form with connection to the database - 31.61 hr back. (1)
  3. how to connect html to oracle db - 62.68 hr back. (1)
  4. how to connect database to web pages - 82.63 hr back. (1)
  5. how to connect database to html - 139.67 hr back. (3)
  6. how to connect relationship to database - 347.48 hr back. (1)
  7. how to connect database using dreamweaver - 351.39 hr back. (2)
  8. how to database my site - 406.64 hr back. (1)
  9. how to connect database to website - 153.50 hr back. (3)
  10. how to connect html to database - 485.72 hr back. (1)
  11. i need code to connect gooogle to my database? - 550.89 hr back. (1)
  12. how to connect a database to a ftp server - 616.05 hr back. (1)
  13. how to connect to phpmyadmin - 662.60 hr back. (1)
  14. how to connect a database to html - 719.40 hr back. (1)
Similar Topics

Keywords : connect, site, database,

  1. Database Normalization
    (0)
  2. Need Advice On Setting Up Mysql Database.
    I have a huge amount of daily data updates to be inserted. (4)
    First of all, to get the idea of what I am trying to achieve here, please have a look at my
    idea thread, entitled Idea For Using A Cron Job To Grab Daily Travian Map.sql Updates . This gives
    a prelude to the project, what it is for, what it is supposed to do, etc. Now, what I need is
    specific advice on setting up the mySQL database(s) to implement this idea. There is a useful FAQ
    file for how to make use of the map.sql data located on the help.travian.com website, which also
    gives an example of the CREATE TABLE instruction that matches the data in the map.sql fi....
  3. Database Or Pdf
    Best way to list books on my site (3)
    Hi all, I am not sure if this is the right place to post but I'm sure you'll tell
    me if it's not. My problem is this: I have a website where I sell books and it's one of
    those simpleton sites where I don't need to know code, I just click icons etc Anyway, I can
    upload images to the server and need to have them in different resolutions and link from a thumbnail
    to the larger picture. What I am trying to say is I have about 6000 books to display on my
    website which is impractical as it takes me about 10 mins to load 1 copy. What is the ....
  4. What Value Would I Use To Insert This Data?
    Help on insertion of data to database? (4)
    I am learning slowly but surely and I know some of you probably getting tired of my questions. ^^;;
    However, I believe one can not learn without asking questions. So.. if I get too bothersome.. just
    point me to some books or something. lol XD // Make a MySQL Connection mysql_connect("localhost",
    "name", "password") or die(mysql_error()); mysql_select_db("at2927_abq") or die(mysql_error()); //
    Insert a row of information into the table "example" mysql_query("INSERT INTO members (pasture)
    VALUES('Timmy Mellowman', '23' ) ") or die(mysql_error()); ....
  5. Database With Mysql++
    getting mySQL++ to work with trap17 (7)
    Hi, I'm trying to build an online game and figured the easiest way to do the server list would
    be to make a mySQL database for it; however, I use the con() command on the IP i get from pinging my
    website and I always get an abnormal program termination; however, it will work with the mySQL on my
    own machine. The code is below: CODE #include <iostream> #include <iomanip>
    #include <mysql++> #include "pass.h"//holds my password (i program at
    school) int main(void) {     Connection con("t3jem3_test","....
  6. Php With Simple Csv List As Database, What Do U Think?
    (2)
    I've designed a php website and i used simple CSV file as my database because of few reasons
    my client had to pay more to active MySQL database was a simple product list it was easy to
    convert product list from existing Excel file to CSV it is easy to make any changes so i have few
    files to convert to CSV if i wanna update the website. I know it's less secure specially if
    it's an online business (which is not). question is : what are disadvantages? is that slower
    than MySQL? is there more possibility of occurring bug? is that less professional? or ......
  7. Forum Database
    Forum Database Space and its capacity to hold content (9)
    Okay, I have a forum which is growing daily. Even though members aren't that many, I'm still
    concerned over my database space and its capacity to hold the forum's content. Since post counts
    take up database space, the remaining space will decrease daily, albeit by little amounts. Still, it
    will decrease anyway and eventually my database for that forum will run out of space. My question
    is: 1. Is there any way to possibly create a new database to continue holding the old
    database's increasing data? As in, my old database is there but its full and I creat....
  8. Database Migration - Seditio To Joomla
    any help is needed (1)
    Hi guys! I was desperately looking on internet for any help with migrating Seditio database to
    Joomla.. I`m admin on site which has more than 2500 members and day by day I get annoyed by
    pretty dumb solutions in Seditio.. can anyone tell me how to migrate the seditio site to joomla?
    any tutorials on internet on database migration? thanks....
  9. Best Database Software?
    (1)
    I'm quite new to creating and managing databases - yesterday I installed Filemaker Pro 9 and my
    initial thoughts are that it's amazing! Only just starting to get to grips with it - think
    it'll take some time to master it. What Database software do others use and what do people
    think of Filemaker Pro? Advantages/Disadvantages? ....
  10. Questioning My Database Structure...
    (4)
    Okay, I posted a brief description of this in the PHP section, but I'll summarize myself again.
    I'm creating a PHP based game that is an economy game, where you start out with so many
    resources and a building, and you expand your business empire by building more buildings, which puts
    out more resources, and you can buy and sell on the market and whatnot. In the end, you try and
    become the wealthiest player in the game. Now I already have most of my database in MySQL set-up.
    But I've been told several different things on my structure and wanted your guys'....
  11. Exporting Database Problems
    (3)
    On the host I moved here from, I have a database that I would like to transfer. On this host I am
    unable to use PHPMyAdmin, but I have MySQL-Admin 3.3 that works fine. But the main problem is the
    host. Recently they made it so you there is only a 1mb upload limit, and also that MySQL temporarily
    will not operate properly. Which is basically why I want to get off that host. Anyway, I can export
    each of the small tables easily. But I have tables that are over 2mb, and I do not know how I can
    get them. When I click on "Show table", the table starts to load, but then it sto....
  12. Mysql Database Copying
    (4)
    Is there anyway to merge 2 databases? I have an XOOPS and SMF both installed with Fantastico, and
    the bridge is not working like the Joomla! one does. (with the seperate db capability) i know
    how to transfer all the tables by hand but depending on how much data you have stored in mysql could
    take a long time. Take short time!? Help me!....
  13. Joomla Sql Error: Connection To Database Server Failed.
    (1)
    Hi Today I got this error-message in back-end on my Joomlasite hewwelub.trap17.com/d-lan/
    QUOTE This site is temporarily unavailable. Please notify the System Administrator Connection to
    database server failed. This is the first time I get this error, and I don't want or have
    the time to reinstall the site with all its features... The only time I have seen this problem yet
    is when I tried to unpublish a menu item. Any answer would be to great help, thanx /smile.gif"
    style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />....
  14. Connecting Php With Oracle Database
    (1)
    i need to connect oracle with php ..now me using oracle 10g can any one give me the solution
    thanks.....
  15. Mannual Creation Of Oracle Database
    (0)
    Manual Creation of database in windows with oracle 9i (Step-by-Step) (Name of the database=db18)
    (Note: all commands are in bold letters) 1. Open the command prompt and execute the command
    sqlplus/nolog 2. Connect to the default database as sysdba in sql prompt SQL>conn sys/oracle as
    sysdba you can see the name of that database by executing select name from v$database; 3. Now
    open another command prompt and set oracle SID as set oracle_sid=db18 4. Start a windows service
    with internal password oradim –new –sid intpwd is the syntax. In this case I use ceylonlinux....
  16. Mysql Tools Database
    Opensource sql tools... (1)
    You can download mysql query web browser on http://www.mysql.com you also can download plugin
    there...like conector mysql from visual basic ,java,etc with my sql query tool browser you can make
    and maintance youre database sql easily because use gUI interface..!!....

    1. Looking for connect, site, database,

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for connect, site, database,

*MORE FROM TRAP17.COM*
advertisement



How To Connect Site To Database? [resolved]



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE