Understanding Functions and Includes
Posted: Thu Jan 05, 2006 12:23 pm
Hi all.
I have a file called 15min.php and one called mailer.php.. They both reside in the same directory.
In the file 15min.php, I have an include statement.
Further down inside the 15min.php file.. I have a while loop:
Now.. $rowOne should be coming back as null, as there's nothing in the database (Queries are made further up in the code).. So sendSMS should not be called.
sendSMS() is a function inside of mailer.php... And down in mailer.php is an echo line to let me know that the code has been run..
When I run 15min.php, I see the echo from mailer.php, even though the only line from mailer.php (sendSMS())shouldn't be called as it's in a while loop that I'm pretty sure isn't exectuing.
Scratch that.. I just put an echo in that while loop, and it's not running..
So... Would someone help me understand why the echo from mailer.php would be running, even though none of the code is used? Is this a byproduct of 'include'?
Thanks
David
I have a file called 15min.php and one called mailer.php.. They both reside in the same directory.
In the file 15min.php, I have an include statement.
Code: Select all
include 'mailer.php';Code: Select all
while( $rowOne = mysql_fetch_array($resultThree, MYSQL_NUM) ){
sendSMS($rowOne[1],$resultTwo);
}sendSMS() is a function inside of mailer.php... And down in mailer.php is an echo line to let me know that the code has been run..
When I run 15min.php, I see the echo from mailer.php, even though the only line from mailer.php (sendSMS())shouldn't be called as it's in a while loop that I'm pretty sure isn't exectuing.
Scratch that.. I just put an echo in that while loop, and it's not running..
So... Would someone help me understand why the echo from mailer.php would be running, even though none of the code is used? Is this a byproduct of 'include'?
Thanks
David