[eluser]got 2 doodle[/eluser]
OK
I tried and tried and tweaked and tweaked and then a new approach
Code:
//This doesn't work
function get_only_number_bands($num,$offset){
$query = $this->db->where('active = 1');
$query = $this->db->where('group = 4');
$query = $this->db->not_like('username', '[A-Z]','after');
$query = $this->db->get($this->config->item('backendpro_table_prefix').'users',$num,$offset);
if ($query->num_rows() > 0){return $query->result();}
}
This returns the number of bands that start with [0-9]
Code:
function count_where_bandname_starts_num(){
$query = $this->db->where('active = 1');
$query = $this->db->where('group = 4');
$query = $this->db->like('username', '0','after');
for ($i='1'; $i<='9'; $i++)
{ $query = $this->db->or_like('username',$i,'after');}
$query = $this->db->get($this->config->item('backendpro_table_prefix').'users');
if ($query->num_rows() > 0){return $query->num_rows();}
}
This returns the data from the table
Code:
function get_only_number_bands($num,$offset){
$query = $this->db->where('active = 1');
$query = $this->db->where('group = 4');
$query = $this->db->like('username', '0','after');
for ($i='1'; $i<='9'; $i++)
{ $query = $this->db->or_like('username',$i,'after');}
$query = $this->db->get($this->config->item('backendpro_table_prefix').'users',$num,$offset);
if ($query->num_rows() > 0){return $query->result();}
}
So this seems to work fine, but I would be interested in a cleaner approach. I tried some REGEXP stuff in my mySQL queries but nothing worked, it could also have something to do with my version of mySQL.
doodle