Jump to content

[SOLVED] Range help


cry of war

Recommended Posts

When I use range() I under stand how to make it select all numbers that start with 1-9 and so on and the same with letters but how do I make it find all the following and anything else one might think up..

~

!

@

#

$

%

^

&

*

(

)

_

+

`

-

=

{

}

|

[

]

\

:

"

;

'

<

>

?

,

.

/

I have tried stuff like range('A','z') gives you all Caps letters + 5 characters + all lower case letters I was more looking for All characters + All caps. I searched the web and all I could find is them telling you about ranges incremental part but I have no use for that :P

 

 

Thanks for any help

 

CoW

 

 

Edit: almost forgot here is the example of where im trying to use it

 

foreach (range('A','z') as $ltr) {/*this is the part i need help with*/
$tmp[] = '\n<optgroup label='.strtoupper($ltr).'>';
$q = "SELECT * FROM `$table6` WHERE `Name` LIKE '" . $ltr . "%' ORDER BY `Name`";
$result = mysql_query($q) or die("Problem with the query: $q<br/>" . mysql_error());
if (mysql_num_rows($result) == 0){
$tmp[] = "\n<option value=''>No Items</OPTION>";
} else {
	while ($row = mysql_fetch_assoc($result)) {
$tmp[] = "\n<option value='".$row['ID']."'>".$row['Name']."</OPTION>";
	}
}
            $tmp[] = "\n</OPTGROUP>";
    }

Link to comment
https://forums.phpfreaks.com/topic/80133-solved-range-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.