我需要从同一列中选择具有不同值的数据吗? 我如何
select * FROM billingorganization WHERE user_id = $user_id && user_id = 0?
<select name="billing_name">
<?php
$query2 = "SELECT * from billingorganization WHERE user_id = $user_id";
$result2 = mysqli_query($link, $query2) or die(mysqli_error($link));
while ($row3 = mysqli_fetch_array($result2)) {
$billing_name = $row3['billing_name'];
$billing_name_id = $row3['billing_name_id'];
?>
<option value="<?php echo $billing_name; ?>" ><?php echo $billing_name ;?></option>
<?php
}
?>
</select>
答案 0 :(得分:2)
select * FROM billingorganization WHERE user_id = $user_id OR user_id = 0
答案 1 :(得分:1)
您可以使用格式
SELECT ... FROM ... WHERE user_id IN ($userid,0)
它清晰,简洁,优雅。