我正在尝试使用下面的代码获取MySQL数据,但似乎有些错误。任何人都可以帮忙。谢谢!
<?php
$link = mysqli_connect("localhost", "myusername", "mypassword", "mydb") or die("Error " . mysqli_error($link));
$query = "SELECT * FROM users WHERE id=2";
$res = mysqli_query($link, $query);
$userRow = mysql_fetch_array($res);
echo $userRow["user_firstname"];
?>
答案 0 :(得分:1)
谢谢@Mario
<?php
$link = mysqli_connect("localhost", "myusername", "mypassword", "mydb") or die("Error " . mysqli_error($link));
$query = "SELECT * FROM users WHERE id=2";
$res = mysqli_query($link, $query);
$userRow = mysqli_fetch_array($res);
echo $userRow["user_firstname"];
?>