|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
php5 - Selectivly Exclude MYsql entries
so i have a database call where i am excluding specific records (based on a field) and the solution i have works but seems kludgy, anyone know how i can streamline it?
PHP Code:
__________________
29 years of creative writing 13 years of HTML 10 years of Photoshop 6 years of PHP/MySQL And I never knew Photoshop could do HTML until 2004! You learn something new every day. |
|
#2
|
|||
|
|||
|
PHP Code:
That should work... not sure if it would be much faster, but it does clean it up |
|
#3
|
|||
|
|||
|
Quote:
so the IN operator what excludes the values set? |
|
#4
|
|||
|
|||
|
Heh... good point, I'm used to looking for an item in the array... maby NOT IN?
|
|
#5
|
|||
|
|||
|
ya, not in should work.
SELECT * FROM SomeTable WHERE Number NOT IN (0,4,5,7) or if those numbers change and you want to exclude specific rows from another table where certain criteria in that other table is met you can also use NOT IN with a sub query as long as the sub query returns just one column: SELECT * FROM SomeTable WHERE ForeignNumber NOT IN (SELECT TableKey FROM SomeOtherTable WHERE SomeColumn=1) Last edited by IAmALlama : November 5th, 2009 at 03:24 AM. |
|
#6
|
|||
|
|||
|
Thanks! Very helpful.
In the same vein though i have 2 other bits of code that are kinda tricky PHP Code:
I figured i could use IN here by my concern is i need the images in a specific order. The first one uses the DynamicPicsReturn 180 call the next two uses the PicsReturnH 112 call the last 3 use the picsreturnH 74 call in another file i have a if loop thats a bit tricky PHP Code:
Basicly what i want to do is compare the valeu of mainarray 2 to the index key of the post Basicly something like 42 == $_POST['AddtlBylineType'][42] Here's the full function to give you a idea what im trying to do PHP Code:
Last edited by LLX : November 5th, 2009 at 05:03 PM. |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > php5 - Selectivly Exclude MYsql entries |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|