issue with Search feature using MySQL and PHP

hey all,
I’m a newbie with mysql and php as well as this site. I came here as a last resort to find a solution to a small independent project that I’m working on.

Background:
I have a MySQL database created/filled and I’m using php to connect to the db. I’m currently working on the search feature on the site. This is new to me so I’m running into some errors.

Problem:
I want to be able to input any text for search (ignoring the security risks with that at this point for testing) and have it search all the columns of the table, so basically I got stuck on the WHERE clause in the query. I know that I can use WHERE a_column LIKE “%$srchtxt%” OR another_column LIKE “%$srchtxt%” etc…
But doing this I could only put three/four OR operands after which I’ll get an error that says: " mysqli_fetch_row() expects parameter 1 to be mysqli_result.

I thought there’s a certain way to do this, so I have limited info here otherwise I can put more code/info.

Thanks for your time,
-me

I can recommend you first do the following: make your PHP script output query on screen. And then run this query in MySQL client manually. I do not think that 3-4 OR statements is the limit, but most probably there is some syntax error in the query. Please try this and let me know.

hey thanks, man!

yes, it was a minor syntax error. u have to be an idiot to believe that MySQL has limits like that huh.haha. O’ the newbies!

so, the search feature is working just fine. and the question can be considered answered

While I’m at it. let me ask another question:
what is the best way to handle a set of pictures (that could potentially be sent by ANY user online) to be stored/accessed in the database. I understand that you can’t store an image! but what other options are there:

There’s only one i can think of:
use an auto increment ID as a reference and save all the files as 1.jpg, 2.jpg, so on…tedious but probably works. Then again, how does a user send a picture to be stored to the database through some kind of form? any ideas?