space 在 2 个列名之间,php 来自 sql
space between 2 column names with php from sql
我已经有了 sql 的基本 Concat 想法,但我无法在下拉菜单中的名字和姓氏之间找到 space。代码都可以正常工作,这只是我找不到在名字和姓氏之间给我一个 space 的基本东西。
<option value="" >Valuer of this Property</option>
<?php
$res=mysqli_query($conn, "SELECT CONCAT(first,surname) from listalot_users");
while($row=mysqli_fetch_array($res))
{
?>
<option><?php echo $row['CONCAT(first,surname)']; ?></option>
<?php
}
?>
</select>
<option value="" >Valuer of this Property</option>
<?php
$res=mysqli_query($conn, "SELECT CONCAT(first,' ',surname) as full_name from listalot_users");
while($row=mysqli_fetch_array($res))
{
?>
<option><?php echo $row['full_name']; ?></option>
<?php
}
?>
</select>
像这样更新你的代码:
<option value="" >Valuer of this Property</option>
<?php
$res=mysqli_query($conn, "SELECT CONCAT(first, ' ', surname) as fullname from listalot_users");
while($row=mysqli_fetch_array($res))
{
?>
<option><?php echo $row['fullname']; ?></option>
<?php
}
?>
</select>
我已经有了 sql 的基本 Concat 想法,但我无法在下拉菜单中的名字和姓氏之间找到 space。代码都可以正常工作,这只是我找不到在名字和姓氏之间给我一个 space 的基本东西。
<option value="" >Valuer of this Property</option>
<?php
$res=mysqli_query($conn, "SELECT CONCAT(first,surname) from listalot_users");
while($row=mysqli_fetch_array($res))
{
?>
<option><?php echo $row['CONCAT(first,surname)']; ?></option>
<?php
}
?>
</select>
<option value="" >Valuer of this Property</option>
<?php
$res=mysqli_query($conn, "SELECT CONCAT(first,' ',surname) as full_name from listalot_users");
while($row=mysqli_fetch_array($res))
{
?>
<option><?php echo $row['full_name']; ?></option>
<?php
}
?>
</select>
像这样更新你的代码:
<option value="" >Valuer of this Property</option>
<?php
$res=mysqli_query($conn, "SELECT CONCAT(first, ' ', surname) as fullname from listalot_users");
while($row=mysqli_fetch_array($res))
{
?>
<option><?php echo $row['fullname']; ?></option>
<?php
}
?>
</select>