homepage Welcome to WebmasterWorld Guest from 54.196.69.189
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderators: physics

Databases Forum

    
New-B need help with SELECT. JOIN. WHERE
I don't know how to use WHERE with JOIN
erroronexit




msg:4038686
 1:37 pm on Dec 7, 2009 (gmt 0)

I have a little MySQL query that works well:

SELECT * FROM parts
JOIN bom ON parts_idparts = idparts
LIMIT 250

Does exacly what I want, well, so far. Now I like to filter the data from 'parts' with a FORM.

I like to squeeze in the string:

WHERE
type LIKE '%{$_POST['such']}%' OR
description LIKE '%{$_POST['such']}%' OR
value LIKE '%{$_POST['such']}%'

How I can use this?

 

LifeinAsia




msg:4038827
 4:34 pm on Dec 7, 2009 (gmt 0)

You just need to scope any ambiguous columns. FOr example:
SELECT *
FROM parts
JOIN bom ON parts_idparts = idparts
WHERE parts.type LIKE '%{$_POST['such']}%' OR
parts.description LIKE '%{$_POST['such']}%' OR
parts.value LIKE '%{$_POST['such']}%'
LIMIT 250

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Databases
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