Welcome to WebmasterWorld Guest from 54.161.110.186

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

mySQL Where In function

     
5:54 am on Jan 9, 2003 (gmt 0)

10+ Year Member



Hi Experts,

Can anybody tell me how to use
mySQL WHERE IN function in PHP

// this is HTML code
<select size="6" name="Categories[]" multiple>
<option value="0" selected>[ -- Select Categories --]
<?
while ($items=mysql_fetch_array($result))
{
?>
<OPTION VALUE="<? echo $items['CategoryID']?>"><? echo $items['Categories']?></OPTION>
<?
}
?>
</SELECT>

///what will be a query using IN function of mySQL
Thanks in Advance

6:03 am on Jan 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi!

WHERE IN your post is the query at all?

you can use the keyword IN for grouping in a WHERE-clause. If you would send the query in, it might be less difficult to help you.

2:31 pm on Jan 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld [webmasterworld.com] itspram.

Be sure to read Marcia`s WebmasterWorld Welcome and Guide to the Basics [webmasterworld.com] post.

Have a look at the documentation for Comparison Operators [mysql.com] at mysql.com.

To execute MySQL queries in PHP use the mysql_query [php.net] function.

Andreas

3:15 pm on Jan 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



i maybe was a little harsh with my answer. i feel sorry for this. if i would knew more about what was the intention itspram, what he wants to know with a little bit more detail, i'm willing to help.
5:56 pm on Jan 9, 2003 (gmt 0)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member



welcome to WebmasterWorld itspram

something like this maybe?

$wherein = "select CategoryID,Categories from table where CategoryID in (1,3,5,7)";
$result = mysql_query($wherein);
while ($items=mysql_fetch_array($result))
{
?>
<OPTION VALUE="<? echo $items['CategoryID']?>"><? echo $items['Categories']?></OPTION>
<?
}
?>
</SELECT>

 

Featured Threads

Hot Threads This Week

Hot Threads This Month