Re: [PHP] Re: Include files....

2007-05-21 Thread Jason Pruim

Hi Everyone,

Thanks for the info, putting the opening and closing tags in the  
include file worked like a charm! Now I just need to get the SQL  
injection protection junk to work... Back to the web to read more!





--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Include files....

2007-05-19 Thread Haydar TUNA
Hello,
Short tags (? ?) are only available when they are enabled via the 
short_open_tag php.ini configuration file directive, or if php was 
configured with the --enable-short-tags option. Did you configure your 
php.ini file?

-- 
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

Jason Pruim [EMAIL PROTECTED], haber iletisinde sunlari 
yazdi:[EMAIL PROTECTED]
 Okay, Very Newbie-ish question coming!

 I can't figure out why my include won't work... Here's the text:

 index.php:
 ?PHP

 include 'defaults.php';

 $link = mysql_connect($server, $username, $password) or die('Could
 not connect: ' . mysql_error());
 echo 'Connected successfully BR';
 mysql_select_db($database) or die('Could not select database: ' .
 mysql_error());
 echo 'DB selected BR';

 $result = mysql_query($query) or die(mysql_error());
 $num=mysql_numrows($result);
 $i= 0;


 while($i  $num) {

 $FName = mysql_result($result, $i,FName);
 $LName = mysql_result($result,$i,LName);
 $Add1 = mysql_result($result, $i,Add1);
 $Add2 = mysql_result($result, $i,Add2);
 $City = mysql_result($result, $i,City);
 $State = mysql_result($result, $i,State);
 $Zip = mysql_result($result, $i,Zip);
 $Date = date(m-d-y h:i:s,mysql_result($result, $i, Date));
 $Record = mysql_result($result, $i, Record);
 $subName = mysql_result($result, $i,subName);
 $subEmail = mysql_result($result, $i,subEmail);
 $subPhone = mysql_result($result, $i,subPhone);
 $chkMember = unserialize(mysql_result($result, $i,chkMember));
 $chkAdd = unserialize(mysql_result($result, $i,chkAdd));
 $chkDel = unserialize(mysql_result($result, $i, chkDel));

 $i++;

 //echo P$Record $FName, $LName,/P P$Add1,BR $Add2,BR/P
 P$City, $State, $Zip,/P $Date,BR $subName, $subEmail,
 $subPhone, $chkMember[$row], $chkAdd[$row], $chkDel[$row]BR;

 echo H3Name Address/H3;
 echo P id ='test' $FName $LName $Add1 $Add2 $Date/P;

 };




 ?
 *
 defaults.php:

 $server = 'localhost';
 $username = 'USERNAME';
 $password = 'PASSWORD';
 $database = 'DATABASE';
 $query = 'SELECT * FROM current';

 Yes I changed the values of username, password, and database. But
 when I use the same info inside the index.php file it all works just
 fine. Here is the error that it gives me:

 [Fri May 18 15:32:07 2007] [error] PHP Notice:  Undefined variable:
 server in /Volumes/RAIDer/webserver/Documents/tests/legion/index.php
 on line 5
 [Fri May 18 15:32:07 2007] [error] PHP Notice:  Undefined variable:
 username in /Volumes/RAIDer/webserver/Documents/tests/legion/
 index.php on line 5
 [Fri May 18 15:32:07 2007] [error] PHP Notice:  Undefined variable:
 password in /Volumes/RAIDer/webserver/Documents/tests/legion/
 index.php on line 5
 [Fri May 18 15:32:07 2007] [error] PHP Warning:  mysql_connect() [a
 href='function.mysql-connect'function.mysql-connect/a]: Access
 denied for user 'USERNAME'@'localhost' (using password: NO) in /
 Volumes/RAIDer/webserver/Documents/tests/legion/index.php on line 5


 Thanks in advance for helping me through my obvious friday afternoon
 brain fart...




 --

 Jason Pruim
 Raoset Inc.
 Technology Manager
 MQC Specialist
 3251 132nd ave
 Holland, MI, 49424
 www.raoset.com
 [EMAIL PROTECTED]


 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: include files and global variables

2002-07-21 Thread Chris Earle

Hmm.  Here's how you can make it load EVERYtime the file is included, plain
and simply.  In the include file, create the function.and the call it after
you've made it.  To get the other function to work, you might want to try
placing the function ABOVE checkMaster();
 (you should probably simply put that in the same file, but above it).
functions.php
?
function myfunction () {}

myfunction();
?

I have the feeling that the problem with the session variable is that you're
calling it before anything has been done to define it in the main page, so
it is null when you check it.  Try debugging it with echo statements here
and there that call out variables so that you know they're defined
correctly.  Also, turn on error_reporting(E_ALL); (you can simply call it
at the top of the page--first thing).  That will tell you when variables are
used if they're null and other errors that aren't fatal, but might cause
problems.

Jon Wyatt [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

 I have some pages which include a number of files.
 In one of the include files I have a function which I wish to be executed
 everytime the include file is loaded.

 Therefore I place the function name in the include file at the top.

 However, this function uses a session variable to decide whether to call
 another function and it appears that this variable is not being carried
 across. For example, the start of the include file might look like this:-


 ?php

 checkMaster();


 function checkMaster()
 {
 global $master_session;
 if ($master_session[db_host])
 {
 connectToDB();
 }
 }


 function connectToDB()
 {
 ...
 


 The master_session variable is not set and hence connectToDB is never
 called.
 If I place the checkMaster code in each page that includes this file then
it
 all works fine. How do I get round this?

 Thanks.

 jon.

 Better than having your body rubbed vigorously with a cheese grater.
 http://www.samuri.co.uk.


 _
 MSN Photos is the easiest way to share and print your photos:
 http://photos.msn.com/support/worldwide.aspx




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php