PDA

View Full Version : Mysql connect problem


ED_Case
12-08-2006, 02:00 AM
Hi All, Im just after installing a login script & creating database etc im working with this script MoJT Login System can be found http://sourceforge.net/projects/mojt-ls/ here its free the probelm is when i try to connect i get errors on lines 33 & 34 which are the last two lines of code if anyone can help me with this would be great thx.

// File: db_connect.php
// Desc: Use to connect with database

include("mojt_db.php");

define("HOST", "$db_host"); // define host name (default: localhost)
define("USER", "$db_username"); // define database username
define("PASSWORD", "$db_password"); // define database password
define("DATABASE", "$db_name"); // define database name

$db=mysql_connect(HOST, USER, PASSWORD); // connecting to the database
mysql_select_db(DATABASE, $db);

?>

steverz
12-09-2006, 03:16 PM
Use something like:
Also the error your getting would be nice...


$dbhost = "localhost";
$dbuser = "username";
$dbpass = "password";
$db = "database";

$dbcon = mysql_connect($dbhost,$dbuser,$dbpass) or die('Error connecting to database');

mysql_select_db($db);

ED_Case
12-10-2006, 09:42 AM
Thx for the reply steverz but i still get error on line 33 this is error.

Error connecting to databasePHP Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL

scoutt
12-10-2006, 09:35 PM
seems that this is empty

define("DATABASE", "$db_name"); // define database name

ED_Case
12-12-2006, 01:57 AM
Got it going folks thx to everyone who replyed had to change a few spellings IMO ok one another thing this script creates a log in & register area but im after doing a basic login area on my main page so peeps can log in if already registered how can i get this script to read the info from database when they type in there name password etc.

steverz
12-12-2006, 10:22 PM
search this forum for "Login Scripts" or search google, lots of them out there for examples.