gpt4 book ai didi

php - 查询使我的页面没有响应

转载 作者:行者123 更新时间:2023-11-29 13:48:41 24 4
gpt4 key购买 nike

我不知道为什么,但我下面的 MySQL 查询使我的页面没有响应,并且我收到一个框,说此页面已变得无响应。我想知道确保这种情况不会发生的最简单方法是什么。

public function audioplayer($id)
{
$r_hostname = "192.***.**.***";
$r_username = "c**";
$r_password = "*******";
$link = mysql_connect($r_hostname,$r_username,$r_password);

$a_hostname = "192.168.***.***";


$db = mysql_select_db('asterisk', $link);

$result = mysql_query("SELECT * FROM recording_log WHERE start_time LIKE '".date("Y-m-d")."%' AND filename LIKE 'IL_%-%". $id ."' LIMIT 3",$link);


#$result = mysql_query("select * from recording_log WHERE filename LIKE 'IL_%-%".$id."'",$link);

if (!$result) {
die('Invalid query: ' . mysql_error());
}
if($result != '')
{
while($row = mysql_fetch_array($result, MYSQL_ASSOC)){
foreach($row as $column => $value) {
$array[type] ="wav";
$array[$column]= $value;
}
}
}
else {
$linktwo = mysql_connect($a_hostname,$r_username,$r_password);

$dbtwo = mysql_select_db('asterisk', $linktwo);

$resulttwo = mysql_query("SELECT * FROM recording_log WHERE start_time LIKE '".date("Y-m-d")."%' AND filename LIKE 'IL_%-%". $id ."' LIMIT 3",$linktwo);

while($row = mysql_fetch_array($resulttwo, MYSQL_ASSOC)){
foreach($row as $column => $value) {
$array[type] ="mp3";
$array[$column]= $value;
}
}
}
return json_encode($array);
}

最佳答案

感觉这里有语法错误:

$array[type] ="mp3";

您的意思是:

$array[$type] ="mp3";
$array["type"] ="mp3";

Please, don't use mysql_* functions in new code. They are no longer maintained and are officially deprecated. See the red box? Learn about prepared statements instead, and use PDO, or MySQLi - this article will help you decide which. If you choose PDO, here is a good tutorial.

关于php - 查询使我的页面没有响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17035425/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com