I have a PHP connection to a database working:
I have this page,psl-config.phpdb_connect.php
I also have this db-connect.php page.
So back on this donorList.php page I put this:
and I removed these lines:
I'm getting:
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'me'@'myHost' (using password: NO) in /home/.../donorList.php on line 112
Unable to select database
I'm trying to switch things here from mySQL to mySQLi, but the examples I've found are different from one another and I'm not sure were exactly the error lies here.
Thanks!
Code:
$username="me";
$host="myHost";
$password="password";
$database="myDatabase";
$con = mysql_connect($HOST,$USER,$PASSWORD,$DATABASE);
if(!$con)
{
die("Unable to select database");
}
mysql_select_db($database,$con);
$sql = "SELECT * FROM donors WHERE lastname LIKE '$letter%' ORDER BY lastname, firstname";
$result = mysql_query($sql) or die(mysql_error());
I have this page,psl-config.phpdb_connect.php
Code:
<?php
/**
* These are the database login details
*/
define("HOST", "myHost"); // The host you want to connect to.
define("USER", "me"); // The database username.
define("PASSWORD", "*****"); // The database password.
define("DATABASE", "myDatabase"); // The database name.
I also have this db-connect.php page.
Code:
<?php
include_once '/home/.../psl-config.php'; // Needed because functions.php is not included
$mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE);
if ($mysqli->connect_error) {
header("Location: http//[URL unfurl="true"]www.mediqwest.com/error.php?err=Unable[/URL] to connect to MySQL");
exit();
}
So back on this donorList.php page I put this:
Code:
<?php
include_once '/home/mediqw5/public_html/php/db_connect.php';
include_once '/home/mediqw5/public_html/php/functions.php';
include_once '/home/mediqw5/public_html/php/psl-config.php';
sec_session_start();
?>
Code:
$username="me";
$host="myHost";
$password="password";
$database="myDatabase";
I'm getting:
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'me'@'myHost' (using password: NO) in /home/.../donorList.php on line 112
Unable to select database
I'm trying to switch things here from mySQL to mySQLi, but the examples I've found are different from one another and I'm not sure were exactly the error lies here.
Thanks!