homepage Welcome to WebmasterWorld Guest from 54.237.134.62
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
mySQL Where In function
itspram




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

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

 

hakre




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

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.

andreasfriedrich




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

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

hakre




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

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.

jatar_k




msg:1282964
 5:56 pm on Jan 9, 2003 (gmt 0)

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>

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved