You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
information-system/application/models/LunarNewYear_model.php

49 lines
1.3 KiB
PHP

<?php
class LunarNewYear_model extends CI_Model {
public $LNY_SX;
public $LNY_LuckyNumber;
public $LNY_LuckyColor;
public $LNY_LuckyFlower;
public $TheYearFortune;
function __construct() {
parent::__construct();
$this->HT = $this->load->database('HT', TRUE);
}
public function get_zodiac($zodiac = 'rat')
{
$sql = "SELECT TOP 1 LNY_SN ,
LNY_SX ,
LNY_LuckyNumber ,
LNY_LuckyColor ,
LNY_LuckyFlower ,
TheYearFortune
FROM LunarNewYear
WHERE LOWER(LNY_SX)='$zodiac'";
$query = $this->HT->query($sql);
return $query->row();
}
public function theyearfortune_save()
{
$sql = "UPDATE LunarNewYear
SET LNY_LuckyNumber = ?,
LNY_LuckyColor = ?,
LNY_LuckyFlower = ?,
TheYearFortune = ?
WHERE LOWER(LNY_SX) = ?";
$query = $this->HT->query($sql, array(
$this->LNY_LuckyNumber,
$this->LNY_LuckyColor,
$this->LNY_LuckyFlower,
$this->TheYearFortune,
$this->LNY_SX
));
return $query;
}
}