Hello i want improve my search page
i am using this query to search in posts by post title or post content
SELECT * FROM posts
WHERE post_title rlike $this->secure($_GET['p_title'])
OR post_content rlike $this->secure($_GET['p_title']);
i want sort posts
i want to print posts that i got by post_title first
and then print the posts that i got by post_content
should i use two querys to sort them? and if so. How to merge two mysql querys?
You can merge the results of two queries using the
UNIONoperator (Docu link) like the following:I inserted a column
toBeOrderedto reflect your desired sorting.