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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.