[英]How to print a mysqli_fetch_array variable
while($testing = mysqli_fetch_array($sendPasswordQuery)){
echo "'$testing['name']'";
}
嗨,我知道第二行是錯的,但我如何打印名稱列。 提前致謝。
很多引號,所有這些引號都在變量之外是不必要的:
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 sit amet.
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.