Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question about 'select' certain elements from database

Status
Not open for further replies.

leeboycymru

Programmer
Jan 23, 2007
185
GB
I have an issue with regard to pulling out only certain objects from a database, which at the moment is pulling everything out.

Here is the code:

$q=mysql_query('select * from tbl_standards order by Id_Stand') or die(mysql_error());
while($r=mysql_fetch_row($q)) { $standards[$r[0]]=array('id'=>$r[0],'name'=>$r[1], 'selected'=>0 ); }

As you can see it's selecting * from tbl_standards and order by Id_Stand, which was ok until I put extra stuff in there, now I need to only bring out certain numbers from Id_Stand.

What I want is to pull out * from Id_Stand numbers, 1,2,4,5,6,7,8,9,10 the rest shouldnt be displayed.

Can anybody help me with this.

lee

 
Hi

This has absolutely nothing to do with PHP. Please post MySQL questions in forum436.
Code:
select * from tbl_standards [red]where id_stand in (1,2,4,5,6,7,8,9,10)[/red] order by Id_Stand

Feherke.
 
Sorry about that, but thank you very much it worked...

Lee

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top