0

hi all i have search engine like that:

sql = "SELECT * FROM ads WHERE ad_country='7' and approve='1' and ad_name LIKE '%iphone%' or ad_country='7' and approve='1' and ad_content LIKE '%iphone%' ORDER BY ad_date DESC LIMIT 0,30";

and it's work great but it is too long.

are there any sample way or another easy format?
thanks.

Edited by haithomy: edit some words

3
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by dipakatcvrca
0

ok I found this:
sql = "SELECT * FROM ads WHERE ad_country='7' and approve='1' and (ad_name LIKE '%iphone%' or ad_content LIKE '%iphone%') ORDER BY ad_date DESC LIMIT 0,30";

is that the sample way or there is another thanks.

0

What do you mean with "too long"? Does the query take to long? Add indexes to the fields ad_country and approve.

0

ok I found this:
sql = "SELECT * FROM ads WHERE ad_country='7' and approve='1' and (ad_name LIKE '%iphone%' or ad_content LIKE '%iphone%') ORDER BY ad_date DESC LIMIT 0,30";

is that the sample way or there is another thanks.

I guess this(the second query you have written) is the optimized form of query, that you were wishing to have. You can carry out with this. :)

Edited by dipakatcvrca: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.