停止站点加载的PHP函数

停止站点加载的PHP函数,php,sql,function,include,loading,Php,Sql,Function,Include,Loading,我在这里有点绝望,我不是一个非常有经验的PHP开发人员,现在我在工作,我自己的问题,我不能解决 我有30或40个网站,在30或40个领域(每个国家一个网站) 所有站点使用完全相同的代码(完全相同) 然而,我的一个网站没有出现。它只是没有加载,没有错误,只是没有加载。我一整天都在努力,我相信这是由于一个功能,但我看不出它有什么问题 头文件调用配置文件@ <? include('config.php'); ?> 为了弄清楚哪个函数可能是问题所在,我从底部开始,每次都把它们一个一个地删除

我在这里有点绝望,我不是一个非常有经验的PHP开发人员,现在我在工作,我自己的问题,我不能解决

我有30或40个网站,在30或40个领域(每个国家一个网站)

所有站点使用完全相同的代码(完全相同)

然而,我的一个网站没有出现。它只是没有加载,没有错误,只是没有加载。我一整天都在努力,我相信这是由于一个功能,但我看不出它有什么问题

头文件调用配置文件@

<? include('config.php'); ?>
为了弄清楚哪个函数可能是问题所在,我从底部开始,每次都把它们一个一个地删除。最终我得到了一个函数,一旦删除,我的页面就会加载,但很明显由于缺少函数而导致了其他错误

我认为问题所在的功能是:

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;
}
函数get\u contenttitle($SectionID,$languageid){ 全球$languageid; 全球$mysql\u连接; 如果($languageid=''){$languageid=$_会话[“SelectLanguage”];} $query='SELECT*FROM website.content,其中SortOrder=“.$SectionID.”和LanguageID=“.$LanguageID.”和Active=1,LanguageID位于(1,2,3,4,5,6,8,11,12,14,15,16,30)中; //$content=dbqueryintoarray($query); $content=db\u query\u into\u array\u增强($mysql\u connect,$query); 如果(计数($content)>0){ $return=$content[0][“ContentTitle”]; }否则{ 如果($languageid=''){$languageid=$_会话[“SelectLanguage”];} $query='SELECT*FROM website.content_auto,其中SortOrder=“.$SectionID.”和LanguageID=“.$LanguageID.”以及(1,2,3,4,5,6,8,11,12,14,15,16,30)中的Active=1和LanguageID; //$content=dbqueryintoarray($query); $content=db\u query\u into\u array\u增强($mysql\u connect,$query); 如果(计数($content)>0){ $return=$content[0][“ContentTitle”]; }否则{ $query='SELECT*FROM website.content,其中SortOrder=“.”.$SectionID.”和LanguageID=“1”且Active=1'; //$content=dbqueryintoarray($query); $content=db\u query\u into\u array\u增强($mysql\u connect,$query); 如果(计数($content)>0){ $return=$content[0][“ContentTitle”]; }否则{ $return='Warning:内容不存在'; } } } $return=str_replace(chr(10),“
”,$return); return$return; } 现在在顶部导航中调用此函数。如果我删除该函数,页面将加载到调用它的导航,然后明显停止。一旦我把函数放回页面,就不再加载了

此函数使用db_query_into_array_增强函数,如下所示:

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;
}
函数db\u query\u进入\u数组\u增强($mysql\u connect,$query){
全局$mysql\u调试\u注释;
全局$total\u query\u count;
全局$总查询时间;
全局$总功能时间;
全球$log\u至\u Firehp;
全局$query\u results\u到\u firephp;
全局$output_stats_至浏览器;
全球$HP;
全局$slow\u query\u时间;
全局$查询时间;
$bt=debug_backtrace();
$file=$bt[1][“文件”];
$pos=strrpos($file,'/');
$calling_script=substr($file,($pos+1));
$calling_line=$bt[1][“line”];
settype($retval,“数组”);
$query_start=getmicrotime();
$result=mysqli\u query($mysql\u connect,$query);
$query_end=getmicrotime();
$query\u time=($query\u end-$query\u start);
$total_query_time=$total_query_time+$query_time;
$query\u time\u ms=round($query\u time*1000);
if(!$result){$mysql\u debug\u comments.=“\n\n”;}
如果($结果){
$success=true;
$function_start=getmicrotime();
$row\u count=mysqli\u num\u行($result);

对于($x=0;$x我猜测函数“get\u contenttitle”正在从它未连接的数据库中查找数据。我在另一个函数“db\u query\u into\u array\u enhanced”中没有看到连接或者。是否有连接数据库的功能?如果有,请检查。确保与其中一个工作站点完全相同。

您是否尝试过检查
mysql\u error()
如果将
error\u reporting(E\u ALL)放入;
在代码顶部。显示了什么错误消息?如果我在函数就位的情况下加入错误报告,页面仍然无法加载,并且没有出现错误。如果删除函数,则会出现此错误。以及许多其他警告:mysqli_num_rows()预期参数1为mysqli_result,第82行/var/www/www.lektronix.fr/inc/functions.php中给出的布尔值注意:未定义变量:第84行/var/www/www.lektronix.fr/inc/functions.php中设置的结果警告:mysqli_free_result()预期参数1为mysqli_result,在第84行的/var/www/www.lektronix.fr/inc/functions.php中给出空值。程序设计非常糟糕。避免使用
mysql_
函数和
global
s。您应该尝试PDO。要检查mysql错误,请尝试
mysql_查询($query)或死亡(mysql_error())
是的,还有另一个连接功能,你是对的,IP地址不正确,我更改了它,但什么也没发生。我必须搜索,我发现这个IP在整个网站上都被使用
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;
}