gpt4 book ai didi

php - localhost 当前无法处理此请求。运行特定代码时出现 HTTP ERROR 500

转载 作者:行者123 更新时间:2023-11-29 17:56:22 32 4
gpt4 key购买 nike

更新:我发现 $event_start_date = strtotime($row['event_start_date']));$event_end_date = strtotime($row['event_end_date'])) ; 给出了错误。

我目前正在为我的任务创建一个事件管理网站。我收到此 localhost 当前无法处理此请求。每当使用这段代码时,都会出现 HTTP ERROR 500 。当我删除它时,它运行得很好。但奇怪的是,当我在 Mozila 中运行它时,它只显示一个白色的空白页面,而在 chrome 中运行它时,它会给我这个错误。顺便说一句,我使用 Uniserver 作为本地主机。

<?php
$query = "SELECT * FROM events ;";

$db_name = "em";
$db_host = "127.0.0.1";
$db_username = "root";
$db_password = "root";

if( !($database_connection = mysql_connect($db_host, $db_username, $db_password)))
{
die ("Error : Could not connect to database.");
}


if( !mysql_select_db($db_name, $database_connection))
{
die ("Error : Could not open the database.");
}


if ( !($result = mysql_query( $query, $database_connection)) )
{
print("Error : Could not execute query.");
die(mysql_error());
} else
{
$count = mysql_num_rows($result);

while($row = mysql_fetch_array($result)) {
$event_id = $row['event_id'];
$event_name= $row['event_name'];
$event_description=$row['event_description'];

$event_venue = $row['event_venue'];
$event_start_date = strtotime($row['event_start_date']));
$event_end_date = strtotime($row['event_end_date']));
//$ticket_type = $row['event_ticket_type'];
$event_price = $row['event_ticket_price'];
$event_account = $row['event_account'];
$event_image = $row['event_image'];
$event_bank = $row['event_bank'];



echo ' <div class="eventbox">
<div class="eventimage">
<img src="'.$event_image.'" href="" class="eventimagefill">
</div>

<div class="eventcontent">
<h6 style="margin:0px; padding: 0px;color:#303A40;">'.date("F j, Y, g:i A", $event_start_date).'</h6>
<h3 style="margin: 0px; padding: 0px; margin-top:5px;color:#303A40;">'.$event_name.'</h3>
<h5 style="float:right;margin-top:-25px; margin-right:30px;padding: 0px;color:#fe8c00;font-size:1.2em;">';

if($event_price == "0.00")
{
echo "FREE";
} else
{
echo 'RM '.$event_price;
}



echo '</h5>

</div>

</div>';

}

}

mysql_close($database_connection);

?>

最佳答案

 $event_start_date = strtotime($row['event_start_date']));
$event_end_date = strtotime($row['event_end_date']));

i think you have give here two brackets

$event_start_date = strtotime($row['event_start_date']);
$event_end_date = strtotime($row['event_end_date']);

关于php - localhost 当前无法处理此请求。运行特定代码时出现 HTTP ERROR 500,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48780491/

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