gpt4 book ai didi

php - 为什么这段PHP代码不起作用?

转载 作者:可可西里 更新时间:2023-10-31 23:57:33 24 4
gpt4 key购买 nike

<?php
require_once($_SERVER['DOCUMENT_ROOT'].'/api_config.php');

error_reporting(E_ALL);
ini_set("display_errors", 1);
$loc = $_POST['u'];

//initialize the connection to the database
$config = $config['production'];
$con = mysql_connect($config['db']['host'], $config['db']['username'], $config['db']['password']) or die ("Unable to connect");
mysql_select_db ($config['db']['dbname'], $con) or die ("Unable to select database");
$query = "SELECT `location` FROM `active_users` WHERE name = '$loc'";
$result = mysql_query($query, $con) or die ("Unable to run query");

if (mysql_num_rows($result) > 0) {
// yes, the user esists
header("HTTP/1.0 200 Success");
header('Content-Type: text/plain');
} else
// no, user doesn't exist
header("HTTP/1.0 404 Not Found");
header('Content-Type: text/plain');
}
mysql_close($con);

?>

我的浏览器出现了一个 HTTP Error 500 (Internal Server Error):错误。为什么?

最佳答案

你忘了打开else {

关于php - 为什么这段PHP代码不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6396565/

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