Page 1 of 1

connect with include

Posted: Sat Feb 07, 2004 6:18 pm
by Flavio
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

Posted: Sat Feb 07, 2004 6:52 pm
by DuFF
Where is "access.php" located in relation to your script? By using "../" you are specifying that it is a folder above where the script is, is this correct?

Posted: Sun Feb 08, 2004 8:47 am
by Flavio
Hello,
Thanks for your help.

The file is located in the same folder as the script(s). I also tried with full url but the result is teh same.

Posted: Sun Feb 08, 2004 10:49 am
by John Cartwright
Do this then

Code: Select all

<?php
include("access.php"); ?> 
?>
.......

Posted: Sun Feb 08, 2004 11:52 am
by Flavio
Sorry, error was following: Parse error: parse error in /home/user/www/file.php on line 2

Posted: Sun Feb 08, 2004 11:53 am
by malcolmboston
double php closing tags

Re: connect with include

Posted: Mon Feb 09, 2004 2:28 am
by Dr Evil
Flavio wrote: include('../access.php');
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
Are you sure you got your filenames straight ?

Dr Evil

Posted: Mon Feb 09, 2004 1:13 pm
by Flavio
Yes filenames are correct acess = acceso

Posted: Mon Feb 09, 2004 5:31 pm
by Dr Evil
Is this now corrected ? Does your script work Flavio?

Posted: Mon Feb 09, 2004 6:39 pm
by Flavio
No the result is still the same (code are correct - I just used translation for better undestanding) Thanks any how