• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Serach form SELECT query

Serach form SELECT query 12 years 2 months ago #21653

  • it050
  • it050's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 5
Hi, I'm creating a search form and need assistance building my query. When the submitted text matches any items in the table I'd like to list those items, otherwise I'd like to display a "no results match your query" public message (and while I'm development this search form I'd like to display the SQL error message, because at the moment I only get a meaningless blank page.)
The form has a textbox named: "phrase".
In the 'Thank you' page I'd like to show the search results matching what was entered into "phrase".
Here is a rough of the script I'll need, but obviously it doesn't work.
$db =& JFactory::getDBO();

$query = " SELECT * FROM table_name WHERE phrase = 'submitted text' ";

$db->setQuery($query);

try {
$result = $db->query();
} catch (Exception $e) {
// Catch the error.
}
This is only the start of more complex search queries I'll be making on this form, so the RSForm submission module will not suit my needs.
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!