rainprop Posted March 9, 2010 Share Posted March 9, 2010 hi, can someone pls help me.. without solving this im not able to continue to the next step. this error seems to come when i try to log in. Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'SYSTEM'@'localhost' (using password: NO) in C:\wamp\www\login-exec.php on line 15 Failed to connect to server: Access denied for user 'SYSTEM'@'localhost' (using password: NO) how to solve this?? this is the coding that i've put, which causes this error. <?php session_start(); require_once('config.php'); $errmsg_arr = array(); $errflag = false; $link = mysql_connect('localhost'); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } $db = mysql_select_db('payroll4'); if(!$db) { die("Unable to select database"); } function clean($str) { $str = @trim($str); if(get_magic_quotes_gpc()) { $str = stripslashes($str); } return mysql_real_escape_string($str); } $login = clean($_POST['login']); $password = clean($_POST['password']); if($login == '') { $errmsg_arr[] = 'Login ID missing'; $errflag = true; } if($password == '') { $errmsg_arr[] = 'Password missing'; $errflag = true; } if($errflag) { $_SESSION['ERRMSG_ARR'] = $errmsg_arr; session_write_close(); header("location: login-form.php"); exit(); } $qry="SELECT * FROM `user` WHERE login='login' AND password='".md5($_POST['password'])."'"; $result=mysql_query($qry); if($result) { if(mysql_num_rows($result) == 1) { //Login Successful session_regenerate_id(); $member = mysql_fetch_assoc($result); $_SESSION['SESS_USER_ID'] = $member['user_id']; $_SESSION['SESS_EMP_NAME'] = $member['emp_name']; session_write_close(); header("location: member-index.php"); exit(); }else { //Login failed header("location: login-failed.php"); exit(); } }else { die("Query failed"); } ?> thanks again. Quote Link to comment Share on other sites More sharing options...
aeroswat Posted March 9, 2010 Share Posted March 9, 2010 This has to do with your connection being wrong. Where is your website hosted? Quote Link to comment Share on other sites More sharing options...
rainprop Posted March 9, 2010 Author Share Posted March 9, 2010 actually this is my assignment..my lecturer have given a task to create a web-based payroll system. im not an IT student, im doin accountancy, frankly speaking i do not know much about php. its more of a trial and error thing.. the system is not to be hosted anywhere, we just have to present it to make sure it runs..dats my another problem now. i just did something in dreamweaver which says "create new site", and i created one as a localhost only, im rely sorry if im wrong.. Quote Link to comment Share on other sites More sharing options...
taquitosensei Posted March 9, 2010 Share Posted March 9, 2010 you need to specify a username and password for your database connection. $link = mysql_connect('localhost','username','password'); Quote Link to comment Share on other sites More sharing options...
rainprop Posted March 9, 2010 Author Share Posted March 9, 2010 but i do not have a password..how n where do i create one?? Quote Link to comment Share on other sites More sharing options...
aeroswat Posted March 9, 2010 Share Posted March 9, 2010 actually this is my assignment..my lecturer have given a task to create a web-based payroll system. im not an IT student, im doin accountancy, frankly speaking i do not know much about php. its more of a trial and error thing.. the system is not to be hosted anywhere, we just have to present it to make sure it runs..dats my another problem now. i just did something in dreamweaver which says "create new site", and i created one as a localhost only, im rely sorry if im wrong.. Sorry but if this is not hosted anywhere then how is it executing the code? Whatever machine it is being run on has a server and has php installed. You need to know the username and password that belongs to whatever server it is on. Also depending on where it is that localhost might not be right as well. If you are running it on your machine though and not uploading it somewhere then localhost should be correct. Quote Link to comment Share on other sites More sharing options...
rainprop Posted March 9, 2010 Author Share Posted March 9, 2010 THANK U SO MUCH ITS OK NOW... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.