By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,586 Members | 992 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,586 IT Pros & Developers. It's quick & easy.

connection to databse

P: 1
Connectvars.php has this
<?php
// Define database connection constants
define('DB_HOST', 'localhost');
define('DB_USER', 'root');
define('DB_PASSWORD', '');
define('DB_NAME', 'el');
?>

Error: Couldn't open el: Access denied for user ''@'localhost' to database 'el'
<?php
//am using this to connect to database
require_once('./connections/connectvars.php');

$result = mysql_query( "SELECT * FROM reservation" )
or die("SELECT Error: ".mysql_error());
$num_rows = mysql_num_rows($result);
print "There are $num_rows records.<P>";
print "<table width=200 border=1>\n";
while ($get_info = mysql_fetch_row($result)){
print "<tr>\n";
foreach ($get_info as $field)
print "\t<td><font face=arial size=1/>$field</font></td>\n";
print "</tr>\n";
}
print "</table>\n";
mysql_close($link);
?>
Jun 4 '12 #1
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 1,035
You are missing a 'mysql_connect()'.....?
Jun 9 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.