而不是使用String delimiter,在第7行还有其他方法吗?
$q = "SELECT * FROM user";
$res = mysqli_query($conn, $q) or die(mysql_error());
$userList = "";
while($user = mysqli_fetch_array($res)) {
$userList .= $user['userList'].";;";
}
echo $userList;
答案 0 :(得分:0)
$userList .= $user['userList'].";;";
表示名为userList的变量将附加查询结果。在每个结果之后你附加“;;”因为这个时期。
如果你不想追加;;执行以下操作:
$q = "SELECT * FROM user";
$res = mysqli_query($conn, $q) or die(mysql_error());
$userList = "";
while($user = mysqli_fetch_array($res)) {
$userList .= $user['userList'];
}
echo $userList;