(Sorry, forgot to send this to the whole list.)
On Fri, Jul 31, 2009 at 05:24:45PM -0400, Miller, Terion wrote:
> I'm still struggling with using ranges... Can they be passed to a query
> somehow...
>
> I have this so far but it pulls nothing:
>
> //Show all with $letter not between "A" and "Z"
>
> if ($selectedLetter = "#") {
Problem #1: The above expression will set $selectedLetter to '#', *not*
check whether $selectedLetter is equal to '#'.
>
> $other = range('0','9');
>
> $sql = "SELECT DISTINCT ID, name, address FROM restaurants WHERE name LIKE
> '$other'";
Problem #2: The range() function returns an array (see documentation).
Echo the $sql variable to screen and you may find that it says:
"SELECT DISTINCT ... LIKE 'Array'"
Try this:
$values = implode(',', $other);
$sql = "SELECT DISTINCT ... LIKE '$values'";
(See documentation for implode().)
<snip>
Paul
--
Paul M. Foster
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php