Gossamer Forum
Home : Products : DBMan : Installation :

search failed - no matching records

Quote Reply
search failed - no matching records
I get the same 'search failed - no matching records' message when I search by:
1) selecting price range
2) entering city
3) entering city and state
4) entering city, state and county

(If it helps, current html.pl and default.cfg are posted as txt files at: www.amix.com/dbman )
Quote Reply
Re: search failed - no matching records In reply to
I could not see anything wrong with your files, except that you have numer for userid. Do you assign your users a number to access your database?? (I guess so...since you have a large number associated with form-length and max-length.)

One thing I would suggest is looking at your database file to make sure that the records are lined up properly, meaning that each record starts with a number. If you have added new fields in the default.cfg file without adding them in your database file, then the records will be out of sync.

Regards,





------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: search failed - no matching records In reply to
The default.db file looks fine to me - I've posted it as a txt file too in case you can spot something missing.

As for the userid field - I went back and added that field so only that users records would be returned to modify (I think it was the result of posting about the code that searches for 1.jpg and if it doesn't exist displays default.jpg - JPDeni helped get it working). Does the userid need to be alpha and not numer?

btw, did I see Anthrotech listed somewhere as an installer of DBMan? If yes, what do you charge? (I haven't been able to spend as much time as I'd like on this - I'm thinking it may be worth it to let a pro take over!)
Quote Reply
Re: search failed - no matching records In reply to
The userid field should be alpha. If you added the userid field after you already had records added, then you will need to add an extra delimiter or start from a new blank database file.

Adding in a field after you already have "live" records is possible through a cgi script I wrote.

If you would like the cgi script, let me know. You can email me at support@anthrotech.com for the file and to find out my rates.

Smile

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: search failed - no matching records In reply to
Still not searching correctly - I changed the userid field to alpha, deleted all the records and added new test records. I still get 'no matching records' no matter what I search for.
Quote Reply
Re: search failed - no matching records In reply to
Does anyone have any suggestions or do I need to start over from scratch?
Quote Reply
Re: search failed - no matching records In reply to
I was sorta staying out of this, since Eliot had started to help you and I didn't want to confuse things.

The problem seems to be in your Price-gt and Price-lt fields. Do you have commas in your Price field in the database? That would cause the problem you're having, especially since your Price-gt and Price-lt fields don't give the option not to select a value.

I did a search for Price=157,500 (after I had seen there was a house for that price) and I got that record returned. Which tells me that you probably do have commas in the Price field in your database.


------------------
JPD





Quote Reply
Re: search failed - no matching records In reply to
You've lost me completely, unless you're saying you searched by entering Price=157,500 as keywords. I'm pretty sure I entered all the test record price fields without entering a comma and it was entered automatically. The default.db has |$157,500| for the price field with the $ put in automatically.

Why would it not return records matching the City name?
Quote Reply
Re: search failed - no matching records In reply to
I did search for Price=157,500. I typed it into the Location window in my browser.

Code:
<SELECT NAME="Price-gt">
<option value="50000">50,000
<option value="100000">100,000</option>
<option value="150000">150,000</option>
<option value="200000">200,000</option>
<option value="250000">250,000</option>
<option value="300000">300,000</option>
<option value="350000">350,000</option>
<option value="400000">400,000</option>
<option value="450000">450,000</option>
<option value="500000">500,000</option>
</select>&nbsp;&nbsp;
<$font>TO</font>
&nbsp;&nbsp; <SELECT NAME="Price-lt">
<option value="100000">100,000</option>
<option value="150000">150,000</option>
<option value="200000">200,000</option>
<option value="250000">250,000</option>
<option value="300000">300,000</option>
<option value="350000">350,000</option>
<option value="400000">400,000</option>
<option value="450000">450,000</option>
<option value="500000">500,000</option>
</select>

Without an option not to select a price, the script will always try to find a price that fits the range that it is sent. Since you have a $ and a comma in each of your prices, it will always fail.

To prove what I'm saying, do a search on a city name that you know is there. Or on "Georgia" as the state. You will get no records returned. Then, very carefully, go up to the Location window in your browser and remove the &Price-gt=50000&Price-lt=100000. Hit the enter key on your keyboard and you will have search results.

To allow users the option of not submitting a price, add

<option>---

to the beginning of each of your select fields.


------------------
JPD





Quote Reply
Re: search failed - no matching records In reply to
Ok, now I get it <sortof!>. I'll go back and add the <option>---'s.

I thought adding this line in the sub html_record was putting commas in just for the display:
1 while $rec{'Price'} =~ s/(\d)(\d{3})\b/$1,$2/;

How do I take out the commas and the $ in the price field for the search but leave them in for the search results display?
Quote Reply
Re: search failed - no matching records In reply to
The line you listed does just put the commas in for the display. It's not doing anything right now, though, because there are already commas in your values in the database.

To add the $ to the front of the price in the display, use

<TD valign=middle><$font>\$$rec{'Price'}<BR>

I don't know why the commas are being added to the database. Do you have that line anywhere else? The only place it should be is at the beginning of sub html_record.


------------------
JPD





Quote Reply
Re: search failed - no matching records In reply to
I deleted everything and added new records and it seems to be working great now! I'm thinking you said there was code to put in to strip out commas and/or $ in case people put them in anyway - should I be adding that? If yes, what do I add and does it go after the commify line in the sub html_record?
Quote Reply
Re: search failed - no matching records In reply to
Yes, you probably should add code to delete any commas and dollar signs that people might use when they add files.

No, it would not go in sub html_record. It would go into sub add_record and sub modify_record in the db.cgi file.

In both of the subroutines, just before

Code:
$status = &validate_record; # Check to make sure the modifications are ok!

Add

Code:
$in{'Price'} =~ s/,//g;
$in{'Price'} =~ s/\$//g;


------------------
JPD





Quote Reply
Re: search failed - no matching records In reply to
Works great...thank you sooooo much! You're the absolute best Smile
Quote Reply
Re: search failed - no matching records In reply to
  That's what my hubby tells me!!

You're welcome. Glad we got it worked out.


------------------
JPD