The if/else/echo should all be within the while loop.  The way it is now, it 
should only show the last record returned, because that is the last value 
within the while loop.  The way you have it, the rest would be done after it 
had looped through all of the records and it would return whatever the last 
values were for the $row array.  


According to the following link from the MySQL Manual at 
http://www.mysql.com/doc/S/t/String_comparison_functions.html, string 
comparisons using LIKE should be case insensitive as stated below:

     The following two statements illustrate that string comparisons are case 
insensitive unless one of the operands is a binary string: 
     mysql> SELECT 'abc' LIKE 'ABC';
         -> 1
     mysql> SELECT 'abc' LIKE BINARY 'ABC';
         -> 0

I am not sure why it is showing case sensitivity, unless as it states, one of 
the operands is a binary string.  

HTH

Maureen

Jennifer Downey <[EMAIL PROTECTED]> said:

> Thanks all,
> 
> You people are awesome. I have it working  but I still have 2 bugs
> First it is only showing the first record it finds with the search term, not
> all records associated with it.
> 
> Second it has to be spelled exactly right or I get 0 results.
> in other words if Jelly is spelled Jelly and I type jelly I get nothing but
> if I spell it Jelly it will return only the first record it finds what have
> I done wrong?
> 
> if($search)
> {
>     $query = "SELECT uid, id, image, iname, quantity, user, type, price FROM
> {$config["prefix"]}_shop WHERE iname LIKE '%$searchword%' ORDER BY iname";
>    $ret = mysql_query($query) or die(mysql_error());
>    while($row = mysql_fetch_array($ret))
> {
>   $user = $row['user'];
>   $uiid = $row['uid'];
>  $iid = $row['id'];
>   $image = $row['image'];
>   $iname = $row['iname'];
>   $q = $row['quantity'];
>   $type = $row['type'];
>  $price = $row['price'];
> }
>    if($searchword == $iname)
>    {
>    echo "<TABLE BORDER='0' WIDTH='95%' CELLPADDING='0'
> CELLSPACING='0'><TR>";
> echo "<TD width=20%><a href='remove.php?id=$id&remove=yes'>$user</a></TD>";
> echo "<TD width=40%><font size=2>$iname</font></TD>";
> echo "<TD width=20%><font size=2><CENTER>$q</CENTER></font></TD>";
> echo "<TD width=30%><font size=2><CENTER>$price</CENTER></font></TD>";
> echo "</TD></TR></TABLE>";
> }
> 
> }else{
> 
> echo "<FORM METHOD=post ACTION='$PHP_SELF'>";
> echo "Search Shops<BR><input type=text name=\"searchword\" value=\"\">";
> echo "<BR><INPUT TYPE='submit' NAME='search' VALUE='Search'>";
> 
> 
> }
> 
> Thanks
> Jennifer
> 
> "Jennifer Downey" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Hi all,
> >
> > I have been trying to build a search script for my site that deals with
> only
> > one table in my db.
> > As Julie Meloni pointed out look in the MySQL manual for LIKE clauses I
> > can't seem to locate that clause in ether
> > manual.
> > Dan Brunner gave me this to go on:
> >
> > $query = "SELECT uid, id, image, iname, quantity, type FROM
> > {$config["prefix"]}_shop WHERE  iname  LIKE = '%$shopsearch% ORDER BY
> > iname'";
> > $ret = mysql_query($query);
> > while(list($quantity)=mysql_fetch_row($ret))
> >
> > But I can't seem to get this to work. I have never worked with LIKE before
> > and would appreciate any help on this.
> >
> > Thanks Julie and Dan for your time and effort.
> >
> > Thanks all for your time and help
> > Jennifer
> >
> >
> > --
> > The sleeper has awaken
> >
> >
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
> >
> >
> 
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 



-- 




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to