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.
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?
<?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.
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. 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 ). after this, you will be greeted with this: "Your SQL query has been executed successfully" which means you can then congratulate yourself.
you can then proceed to test your script, and hopefully you can now connect successfully to your database.
another thing is this: having your loginsystem.sql reside on the server itself will not be automagically recognized as your database. 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 ). after this, you will be greeted with this: "Your SQL query has been executed successfully" which means you can then congratulate yourself.
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...
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.
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....
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 ....
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()); ....
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","....
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 ......
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....
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....
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? ....
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'....
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....
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!....
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" />....
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....
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..!!....
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.