Jump to content

New to PHP would like help with search box


atchy

Recommended Posts

Hi,
I am currently moving my site over from ASP to PHP and I am trying to create a FULL TEXT search facility. I have created a results page which works perfectly if I type in the name/s directly but unable to get a text field on my search page to work. I am using Dreamweaver, MySql + PHP and testing locally using Apache. A lot of the PHP code is quiet baffling to me and have been using the MySQL Full-Text Searching with PHP from your site as a guide. I feel it must be straightfoward but beyond me. The code from the Recordset is below.
I would appreciate any guidance advice so that I may maintain some sanity.

Thanks

John

SELECT artistinfotbl.artistName, artistinfotbl.lastName,artistinfotbl.headDescription, MATCH (artistinfotbl.artistName, artistinfotbl.lastName)  AGAINST ('$search' IN BOOLEAN MODE) AS score
FROM artistinfotbl
WHERE MATCH (artistinfotbl.artistName, artistinfotbl.lastName)  AGAINST ('$search' IN BOOLEAN MODE)
ORDER BY score DESC

replacing '$search' with name/s gives exactly what I want.
Link to comment
Share on other sites

Hi Fenway,
Not sure what you mean by Interpolation. In my ASP version I added a variable to the recordset (Request.QueryString) but trying to add a variable with #search# as shown in 'Dreamweaver help' gives a blank page. It seems that I am missing some code but as I am totally new to PHP I am not sure what this is or where it should be.
If you can advise or point me to a straightfoward tutorial or beginners guide to PHP I would be most grateful

Thanks for your reply

Regards

John
Link to comment
Share on other sites

Substituting '$search' with e.g. 'Gregor anda smith vanessa'  (a mixture from 2 columns from table) displays on my results page a list of people matching the keywords; exactly what I want. To my simplistic way of thinking the search page/form is not talking to the results page.  When I try putting in a variable the blank page that results is exactly that, there is no code at all in view source.
Sorry I am probably not explaining it in the correct way.
John
Link to comment
Share on other sites

My text box name is 'search' and I thought that '$search' was/is  the variable I need.
Further research has me thinking that I need something like:
$something = (isset ($_GET['search']);
and
$something = mysql_escape_string($_GET['search']);
Thanks

John

Youre last comment got me thinking (its hard at my age) and blundering around and adding
$searchstring = mysql_escape_string($_GET['search']);
seems to have got me going.
Many thanks for your patience with a PHP beginner. All I have to do now is get the results to link to the details page.
I may be back.
regards
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.