Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/302-searching-multiple-tables-and-fields/
Share on other sites

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 \";

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\');

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.