connect with include
Moderator: General Moderators
connect with include
Hi,
Sorry to molest for such a small "beginner" issue. In order to connect I use the following script in access.php (<?php include('../access.php'); ?>
<?php
if (!$db = mysql_connect('localhost', 'user', 'pass')) {
die('mySQL error: '.mysql_errno().':'.mysql_error());
}
if (!mysql_select_db('pass')) {
die('mySQL error: '.mysql_errno().':'.mysql_error());
}
?>
error is the following:
Warning: Failed opening '../acceso.php' for inclusion (include_path='./:/usr/local/lib/php') in /home2/user/site-www/page.php on line 1
What did I wrong (the connection works) or better what do I have to do to correct this.
Thanks a lot for any help
Flavio
Sorry to molest for such a small "beginner" issue. In order to connect I use the following script in access.php (<?php include('../access.php'); ?>
<?php
if (!$db = mysql_connect('localhost', 'user', 'pass')) {
die('mySQL error: '.mysql_errno().':'.mysql_error());
}
if (!mysql_select_db('pass')) {
die('mySQL error: '.mysql_errno().':'.mysql_error());
}
?>
error is the following:
Warning: Failed opening '../acceso.php' for inclusion (include_path='./:/usr/local/lib/php') in /home2/user/site-www/page.php on line 1
What did I wrong (the connection works) or better what do I have to do to correct this.
Thanks a lot for any help
Flavio
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Do this then
.......
Code: Select all
<?php
include("access.php"); ?>
?>-
malcolmboston
- DevNet Resident
- Posts: 1826
- Joined: Tue Nov 18, 2003 1:09 pm
- Location: Middlesbrough, UK
Re: connect with include
Flavio wrote: include('../access.php');
Are you sure you got your filenames straight ?Flavio wrote: Warning: Failed opening '../acceso.php' for inclusion (include_path='./:/usr/local/lib/php') in /home2/user/site-www/page.php on line 1
Dr Evil