Im a little desperate here, Im not a very experience PHP developer and right now im at work on my own with a problem I cant fix.
I have 30 or 40 websites, on 30 or 40 domains (a site for each country)
all the sites use exactly the same code its identical)
However one of my sites is not showing up. Its just not loading there are no errors it just doesnt load. I've been working on it all day and I believe it is due to a function but I cant see the problem with it.
The header file calls the config file@
<? include('config.php'); ?>
the config file calls the functions file
include('functions.php');
and to figure out which function may be the problem I started at the bottom and deleted them one by one refreshing page each time. Eventually I got to a function, that once deleted, my page loaded but obviously with other errors due to missing functions.
the function that I believe is the problem is:
function get_contenttitle($SectionID,$languageid){
global $languageid;
global $mysql_connect;
if($languageid==''){$languageid=$_SESSION["SelectLanguage"];}
$query='SELECT * FROM website.content WHERE SortOrder="'.$SectionID.'" AND LanguageID="'.$languageid.'" AND Active=1 AND LanguageID IN (1, 2, 3, 4, 5, 6, 8, 11, 12, 14, 15, 16, 30)';
//$content=dbqueryintoarray($query);
$content=db_query_into_array_enhanced($mysql_connect,$query);
if(count($content)>0){
$return=$content[0]["ContentTitle"];
}else{
if($languageid==''){$languageid=$_SESSION["SelectLanguage"];}
$query='SELECT * FROM website.content_auto WHERE SortOrder="'.$SectionID.'" AND LanguageID="'.$languageid.'" AND Active=1 AND LanguageID IN (1, 2, 3, 4, 5, 6, 8, 11, 12, 14, 15, 16, 30)';
//$content=dbqueryintoarray($query);
$content=db_query_into_array_enhanced($mysql_connect,$query);
if(count($content)>0){
$return=$content[0]["ContentTitle"];
}else{
$query='SELECT * FROM website.content WHERE SortOrder="'.$SectionID.'" AND LanguageID="1" AND Active=1';
//$content=dbqueryintoarray($query);
$content=db_query_into_array_enhanced($mysql_connect,$query);
if(count($content)>0){
$return=$content[0]["ContentTitle"];
}else{
$return='<b><font color="#FF0000">Warning:</font></b> Content does not exist';
}
}
}
$return=str_replace(chr(10),'<br>',$return);
return $return;
}
now this function is called in the top navigation. If I remove the function the page loads down to the navigation where it is called and then obviously stops. as soon as i put the function back in the page stops loading again at all.
This function uses a db_query_into_array_enhanced function which looks like this:
function db_query_into_array_enhanced($mysql_connect,$query){
global $mysql_debug_comments;
global $total_query_count;
global $total_query_time;
global $total_function_time;
global $log_to_firephp;
global $query_results_to_firephp;
global $output_stats_to_browser;
global $firephp;
global $slow_query_time;
global $query_time;
$bt=debug_backtrace();
$file=$bt[1]["file"];
$pos=strrpos($file,'/');
$calling_script=substr($file,($pos+1));
$calling_line=$bt[1]["line"];
settype($retval,"array");
$query_start=getmicrotime();
$result=mysqli_query($mysql_connect,$query);
$query_end=getmicrotime();
$query_time=($query_end-$query_start);
$total_query_time=$total_query_time+$query_time;
$query_time_ms=round($query_time*1000);
if(!$result){$mysql_debug_comments.="<!-- db_query_into_array_enhanced | Called By: ".$calling_script." | Line: ".$calling_line." | Query FAILED ".$query." -->\n\n";}
if($result){
$success=true;
$function_start=getmicrotime();
$row_count=mysqli_num_rows($result);
for($x=0;$x<$row_count;$x++){$row=mysqli_fetch_array($result,MYSQLI_ASSOC);array_push($retval,$row);}
mysqli_free_result($result_set);
$function_end=getmicrotime();
$function_time=($function_end-$function_start);
$total_function_time=$total_function_time+$function_time;
$mysql_debug_comments.="<!-- Function: db_query_into_array_enhanced | Called By: ".$calling_script." | Line: ".$calling_line." | Status: OK | Results: ".count($retval)." rows | Query Time: ".$query_time_ms."ms | Total Time: ".round($total_query_time*1000)." ms ";
if($query_time_ms>$slow_query_time){$mysql_debug_comments.=" | Query: ".$query." ";}
$mysql_debug_comments.="-->\n\n";
$total_query_count++;
}
if($log_to_firephp==true){
$query_time_ms=round($query_time*1000);
$function_time_ms=round($function_time*1000);
$total_time=$query_time+$function_time;
$query_perc=round(($query_time/$total_time)*100,2);
$function_perc=round(($function_time/$total_time)*100,2);
$log_type='info';
if($success==true){
$message1='db_query_into_array_enhanced | Query: "'.$query.'"';
$message2='db_query_into_array_enhanced | Rows: '.count($retval).' | MySQL Time: '.$query_time_ms.'ms ('.$query_perc.'%) | Function Time: '.$function_time_ms.'ms ('.$function_perc.'%) | Total Time: '.($query_time_ms+$function_time_ms).'ms';
if(($query_time>0.5) or ($function_time>0.5) or ($query_time+$function_time>0.5)){$log_type='warn';}
}else{
$message1='db_query_into_array_enhanced | Query: "'.$query.'" | QUERY FAILED!';
$log_type='error';
}
if($log_type=='info'){$firephp->info($message1);$firephp->info($message2);}
if($log_type=='warn'){$firephp->warn($message1);$firephp->warn($message2);}
if($log_type=='error'){$firephp->error($message1);}
}
if($query_results_to_firephp==true){
$headings=array_keys($retval[0]);
$table=array();
$table[]=$headings;
for($r=0;$r<count($retval);$r++){
$row=array();
for($c=0;$c<count($retval[0]);$c++){array_push($row,$retval[$r][$headings[$c]]);}
$table[]=$row;
}
$firephp->table('Results from MySQL Query "'.$query.'" Rows: '.count($retval).' Time: '.($query_end-$query_start).'s', $table);
}
if($output_stats_to_browser==true){
echo 'Query: '.$query.'<br>';
echo 'Query Time: '.$query_time_ms.'ms ('.$query_perc.'%)<br>';
echo 'Function Time: '.$function_time_ms.'ms ('.$function_perc.'%)<br>';
echo 'Total Time: '.($query_time_ms+$function_time_ms).'ms<br>';
echo 'Rows returned: '.count($retval).'<br>';
}
return $retval;
}
Ive checked every single piece of code against one of the other working sites and everything is the same. EXACTLY the same.
im going out of my mind here can someone please please please help me out
much appreciated