Re: creating the php search script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In message <613463.78223.qm@xxxxxxxxxxxxxxxxxxxxxxxxxxx>, Gab Teo
<doneatlast1000@xxxxxxxxx> writes
>Please, I need help, I am trying to create a search on a website, the below 
>error ( $numrows=mysql_num_rows($numresults); line 57) keep showing even after I 
>have create the sql query in many forms, the error highlited in blue and the lne 
>of the error in red on the php scrpt.
>Gab

You have changed from $query to $query2.

>$query = "select * from table where 1st_field like studentID='$studentsID','Name
>='$Name',address='$address',phone='$phone',sex='$sex',DOB='$DOB' \"%$trimmed%\"  
>  order by 1st_field"; 
> $numresults=mysql_query($query2);

Change to 
$numresults=mysql_query($query);

But your query is completely wrong.
>1st_field like studentID='$studentsID'

And you might mean
>address='$address' AND phone='$phone' AND
which would be correct syntax, but I don't think that is what you want
to do.

As you have asked for search term, what are you searching for?  Do you
mean, the search term might appear in any field?  In which case, it will
be very slow.  Better to ask for specifics, like "search for name", or
"search for phone"



And why run the query twice?

And I assume that $limit is set elsewhere, it doesn't seem to be set
here.

-- 
Pete Clark

Hot Costa - Local Spain
http://www.hotcosta.com

[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux