deejay Posted April 4, 2003 Share Posted April 4, 2003 I realise that this subject has already many post on it, its just I cant seem to get my head around it :? i have a table called \'cctvcity\' and inside that tables called \'products\', \'product_pages\', \'products_attributes\' and \'products_description\'. Say for example if I want to search for my keyword in the \'title\' or \'main_desc\' field of \'product_pages\' then what is wrong with this code. <?php \"SELECT * FROM cctvcity.products,cctvcity.product_pages,cctvcity.products_attributes,cctvcity.products_description WHERE product_pages.title LIKE \'%$search_keyword%\' OR product_pages.main_desc LIKE \'%$search_keyword%\' ORDER BY ASC \"; ?> thank you for any light you may be able to throw on this. Deej Quote Link to comment https://forums.phpfreaks.com/topic/302-searching-multiple-tables-and-fields/ Share on other sites More sharing options...
shivabharat Posted April 4, 2003 Share Posted April 4, 2003 Now ur quesry looks fine U havent said much about the error or the output u get using the statement? can u tell us more about it!! Quote Link to comment https://forums.phpfreaks.com/topic/302-searching-multiple-tables-and-fields/#findComment-941 Share on other sites More sharing options...
shivabharat Posted April 4, 2003 Share Posted April 4, 2003 SELECT * FROM cctvcity.products,cctvcity.product_pages,cctvcity.products_attributes,cctvcity.products_description WHERE product_pages.title LIKE \'%$search_keyword%\' OR product_pages.main_desc LIKE \'%$search_keyword%\' ORDER BY give ur field name here ASC \"; Quote Link to comment https://forums.phpfreaks.com/topic/302-searching-multiple-tables-and-fields/#findComment-942 Share on other sites More sharing options...
deejay Posted April 4, 2003 Author Share Posted April 4, 2003 sorry, it fails on \'\'error making query\' $query = \"SELECT * FROM cctvcity.products,cctvcity.product_pages,cctvcity.products_attributes,cctvcity.products_description WHERE product_pages.title LIKE \'%$search_keyword%\' OR product_pages.main_desc LIKE \'%$search_keyword%\' ORDER BY ASC \"; $searchResults = mysql_query($query) or die(\'error making query\'); Quote Link to comment https://forums.phpfreaks.com/topic/302-searching-multiple-tables-and-fields/#findComment-944 Share on other sites More sharing options...
shivabharat Posted April 4, 2003 Share Posted April 4, 2003 See my posting U havent given the filed name after order by \"filed_name\" asc Quote Link to comment https://forums.phpfreaks.com/topic/302-searching-multiple-tables-and-fields/#findComment-946 Share on other sites More sharing options...
deejay Posted April 4, 2003 Author Share Posted April 4, 2003 :oops: how much of an idiot do i feel. cheers mate, sorted now. Quote Link to comment https://forums.phpfreaks.com/topic/302-searching-multiple-tables-and-fields/#findComment-950 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.