gpt4 book ai didi

PHP 如果 SteamID 等于 MYSQL 行

转载 作者:行者123 更新时间:2023-11-29 21:37:35 25 4
gpt4 key购买 nike

这不会起作用。我正在尝试如下。

if (($row["steamid"]) == $steamprofile['steamid']){

下面是完整的代码片段。

<?php
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$eh = $steamprofile[steamid];
$sql = "SELECT steamid FROM Main";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
if (($row["steamid"]) == $steamprofile['steamid']){
echo "SteamID Is Equal and Created!";
}

}
} else {
echo "Nope?";
}

$conn->close();
?>

我尝试过各种方法。

最佳答案

// Create connection
$conn = new mysqli("localhost", "root", "", "stackoverflow");
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
//assume 1
$steamprofile['steamid']=1;

// changes here single quote
$eh = $steamprofile['steamid'];

$sql = "SELECT steamid FROM Main";

$result = $conn->query($sql);
if ($result->num_rows > 0)
{
// output data of each row
while($row = $result->fetch_assoc())
{
if (($row["steamid"]) == $steamprofile['steamid']){
echo "SteamID Is Equal and Created!";
}

}
} else {
echo "Nope?";
}

$conn->close();
?>

输出是SteamID 相等且已创建!

Mysql数据库------------如果不存在则创建表 main (steamid int(11) NOT NULL, 名称 varchar(500) NOT NULL) ENGINE=InnoDB AUTO_INCRMENT=3 默认字符集=latin1;

--

--转储表main

的数据

插入main(steamidname)值(1,'测试1'),(2, '测试2');

关于PHP 如果 SteamID 等于 MYSQL 行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34796171/

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