MultiSearch

50 posts by 11 authors in: Forums > CMS Builder
Last Post: August 14, 2012   (RSS)

By Djulia - March 24, 2009 - edited: March 24, 2009

Thanks for your answer.

I obtain this error if the value of fieldname_min and fieldname_max is not numeric.

getRecords(my_table) MySQL Error: You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the right
syntax to use near ') AND (`price`+0 <= )) AND my_table.hidden = 0
ORDER BY price ASC LIM' at line 3

For example, this URL will cause the error : search.php?prix_min=minimum&prix_max=maximum

There is a possibility to remove this error message ?

Thanks,

Djulia

Re: [Djulia] MultiSearch

By ross - March 25, 2009

Hi Djulia

In a situation where you need to search for "minimum" or "maximum", you are actually better off to leave it blank. That will have the effect you are looking for.

If you are using a form to get to this url, try adding a value="" attribute to the option tags for minimum and maximum like this:

<option value="">Minimum</option>

<option value="">Maximum</option>

Let me know if that makes sense :).
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

Re: [ross] MultiSearch

By Djulia - March 25, 2009 - edited: March 25, 2009

Hi Ross,

Thanks for your answer.

In fact I use a input text and it is impossible to prohibit the user from entering of the text.

<input type="text" name="prix_min" class="form_input" />
<input type="text" name="prix_max" class="form_input" />

Also, there would be a solution for to mask the Mysql error ?
To obtain an error message like : you must enter a value numeric.

I tried to use error_reporting(0); but that function not. [:(]

Thanks for your suggestion.

Djulia

Re: [Djulia] MultiSearch

By ross - March 26, 2009

Hi

From my experience, price searching always works better with drop downs. That way, you have way better control over the values your visitors can enter. Things like dollar signs and commas are always going to be a factor if you let them enter everything themselves.

My recommendation is to convert these two text fields to drop down menus.

That should clear everything up :).
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

Re: [ross] MultiSearch

By Djulia - March 26, 2009

Hi Ross,

Thanks for your answer.

In fact, it is our site of presentation and the user can make many tests.
The design is also very important and it is difficult to use your solution.

Also, we perhaps will use JavaScript to make the checking. [:(]

Djulia

Re: [richo] MultiSearch

By ross - March 27, 2009

Hi John

You'll actually need to ask your webhost to make changes in the php.ini file. Just send them and email and ask that the max upload size be increased to 8MB.

Keep me up to date with how you are making out :).
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

Re: [ross] MultiSearch

By Djulia - March 27, 2009

Hi Ross,

You are certain that the answer was for this post ?

Excuse me, but I do not see the relationship with the function of research.

You are certain that this modification on the server will mask this Mysql error ?

Thanks,

Djulia

Re: [Djulia] MultiSearch

By ross - March 27, 2009

Hi Djulia

My last post was a reply to someone else. Although, now that I check it again, Dave already replied to that one anyway. You can see who I am replying to in the name of the post:

Re: [Djulia] MultiSearch

Anyway. I am not quite sure what you meant in your last post. Are you saying you would rather have the date fields on your search form set as text boxes?

Let me know ;)
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

By Mikey - August 22, 2010

Dave,
In the code below, you'll see the last $searchTables is for searching information related to photos. I'd like to make my photo's upload "info1 & info2" fields searchable, so people can search for photos based on the photo's title and caption. I've tried to get this work, but I'm doing something wrong. Can you shed a little light on what needs to be done to this code to get the "info1 & info2" data I'm using in my photo title and captions to appear in the search form results.

Thanks, Zick

==========
<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php

require_once "/this/hosting/cmsbuilder/lib/viewer_functions.php";

// begin search code
list($search_this_siteRecords, $search_this_siteMetaData) = getRecords(array(
'tableName' => 'search_this_site',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$search_this_siteRecord = @$search_this_siteRecords[0]; // get first record

// show error message if no matching record is found
// if (!$search_this_siteRecord) {
// header("HTTP/1.0 404 Not Found");
// print "Record not found!";
// exit;
//}

?>
<?php
// search viewer code begins
$searchOptions = array();
$searchOptions['keywords'] = @$FORM['q'];
$searchOptions['perPage'] = "4";
$searchOptions['debugSql'] = "0";

$searchTables = array();

$searchTables['house'] = array(
'viewerUrl' => 'house_details.php',
'titleField' => 'title',
'summaryField' => 'content',
'searchFields' => array('title','content'),
);

$searchTables['building'] = array(
'viewerUrl' => 'building_details.php',
'titleField' => 'title',
'summaryField' => 'content',
'searchFields' => array('title','content'),
);

$searchTables['photos'] = array(
'viewerUrl' => 'photos_details.php',
'titleField' => 'title',
'summaryField' => 'content',
'uploadField' => 'info1',
'uploadField' => 'info2',
'searchFields' => array('title','content','info1','info2'),
);

list($searchRows, $searchDetails) = searchMultipleTables($searchTables, $searchOptions);
// search viewer code ends
?>
==========