Jennifer,

Check if there is a "set exact" setting for MySQL.

Using LIKE should find everything beginning with "Starr". You may also have 
to convert search term and target values to one of lower or upper case in 
the SELECT statement.

Miles

At 10:55 AM 4/25/2002 -0700, Jennifer Downey wrote:
>I am quite positive that they are not Binary what I am finding is that it
>has to be exactly as it is in the table.
>I have one item called StarrRacing Guide if I put in starr or Starr it will
>return nothing I have to spell it exactly like it is in the db "StarrRacing
>Guide".
>here is a dump of the table maybe I have done something wrong there:
>
>uid int(10) NOT NULL default '0',
>   id int(5) NOT NULL default '0',
>   iname varchar(50) NOT NULL default '',
>   image varchar(100) NOT NULL default '',
>   quantity int(10) unsigned NOT NULL default '1',
>   type varchar(20) NOT NULL default '',
>   price int(6) NOT NULL default '0',
>   user varchar(50) NOT NULL default '',
>
>I did move the while curly brace down to include the echo and that part is
>working great returning all records found.
>
>Thanks
>Jennifer
>
>"Maureen" <[EMAIL PROTECTED]> wrote in message
>[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> >
> > 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
> > >
> >
> >
> >
> > --
> >
> >
> >
>
>
>---
>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