I don't think it's the formatting. In your original query, you were only collecting saleno. In your second, you're specifically matching a certain saleno but applying the wildcard on lotno. Also, you might try ordering your comparisons. Something like:
"SELECT `LotNo`, `A`, `Description` FROM batemans WHERE (`SaleNo` LIKE $SaleNo) AND (`LotNo` LIKE '%$q%') ORDER BY LotNo ASC"; Here's the docs on mysql string comparison: http://dev.mysql.com/doc/refman/5.1/en/string-comparison-functions.html Do you use phpMyAdmin? It's a good tool for figuring our mysql queries. On Aug 28, 11:15 pm, Mattl <[EMAIL PROTECTED]> wrote: > Thanks - I've changed the Query to: > > $query = "SELECT `LotNo`, `A`, `Description` FROM batemans WHERE > `SaleNo` LIKE $SaleNo AND `LotNo` LIKE '%$q%' ORDER BY LotNo ASC"; > > but it still only shows one value in the drop-down. > > The output of the query can be seen at (this shows multiple values, ie > the query is working): > > http://www.batemans-auctions.co.uk/js/autocomplete.php?SaleNo=102&q=2 > > Is it the formatting of the output? > > Thanks > Matt > > On Aug 28, 10:44 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > > > 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