1) Lets say a person was searching for "John Smith" they could enter "John Smith" or "John" or "Smith" and it would work. I would like to improve my search so that if a person searched for "John Smith" it would also find results for "John T. Smth" or " John Q. Smith" etc. Is there an easy way to do this?

2) How can I sort the $year field?

3) For each record, the data in my $info is 2 or 3 sentences long. When the current script returns a result, there is only 1 space between sentences even though there are 2 in my database. Any suggestions on how I can fix this?

1) Lets say a person was searching for "John Smith" they could enter "John Smith" or "John" or "Smith" and it would work. I would like to improve my search so that if a person searched for "John Smith" it would also find results for "John T. Smth" or " John Q. Smith" etc. Is there an easy way to do this?

I would say to break the string apart and then do a search for both words and only return the results that have both in them, regarless of order or what's between them.

2) How can I sort the $year field?

You have to create a multidimensional array, then sort it. You can create a normal array, then use array_multisort, or you can create an array that has the year as the keys, and then sort the keys. Just be careful with the latter because duplicate keys will over write eachother.

3) For each record, the data in my $info is 2 or 3 sentences long. When the current script returns a result, there is only 1 space between sentences even though there are 2 in my database. Any suggestions on how I can fix this?

What do you mean it only returns one space but there are two in the db? Please clarify.

In my database, for a given record, the $info field might contain multiple sentences that have the standard 2 spaces after the period. When that record is extracted and echoed, there is only one space after the period. It does it in every case. I thought the trim function was causing it, but it does it even when I remove it.

Browsers will automatically remove multiple spaces and replace them with one single space. What you need to do is replace the two spaces with &nbsp; (non-break space) if you want those two spaces to appear.

Browsers treat the non-break space as text even though you can't see it so you can do this:

echo $info.'&nbsp;';

That way the browser will replace the two spaces with one single space and the non-break space will be tagged onto the end giving the illusion of two spaces.

Not a pro just an enthusiast

if (empty($coffee)) {$coffee=new coffee();}

Please surround any code using the CODE tags - I rarely look at anything without them