| issue with Search feature using MySQL and PHP [message #2923] |
Wed, 09 April 2008 18:09  |
pulse88 Messages: 4 Registered: April 2008 |
Junior Member |
|
|
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
|
|
|
|
|
| Re: issue with Search feature using MySQL and PHP [message #2927 is a reply to message #2926 ] |
Wed, 09 April 2008 23:48   |
debug Messages: 132 Registered: March 2008 |
Senior Member |

|
|
Heh, actually you can store image in database (take image file, base64 encode it, and store in database), but it is not very good for high performance.
More often images are stored in separate folder, and database has list of images and files names. You can use incrementing id, or some function which generates filename based on date and random functions, and so on.
What about uploading images - please see http://ru2.php.net/manual/en/features.file-upload.php about file upload in PHP. As you want to store list of images in database, you should do one database insert after file upload is completed.
Mikhail Solovyev, MySQL Performance Expert
MySQL Performance Blog
MySQL Consulting
|
|
|
|
|
| Re: issue with Search feature using MySQL and PHP [message #2930 is a reply to message #2929 ] |
Thu, 10 April 2008 02:03  |
pulse88 Messages: 4 Registered: April 2008 |
Junior Member |
|
|
whew!...finally.
I was trying exactly what you told me. and that was a good start. It made sense but didn't work exactly.
After several searches on CSS examples and an hour of work, I used <span> tags instead which did wonders!
i finally get to sleep now...
hey, thanks for the continuous help. I'll be bugging you guys more over the week/end.
|
|
|