gpt4 book ai didi

php - 如何打印 mysqli_fetch_array 变量

转载 作者:行者123 更新时间:2023-11-29 08:08:09 25 4
gpt4 key购买 nike

while($testing = mysqli_fetch_array($sendPasswordQuery)){
echo "'$testing['name']'";
}

嗨,我知道第二行是错误的,但是我如何打印名称列。提前致谢。

最佳答案

您的第二行需要采用以下格式之一:

echo $testing['name']; // will output Name directly
echo "'{$testing['name']}'"; // will output 'Name' inside a string
echo "'$testing[name]'"; // will output 'Name' in a string,
// however the second example is better practice.

如果您只是回显该变量而不向其添加任何额外的文本,只需使用:

echo $testing['name'];

否则,我建议如下:

echo "Lorem ipsum {$testing['name']} sit amet.";

这将输出:Lorem ipsum Name sat amet。

关于php - 如何打印 mysqli_fetch_array 变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22314755/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com