RE: [PHP] Small Include Problem

From: Date: Thu, 27 Jul 2000 08:55:24 +0000
Subject: RE: [PHP] Small Include Problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-8497@lists.php.net to get a copy of this message
Hi Tom You could make the error.php a function instead. Place this in a file and include this. Then you could pass something the error msg to it rather than defining it first. Then create a function in here say err_msg($msg) where message would be whatever. So to call the function you would type err_msg("There has been a problem opening the database!"); M@ > -----Original Message----- > From: Tom Peck [mailto:tompeck@paradise.net.nz] > Sent: Thursday, July 27, 2000 01:27 > To: PHP List > Subject: [PHP] Small Include Problem > > > Hello Everyone. > > I have a small problem with using an include file. I have some code like > this: > > <? > include("login.php3"); > > if(@mysql_connect("localhost", "root")) { > $db = mysql_connect("localhost", "root"); > mysql_select_db("olympic",$db); > } > else { > $errMsg = "There has been a problem opening the database!"; > require("../error.php"); > exit(); > } > ?> > > > The problem is that the value for $errMsg doesn't get passed to the > 'require'd file. Is this normal? If it is not done in this way, how else > is it possible? Using cookies? > > Thanks > > Tom Peck > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#8497) next »