Page 2 of 2
Posted: Sun May 11, 2003 8:54 pm
by Lonewolf
ok how do i post more then 1 row, i try to go $sql = "SELECT memb_username, memb_first , memb_email , memb_pass , memb_last ,memb_extra,memb_id FROM ss_users WHERE memb_country=0,1,2,3";
and it says Invalid query: You have an error in your SQL syntax near '1,2,3,4,5,6' at line 1
what do i put, do i have to make a loop?
Posted: Sun May 11, 2003 9:06 pm
by volka
http://www.mysql.com/doc/en/Comparison_ ... ml#IDX1142
Code: Select all
SELECT ... WHERE memb_country IN (0,1,2,3)
or in this case
Code: Select all
SELECT ... WHERE memb_country BETWEEN 0 AND 3
That most certainly will return more that one record. You have to fetch and process them one by one, e.g. by
Code: Select all
if (mysql_num_rows($result) == 0)
echo 'no records match the conditions';
else
{
while($row = mysql_fetch_array($result))
{
$first=$row['memb_username'];
$last=$row['memb_last'];
$id=$row['memb_id'];
$country=$row['memb_country'];
$first=$row['memb_first'];
$email=$row['memb_email'];
$extra=$row['memb_extra'];
echo "<b>$first $last</b><br>extra:$extra<br>";
}
}