468,768 Members | 1,452 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,768 developers. It's quick & easy.

connection to databse

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
1 1730
Luuk
1,043 Expert 1GB
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.

Similar topics

4 posts views Thread by Mahesh D. Rane | last post: by
11 posts views Thread by sreenivasan alakappan | last post: by
2 posts views Thread by Dark_AvEnGer | last post: by
1 post views Thread by Atif Jalal | last post: by
1 post views Thread by Mr. Murad Jamal | last post: by
1 post views Thread by Horia Demian | last post: by
4 posts views Thread by =?Utf-8?B?RFNJU3VwcG9ydA==?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.