46 lines
902 B
PHP
46 lines
902 B
PHP
<?php
|
|
class star {
|
|
var $bean;
|
|
var $bean_id;
|
|
var $user_id;
|
|
var $db;
|
|
|
|
var $starExists;
|
|
|
|
function start() {}
|
|
|
|
function star($bean, $bean_id, $user_id) {
|
|
$this->bean = $bean;
|
|
$this->bean_id = $bean_id;
|
|
$this->user_id = $user_id;
|
|
|
|
$db = $GLOBALS['db'];
|
|
|
|
$starExists = $this->checkStar();
|
|
}
|
|
|
|
private function checkStar() {
|
|
$w = $this->db->query("SELECT * FROM stars WHERE
|
|
bean = '$this->bean' AND
|
|
bean_id = '$this->bean_id' AND
|
|
user_id = '$this->user_id");
|
|
|
|
if ($w->num_rows == 0)
|
|
return false;
|
|
else
|
|
return true;
|
|
}
|
|
|
|
private function createStar() {
|
|
if ($this->starExists == false) return;
|
|
$this->db->query("INSERT INTO stars VALUES ('$this->bean','$this->bean_id','$this->user_id')");
|
|
}
|
|
|
|
private function deleteStar() {
|
|
if ($this->starExists == true) return;
|
|
//$this->db->query("");
|
|
}
|
|
|
|
|
|
}
|
|
?>
|