Forum Moderators: open

Message Too Old, No Replies

MySql Search Query Help

         

madk

8:03 pm on Jan 15, 2007 (gmt 0)

10+ Year Member



Please bear with me as I my knowledge right now is limited to basic select queries.

I am currently working on a basic site that stores articles into 2 seperate tables. One is called posts and the other is called features. Both tables are identical in structure and contain about 200 rows each.

Up to now we have given the readers the choice to either search 'Articles' or search 'Features'. Well now I would to combine the results.

So I need to write a query that search both tables using a user defined search term and output the results ordered by the datetime stamp.

Also while we are at it...how exactly would I protect myself from an attack since I am using form input for the search term.

Any information would be greatly appreciated! Thank you.

FalseDawn

6:33 am on Jan 16, 2007 (gmt 0)

10+ Year Member



Search results can be easily combined using the UNION clause
[dev.mysql.com...]

See
[us2.php.net...]
for the preferred method to help prevent sql injection attacks.