$result = dbquery("SELECT item_id, name, details, datestamp FROM ".DB_TEST." WHERE status = '0' ORDER BY REPLACE(REPLACE(REPLACE(name,'#',''),'+',''),'/','') ASC");
$str = preg_replace(.......);
$result = dbquery(......... ORDER BY $str);
$string = preg_replace("/[^a-z0-9]+/i", "", name);
ORDER BY preg_replace('/[^a-z0-9]+/i', '', name)
$result = dbquery("SELECT * FROM ".DB." "); // no sorting.
$output = array(); // init
while ($data = dbarray($result)) {
$title = trim(str_replace(range(0,9),'',' $data['title'])); // replace all numbers.
$title = str_replace(" ", "-", $data['title'])); // replace all whitespace to dash.
// now your title is formatted to all the conditions you want..
$output[$title] = $data;
}
sort($output); // sort them here.
if ($output) {
foreach($output as $title => $data) {
// do your stuff here as good as a $data from while loop.
}
}
$result = dbquery("SELECT name FROM ".DB_TABLE." WHERE status = '0'"); // No sorting.
$output = array();
while ($data = dbarray($result)) {
$name = strtolower($data['name']); // lowercase
$one = preg_replace("/[^a-z]/i", "", $name); // Strip out non-alphanumeric chars
$two = trim(str_replace(range(0,9),"", $one)); // Strip numbers - possibly redundant
$three = str_replace("#", "", $two); // Strip Hash
$output[$three] = $data;
}
ksort($output, SORT_NATURAL);
if ($output) {
foreach($output as $three => $data) {
echo "<b>".$data['name']."</b><br />\n";
}
}
function print_p($array) {
echo "<div>\n";
echo "<pre style='white-space:pre !important;'>";
print_r($array);
echo "</pre>";
echo "</div>\n";
}
$output = array('0'=>'a', '2'=>'b');
// Usage
print_p($output); // will output formatted array dump
$string = 'text';
$string2 = 'text';
print_p("$string $string2"); // will output 'text text'
Category Forum
Modifications and Requests - 8Labels
None yet
Statistics
2 participants
Notifications
You are not receiving notifications from this thread.
Related Questions