php mysql search

Posted by mckenzie on Stack Overflow See other posts from Stack Overflow or by mckenzie
Published on 2010-03-27T08:46:49Z Indexed on 2010/03/27 8:53 UTC
Read the original article Hit count: 239

Filed under:
|

Hello,

My code contain

SELECT * FROM newchap WHERE company LIKE '%$company%' OR  Category LIKE '%$cat%'

It works perfectly however, when the field $company contain empty, it return all result in MYSQL.

How to prevent it?

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql