Database error

onlinegamesnz

New Member
Messages
2
Reaction score
0
Points
0
hi, i am trying to setup a login system and have setup a database with all tables in it, and info in the appropriate tables have been added. when i accesss the index and try login, the message "No database selected" shows.

DB USER "customin_login"
DB HOST "localhost"
DB PASS "*****"
DATABASE "customin_loginsystem"

whereas customin is my username?

Any ideas? the patch is as follows for live example

http://custominterriors.x10.mx/Site/admin/

Any help would be greatly appreciated
Thanks

PS MODS, forgive me if this is in the wrong place ;)

also, i have the backend.class.php file in which the database attributes are edited, and then another backend.classs1.php, do i edit them both?
 
Last edited:

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
Something is wrong with your code.

"No database selected"

It is not refusing the connection, which would result in a different error message.
 

onlinegamesnz

New Member
Messages
2
Reaction score
0
Points
0
heres my code. i have created a databse called loginsystem and imported a sql file with all tabkles in it.


Code:
<?
// start session
session_start();
// set the PHP SETTINGS such that it does not use SESSIONS with COOKIE support
ini_set("session.use_cookies",0);
// defination of backEnd class
class backEnd {
 // database settings
 var $DATABASE = 'customin_loginsystem';
 var $DB_HOST = 'localhost';
 var $DB_USER = 'customin_login';
 var $DB_PASS = '********';
 
 // other variables and arrays
 var $page_no = 1;
 var $no_of_rows = 2;
 var $admin_title = ".: Login System : Welcome to Administartion :.";
  var $client_title = ".: Welcome to Login System :."; 
 var $error_msg = "";
 var $host_path = "[URL]http://waheed/loginsystem/[/URL]";
 var $array_roles = array(
   0 => "Administrator",
   1 => "Webmaster",
   2 => "User");
 // connect to MYSQL
 function _connect(){
   $db_handle = mysql_connect($this->DB_HOST, $this->DB_USER, $this->DB_PASS) or die(mysql_error());  
   mysql_select_db($this->DATABASE, $db_handle);
   return $db_handle;
 }

Thanks again for the help
 
Last edited:

murtazrocks58

Banned
Messages
65
Reaction score
0
Points
0
There is an error in the code

Try to preceed the database name with your user name
and also the password
 

bidzey75

New Member
Messages
53
Reaction score
0
Points
0
I think using a class for a MySql connection is an overkill, but since we cant see all of it maybe it does more. This is not all of the code, is it? The code here is declaring the class (with missing parts). If you want to use it you have to initiate it into a variable. like this:

Code:
class Foo {
    function Foo($init_parameter) {
        $this->some_parameter = $init_parameter;
    }
}

// initiate code:

$foo = new Foo("some init value");
 

vv.bbcc19

Community Advocate
Community Support
Messages
1,524
Reaction score
92
Points
48
Ahah..currently the site is working.Nice tutorials dear members.
What does the site intend to do anyways?
 
Top