Re: Using include file
| From: | Steve Cayford | Date: | Fri, 12 Apr 2002 21:11:05 +0000 |
| Subject: | Re: Using include file | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-18462@lists.php.net to get a copy of this message | ||
I pasted your code into a file testinclude.php (changing only the server name), then wrote another file test.php:
<?
include('testinclude.php');
?>
It parses okay for me. How are you doing the include?
-Steve
On Friday, April 12, 2002, at 03:02 PM, Alex Francis wrote:
I get a parse error on line 2. The code is as follows: <? $server = "mysql.xcalibre.co.uk"; $user = "user"; $passwd = "password"; $dbname = "rschool"; $tablename1 = "story"; $tablename2 = "guestbook"; $tablename3 = "drawing"; $tablename4="notices"; $link = mysql_connect ($server, $user, $passwd); ?> As I said, when I paste the code into each file I don't have a problem. -- Alex Francis Cameron Design 35, Drumillan Hill Greenock PA16 0XD Tel 01475 798106 afrancis@camerondesign.co.uk http://www.camerondesign.co.uk This message is sent in confidence for the addressee only. It may contain legally privileged information. Unauthorised recipients are requested to preserve this confidentiality and to advise the sender immediately of any error in transmission. Steve Cayford <steve_cayford@unioncab.com> wrote in message news:A5DFA8D8-4E3D-11D6-8753-003065ECC2BC@unioncab.com...Just a guess: Are you doing the include from a function? If so, make sure you explicitly mark your global vars. Otherwise, what's the error message? -Steve On Friday, April 12, 2002, at 12:28 PM, Alex Francis wrote:-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.phpI have one site which I am having problems connecting to my database. If I create my connections in an "include" config file I get an error on the server connection. When I cut and paste the code exactly as it is into each file I have no problems. I have a local server set up in my office which I use to test my databases and scripts and have a slightly different config file on that one. The include file works fine. I have various other sites using "include" config files and have had no problems, but this one is a pain, I have to change each file when I move it mrom my test server to my hosting server. Any help would be appreciated. -- Alex Francis Cameron Design 35, Drumillan Hill Greenock PA16 0XD Tel 01475 798106 afrancis@camerondesign.co.uk http://www.camerondesign.co.uk This message is sent in confidence for the addressee only. It may contain legally privileged information. Unauthorised recipients are requested to preserve this confidentiality and to advise the sender immediately of any error in transmission. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php