Try using a mysql wildcard (%) in your query. Something about like
this:

$query = "SELECT `LotNo`, `A`, `Description` FROM batemans WHERE
 `SaleNo` LIKE $SaleNo% ORDER BY LotNo ASC";

That should return 200, 21, or 2  for an entry or "2" for SaleNo.

On Aug 28, 1:18 pm, Mattl <[EMAIL PROTECTED]> wrote:
> Hi,
> Clearly I'm doing something basic wrong here, please can someone point
> it out?
>
> I'm only getting the value that's entered into the autcomplete box
> returned in the drop-down list (ie If I enter '2' only get '2' back
> not '2', '20', '21' etc)
>
> Here's my code:
>
> $("#lotno1").autocomplete("../js/autocomplete.php?SaleNo=102", {
>                                 matchContains: true,
>                                 mustMatch: true,
>                         });
>
> });
>
> Here's the content of 'autocomplete.php':
>
> <?php require_once('../../../Connections/Oundle_DB.php'); ?>
> <?php
> $SaleNo = ($_GET["SaleNo"]);
> $q = strtolower($_GET["q"]);
>
> mysql_select_db($database_Oundle_DB, $Oundle_DB);
> $query = "SELECT `LotNo`, `A`, `Description` FROM batemans WHERE
> `SaleNo` LIKE $SaleNo ORDER BY LotNo ASC";
> $result = mysql_query($query, $Oundle_DB) or die(mysql_error());
> while($row=mysql_fetch_assoc($result))
> if (strpos(strtolower($row['LotNo']), $q) !== false) {
>         echo $row['LotNo'].$row['A'].'|'.$row['Description'].',';}
>
> ?>
>
> Any help greatly appreciated.
>
> Thanks
> Matt

Reply via email to