Skip to content

Instantly share code, notes, and snippets.

@XxAnonimeKxX
Last active May 17, 2020 09:51
Show Gist options
  • Select an option

  • Save XxAnonimeKxX/54343137b46920e9d7adb1bfb92625f6 to your computer and use it in GitHub Desktop.

Select an option

Save XxAnonimeKxX/54343137b46920e9d7adb1bfb92625f6 to your computer and use it in GitHub Desktop.
php
public function get($table, $field, $operator, $value){
$sql = "SELECT * FROM ". $table ." WHERE " . $field . $operator . $value;
$query = $this->_pdo->query($sql);
$r = $query->fetchAll();
print_r($r);
}
require_once 'classes/DB.php';
$prod = new DB;
$prod->get('products', 'id', '>', '0');
foreach ($prod as $p) {
echo $p;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment