Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

mySQL Where In function

Codes here !

Moderators: macek, egami, gesf

mySQL Where In function

Postby itspram » Wed Jan 08, 2003 9:45 pm

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
itspram
New php-forum User
New php-forum User
 
Posts: 2
Joined: Wed Jan 08, 2003 5:01 am

Postby Elena Mitovska » Wed Jan 08, 2003 11:12 pm

WHERE IN expression of MYSQL is used in queries: so use this expressione in query that you use to create variable $result,
for example,

$result=mysql_query("Select CategoryID, Categories from my_table where CategoryID IN (..,..,..,...) ");


Write, please, if I understood your problem correctly.
Elena Mitovska
New php-forum User
New php-forum User
 
Posts: 13
Joined: Tue Nov 12, 2002 12:11 pm
Location: Ukraine

Re: where In

Postby itspram » Thu Jan 09, 2003 12:15 am

Exactly,

You have understood it but instead of (..,..,..,..,)
I want to pass variable called from HTML form.

Thanks
itspram
New php-forum User
New php-forum User
 
Posts: 2
Joined: Wed Jan 08, 2003 5:01 am


Return to mySQL & php coding

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron