PHP:
Code: Select all
<?php
global $ROW_GLOBAL;
$sessionID = $_COOKIE[SessionID];
$MySQL = mysql_connect ('localhost', 'dbname', 'dbpassword') or die ('I cannot connect to the database because: ' . mysql_error());
$permissionscheck = "SELECT permissions FROM sessions WHERE sessionID = '$sessionID'";
$result=mysql_db_query('dbtable', $permissionscheck, $MySQL);
$ROW_GLOBAL=mysql_fetch_array($result);
function writeContent(){
if (eregi("Q1",$ROW_GLOBAL[0])){
print("Permission specific content written here");
}else{
print("No matching permissions");
}
}
mysql_close ($MySQL);
?php>I don't see any errors when I run this code but instead of printing the content it prints the 'else' string. I think have narrowed it down to the variable. The If statement works just fine outside of the function. For example, if I comment out the function details like this:
PHP:
Code: Select all
<?php
//function writeContent(){
if (eregi("Q1",$ROW_GLOBAL[0])){
print("Permission specific content written here");
}else{
print("No matching permissions");
}
//}
?php>This works just fine. I'm trying to put it into a function to eliminate some of the If statements.
Do any you happen to know what I might be doing wrong? The $ROW_GLOBAL variable contains none of the information from the variable outside the function. I've included my PHP info below.
Any help is appreciated.
Thank you!
PHP Version: 4.3.2
Display Errors: On
Error Level: Not E_ALL
Register Globals: On