Jump to content

$where - approval


sweety867

Recommended Posts

hi

 

I have one problem with this script. I want that he the videos when status = active but i don'T know how i should  write this in the $where.

 

I mean take video WHERE status = ACTIVE.

 

Maybe someone can help me, it's will be great!

 

Thanks a lot ;-)

 

Hier is the script:

 

static function count($table, $where = '', $order = '', $limit = '', $group = '')

{

$sql = 'SELECT COUNT(*) ';

$sql .= 'FROM `' . $table . '` ';

$sql .= ($where == '' ? '' : 'WHERE ' . $where . ' ');

$sql .= ($order == '' ? '' : 'ORDER BY ' . $order . ' ');

$sql .= ($group == '' ? '' : 'GROUP BY ' . $group . ' ');

$sql .= ($limit == '' ? '' : 'LIMIT ' . $limit . ' ');

return DB::result($sql);

}

static function field($table, $field, $where = '', $order = '', $limit = '', $group = '')

{

$sql = 'SELECT `' . $field . '` ';

$sql .= 'FROM `' . $table . '` ';

$sql .= ($where == '' ? '' : 'WHERE ' . $where . ' ');

$sql .= ($order == '' ? '' : 'ORDER BY ' . $order . ' ');

$sql .= ($group == '' ? '' : 'GROUP BY ' . $group . ' ');

$sql .= ($limit == '' ? '' : 'LIMIT ' . $limit . ' ');

return DB::column($sql);

}

static function select($table, $where = '', $order = '', $limit = '', $fields = '*', $group = '')

{

$sql = 'SELECT ' . (is_array($fields) ? '`' . implode('`,`', $fields) . '`' : $fields) . ' ';

$sql .= 'FROM `' . $table . '` ';

$sql .= ($where == '' ? '' : 'WHERE ' . $where . ' ');

$sql .= ($order == '' ? '' : 'ORDER BY ' . $order . ' ');

$sql .= ($group == '' ? '' : 'GROUP BY ' . $group . ' ');

$sql .= ($limit == '' ? '' : 'LIMIT ' . $limit . ' ');

return DB::all($sql);

}

Link to comment
https://forums.phpfreaks.com/topic/221116-where-approval/
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.