我是否正确使用mysqli_fetch_row()? 我知道客户名称,我想在同一记录中找到Env_lines值。该客户名称只有一条记录。当我回显$ env_lines时,我没有得到输出。可能是什么问题?
<?php require_once("config.php") ?>
<?php require_once("functions.php") ?>
test
<?php
$customer = 'Bickery';
echo ' <br> 1)'.$customer;
$sql_customer = "SELECT * FROM `Customer` WHERE Cust_Name = '$customer' LIMIT 0,1";
echo ' <br> 2)'.$sql_customer,'<br>';
$customer_selection = mysqli_query($conn,$sql_customer);
var_dump($customer_selection);
$customer_row = mysqli_fetch_row($conn, $customer_selection);
$env_lines = $customer_row["Env_Lines"];
echo ' <br> 3)'.$env_lines;
?>
https://gist.github.com/anonymous/520319ac72e7f08419c4
答案 0 :(得分:2)
<强> Manual Says 强>
混合mysqli_fetch_row(mysqli_result $ result)
这是否显示您需要为其提供连接参考?否
从此处删除您的第一个参数
$customer_row = mysqli_fetch_row($conn, $customer_selection);
^
然后
从结果集中获取一行数据并将其作为枚举数组返回,其中每列存储在从0(零)开始的数组偏移中。对此函数的每次后续调用都将返回结果集中的下一行,如果没有更多行,则返回NULL
这意味着这不是获取关联数组的正确功能, mysqli_fetch_assoc (等等)。
$customer_row = mysqli_fetch_assoc($customer_selection);
哦,PHP的家伙们认为这是我们的职责;在这里