On 8/1/09 12:04 AM, "Paul M Foster" <paulf@xxxxxxxxxxxxxxxxx> wrote: $values = implode(',', $other); For some reason no matter how I tried to get it to say # should pull anything that does not start with a letter..... It pulls all restaurants....or it breaks the full script. Here are all the things I have tried so far... //Create array with letters AND number sign $letters = range('A','Z'); array_push($letters, '#'); $menu = ''; $selectedLetter = isset($_GET['letter']) ? $_GET['letter'] : null; foreach($letters as $letter) { $menu .= ($letter == $selectedLetter) ? sprintf('%s ', $letter) : sprintf('<a href="browse.php?letter=%s">%s</a> ', $letter, $letter); } echo "<div align=\"center\"><b>{$menu}</b><br /></div>"; //Show all restaurants that start with $letter $sql = "SELECT DISTINCT ID, name, address FROM restaurants WHERE name LIKE '{$selectedLetter}%'"; /* //Show all restaurants that start with $letter not between "A" and "Z" if ($selectedLetter == "#") { $a= "1"; $sql = "SELECT DISTINCT ID, name, address FROM restaurants WHERE name LIKE '{$a}%'"; }elseif ($selectedLetter == "#"){ $a= "2"; $sql = "SELECT DISTINCT ID, name, address FROM restaurants WHERE name LIKE '{$a}%'"; }elseif ($selectedLetter == "#"){ $a= "3"; $sql = "SELECT DISTINCT ID, name, address FROM restaurants WHERE name LIKE '{$a}%'"; }elseif ($selectedLetter == "#"){ $a= "4"; $sql = "SELECT DISTINCT ID, name, address FROM restaurants WHERE name LIKE '{$a}%'"; }elseif ($selectedLetter == "#"){ $a= "5"; $sql = "SELECT DISTINCT ID, name, address FROM restaurants WHERE name LIKE '{$a}%'"; }elseif ($selectedLetter == "#"){ $a= "6"; $sql = "SELECT DISTINCT ID, name, address FROM restaurants WHERE name LIKE '{$a}%'"; }elseif ($selectedLetter == "#"){ $a= "7"; $sql = "SELECT DISTINCT ID, name, address FROM restaurants WHERE name LIKE '{$a}%'"; }elseif ($selectedLetter == "#"){ $a= "8"; $sql = "SELECT DISTINCT ID, name, address FROM restaurants WHERE name LIKE '{$a}%'"; }elseif ($selectedLetter == "#"){ $a= "9"; $sql = "SELECT DISTINCT ID, name, address FROM restaurants WHERE name LIKE '{$a}%'"; }else{ $a= "0"; $sql = "SELECT DISTINCT ID, name, address FROM restaurants WHERE name LIKE '{$a}%'"; } */ /*doesn't work returns all results for # if ($selectedLetter == "#"){ $other = range('0','9'); $sql = "SELECT DISTINCT ID, name, address FROM restaurants WHERE name LIKE '{$other}%'"; } if ($selectedLetter =="#"){ $other = ctype_digit(range('0','9')); $sql = "SELECT DISTINCT ID, name, address FROM restaurants WHERE name LIKE '{$other}%'"; } */ // $sql = "SELECT DISTINCT ID, name, address FROM restaurants left(name, 1) between 0 and 9"; // $result = mysql_query($sql) or die(mysql_error()); if ($selectedLetter == "#"){ $other = range('0','9'); $values = implode(',', $other); $sql = "SELECT DISTINCT ID, name, address FROM restaurants WHERE name LIKE '{$values}%'"; } /*//Show all restaurants that start with $selectedLetter if ($selectedLetter != "#") { //Letter was selected $where = "name LIKE '%{$selectedLetter}'" } else { //Number was selected $where = "SUBSTRING(name,1,1) IN ('" . implode("','", range(0,9)) . "')"; } $sql = "SELECT DISTINCT ID, name, address FROM restaurants WHERE $where"; $result = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_assoc($result)){ $name = $row['name']; printf('<a href="view.php?ID=%s"><b>%s</b><br />%s<br /><br /></a>', $row['ID'], $row['name'], $row['address'] ); }*/ $result = mysql_query($sql) or die(mysql_error()); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php