我有一个4列的mysql表,最左边的是autoincrement列,我想得到一个名为extra
的列的变量值,以获得最高的auto increment值.我相信SQL查询将是:
Select extra FROM motoron2 ORDER BY id DESC LIMIT 1"
$conn = new mysqli('localhost', 'myuser', 'mypass', 'mydb');
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT extra FROM motoron2 ORDER BY id DESC LIMIT 1";
$stmt = $conn->prepare($sql);
$stmt->execute();
$result = $stmt->get_result(); // get the mysqli result
$variablevalue = $result->fetch_assoc(); // fetch the data
echo "The variable is converted to a string and its value is $variablevalue.";
// set parameters and execute
当我try echo "The variable is converted to a string and its value is $variablevalue."
时,我看到:The variable is converted to a string and its value is Array
我希望在这里看到一个整数,我做错了什么?