我也从 Unity 3d 内部的 C# 脚本发送数据。我想要做的是让页面显示我最终从中运行的任何查询的结果,并在 Unity 内部获取该页面的文本并显示它。这是一种非常笨拙的方法,但我只是从 PHP 和 mysql 开始 这是 unity 3d 给我的错误“警告:mysql_result():提供的参数不是 WEBSITE.com/newget 中的有效 MySQL 结果资源.php 在第 30 行"
<?php
$db = mysql_connect('host, user, pass') or die('Could not connect: ' . mysql_error());
mysql_select_db('dbname') or die('Could not select database');
$gotString = mysql_real_escape_string($_GET['GetString'], $db);
$hash = $_GET['hash'];
//SELECT * FROM table_name
$real_hash = md5($gotString . $secretKey);
$secretKey = "KeyHERE";
$real_hash = md5($gotString . $secretKey);
$locString = "SELECT A FROM Quiz1 WHERE Question = 1";
if ($real_hash == $hash) {
Compare();
}
function Compare() {
if ($gotString == "1B") {
$result = mysql_query("SELECT B FROM Quiz1 WHERE Question = 1") or die(mysql_error());
} else {
$result = mysql_query("SELECT A FROM Quiz1 WHERE Question = 1") or die(mysql_error());
}
}
print( $result);
?>