api에 연결하여 기부 시스템에서 사용자를 얻은 다음 게임 소켓을 열어 사용자에게 기부 한 금액을 자동으로 제공하려고합니다. "SQL 구문에 오류가 있습니다. 올바른 구문은 1 행에서 '$ r'근처에서 사용하도록 MySQL 서버 버전에 해당하는 설명서를 확인하십시오"내 mysql 연결에 오류가 발생합니까?
문제가 무엇인지 알 수없는 것 같습니다. 나는 사용자가 이미 자신의 항목을 지정한 경우에 데이터베이스에 추가하여 자신의 순위와 항목을 부여되었는지 확인하기 위해 노력하고있어
<?php
$tablename="CENSORED";
$DBUSER="CENSORED";
$DBPASSWORD="CENSORED";
$DBHOST="CENSORED";
?>
<?php
$urlMask = 'CENSORED';
$getUser = function($id) use ($urlMask) {
list($user) = json_decode(file_get_contents(sprintf($urlMask, $id)));
return (object) $user;
};
$user = $getUser(4087396);
$Username = $user->user->username;
$Rank = $user->item_name;
$IGN = $user->custom_field;
echo '<center> Your username is '.$IGN.' correct? </center> ';
?>
<?php
if(isset($_POST['Clickbutton'])){
$con = mysql_connect($DBHOST,$DBUSER,$DBPASSWORD);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db($tablename, $con);
$sql="SELECT IGN FROM fisktable WHERE IGN='$IGN' and Rank='$Rank'" ;
$r = mysql_query($sql);
if(!$r) {
$err=mysql_error();
print $err;
}
$result = mysql_query('$r') or die(mysql_error());
if(mysql_num_rows($result) == 1) {
echo 'That username has already been given their rank!';
} else {
$HOST = "77.45----"; //the ip of the bukkit server
$password = "chdfxfdxh";
//Can't touch this:
$sock = socket_create(AF_INET, SOCK_STREAM, 0)
or die("error: could not create socket\n");
$succ = socket_connect($sock, $HOST, 4445)
or die("error: could not connect to host\n");
//Authentification
socket_write($sock, $command = md5($password)."<Password>", strlen($command) + 1)
or die("error: failed to write to socket\n");
//Begin custom code here.
socket_write($sock, $command = "/Command/ExecuteConsoleCommand:pex user ($IGN) group set ($Rank);", strlen($command) + 1) //Writing text/command we want to send to the server
or die("error: failed to write to socket\n");
socket_write($sock, $command = "Thanks, ($IGN) for donating to the ($Rank) rank! ;", strlen($command) + 1)
or die("error: failed to write to socket\n");
mysql_select_db($tablename, $con);
$sql="INSERT INTO $tablename(IGN,Rank) VALUES ('$IGN','$Rank')" ;
exit();
}}
?>
<center>
<form method="POST">
<input name="Clickbutton" type="submit" value="Yes! I would like to receive my rank!"/>
</form>
</center>
: 여기에 스크립트입니다. 그리고 나서 그들이 두 번 해보려한다면 그들은 이미 자신의 계급이 주어 졌다는 오류를 받게 될 것입니다!
다른 문제가 있거나 유능한 문제가있는 경우 자유롭게 지적하십시오. 감사합니다.
쿼리 편집기에서 sql 문을 실행할 수 있습니까? 선택한 열의 데이터 유형은 무엇입니까? – Robert
거기에 암호가 남아있는 것 같습니다. 암호를 지킬 계획이라면 암호를 변경해야 할 것입니다. – ChrisK
그냥 2 개의 텍스트 열 – Wth123