我希望将此更新从MySQL更新到MySQLi但是这样做时我一直遇到错误。 基本上,这是我从其他页面上的链接创建的动态页面的一大块代码。
$connect = mysql_connect('localhost', 'root', 'Password');
$select_db = mysql_select_db('playerslog');
$id = mysql_real_escape_string($_GET['UUID']);
//Remove LIMIT 1 to show/do this to all results.
$query = 'SELECT * FROM `playerslog` WHERE `UUID` = '.$id.' LIMIT 1';
$result = mysql_query($query);
$row = mysql_fetch_array($result);
// Echo page content

有关如何实现这一目标的任何建议?谢谢你的时间!
按要求更新。
<?php
$connect = mysqli_connect('localhost', 'root', 'Password');
$select_db = mysqli_select_db('playerslog');
$id = mysqli_real_escape_string($_GET['UUID']);
//Remove LIMIT 1 to show/do this to all results.
$query = 'SELECT * FROM `playerslog` WHERE `UUID` = '.$id.' LIMIT 1';
$result = mysqli_query($query);
$row = mysqli_fetch_array($result);
// Echo page content
?>
&#13;
答案 0 :(得分:1)
你不能简单地用mysqli_ *替换mysql_ *。它们具有不同的语法。 例如,您应该修复执行查询的方式。 Mysqli需要两个参数:连接然后查询。您只传递查询:
<?php
$connect = mysqli_connect('localhost', 'root', 'Password');
$select_db = mysqli_select_db('stats');
$id = mysqli_real_escape_string($_GET['UUID']);
//Remove LIMIT 1 to show/do this to all results.
$query = 'SELECT * FROM `playerslog` WHERE `UUID` = '.$id.' LIMIT 1';
$result = mysqli_query($connect, $query);
$row = mysqli_fetch_array($result);
// Echo page content
?>