我在PHP中收到此警告
警告:sqlsrv_query()要求参数1为resource,boolean 在第7行的C:\ xampp \ htdocs \ change_logo_proccess.php中给出
警告:sqlsrv_fetch_array()期望参数1是资源, 第8行的C:\ xampp \ htdocs \ change_logo_proccess.php中给出的布尔值
警告:sqlsrv_query()要求参数1为resource,boolean 在第14行的C:\ xampp \ htdocs \ change_logo_proccess.php中给出 公会徽标已设置。注意:此更新可能会在之后生效 24小时或服务器重启后!
这是我的代码:
<?php
include_once ("include/config.php");
$connectionInfo = array("Database" => "RohanGame", "UID" => $UID, "PWD" => $PASS);
$conn = sqlsrv_connect($serverName, $connectionInfo);
if ($_POST['group1'] == "1") {
$sql = "select master_id from dbo.TNGuildMark where master_id = (select master_id from dbo.TNGuild where name = '$_POST[gbox]')";
$stmt = sqlsrv_query($conn, $sql);
if ($rows = sqlsrv_fetch_array($stmt)) {
$sql1 = "update dbo.TNGuildMark set mark = 0xff where master_id = (select master_id from dbo.TNGuild where name = '$_POST[gbox]')";
$stmt1 = sqlsrv_query($conn, $sql1);
echo "Your Guild Logo Has Been Set .NOTICE: This update might take effect after 24 hrs OR after server restart!";
} else {
$sql2 = "insert into dbo.TNGuildMark(mark,master_id) select 0xff, master_id from dbo.TNGuild where name = '$_POST[gbox]'";
$stmt2 = sqlsrv_query($conn, $sql2);
echo "Your Guild Logo Has Been Set .NOTICE: This update might take effect after 24 hrs OR after server restart!";
}
}