"; }}}} if(isset($_SESSION['username']) && isset($_SESSION['password'])){ header("Location: members.php"); } ?> Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in F:\xampp\htdocs\includes.php on line 2 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in F:\xampp\htdocs\includes.php on line 2 Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in F:\xampp\htdocs\includes.php on line 2 Code (markup): what is my error here?
possible reasons: 1. you have not specified password. 2. user name you have used does not have permission to connect.
$conn = mysql_connect("".$hostname."","".$data_username."","".$data_password.""); mysql_select_db("".$data_basename."") or die(mysql_error()); Code (markup): is anything wrong with that?
Yes. $conn = mysql_connect("$hostname", "$data_username", "$data_password") or die(mysql_error()); mysql_select_db("$data_basename") or die(mysql_error()); PHP: Let us know whether it works or not.
i inputted the code to cure this error, and it made no difference Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'cpauser'@'localhost' (using password: NO) in /home/dk/public_html/config.php on line 7 Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'dk'@'localhost' (using password: NO) in /home/dk/public_html/config.php on line 8 Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in /home/dk/public_html/config.php on line 8 Access denied for user 'dk'@'localhost' (using password: NO) PHP: EDIT: these are the errors from installing on my web host. the one at the start was from installing locally!
<? ob_start();session_start(); $hostname = "localhost"; //your hostname (normally localhost) $data_username = "dk_sweetus"; //database username $data_password = "******"; //database password $data_basename = "dk_sweetcollect"; //database name $conn = mysql_connect("$hostname", "$data_username", "$data_password") or die(mysql_error()); mysql_select_db("$data_basename") or die(mysql_error()); $bonuspoints=10; //bonus points awarded for new users $mainpointsneeded=200; //max number of points needed before user can request voucher ?> PHP: thats the config.php file!
Your error does not reflect your config file. Are you sure you are including it before starting the MySQL connection?