gpt4 book ai didi

php - 返回错误 mysqli_query() expects parameter 1 to be mysqli, null given for steam login

转载 作者:行者123 更新时间:2023-11-29 05:15:19 25 4
gpt4 key购买 nike

<分区>

Warning: mysqli_query() expects parameter 1 to be mysqli, null given

嘿,一直收到这个错误,不知道为什么。这是 Steam 登录的代码,我已经看到这个错误在这里发布了一堆,但似乎无法找到任何具体的东西,如果你能链接以前的答案/帮助会很棒。

foreach ($json_decoded->response->players as $player)
{
$sql_fetch_id = "SELECT * FROM users_steam WHERE steamid = '$player->steamid'";
$query_id = mysqli_query($db, $sql_fetch_id);

$_SESSION['name'] = $player->personaname;
$_SESSION['steamid'] = $player->steamid;
$_SESSION['avatar'] = $player->avatar;

if (mysqli_num_rows($query_id) == 0) {
$sql_steam = "INSERT INTO users_steam (name, steamid, avatar) VALUES ('$player->personaname', '$player->steamid', '$player->avatar')";
mysqli_query($db, $sql_steam);
}
}

$db来自包含有代码的db.php

<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "my_db");

if (!$link) {
echo "Error: Unable to connect to MySQL." . PHP_EOL;
echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL;
echo "Debugging error: " . mysqli_connect_error() . PHP_EOL;
exit;
}

mysqli_close($link);
?>

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