<?php include "xtemplate.class.php"; include "model.php"; $con = mysql_connect("localhost", "root", ""); mysql_select_db("baitap", $con); error_reporting(E_ALL & ~E_NOTICE); $a = new sanpham(); $query = "SELECT * FROM sanpham"; $result = mysql_query($query) or die(mysql_error()); $total = mysql_num_rows($result); $perpage = 12; $numofpage = ceil($total / $perpage); $loai = $_GET['loai']; if (isset($_GET['page']) == true) { $start = ($_GET['page'] - 1) * $perpage; } else { $start = 0; } $sp = new XTemplate("sp.php"); $query = "SELECT * FROM sanpham WHERE loaisanpham = '{$loai}'\nLIMIT {$start},{$perpage}"; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { $sp->assign("name", $row['name']); $sp->assign("anh", $row['img']); $sp->assign("gia", $row['gia']); $sp->assign("id", $row['id']); $sp->parse("main"); } $newHTML = $sp->text("main"); $content = $newHTML;
<?php include "xtemplate.class.php"; include "model.php"; $con = mysql_connect("localhost", "root", ""); mysql_select_db("baitap", $con); error_reporting(E_ALL & ~E_NOTICE); session_start(); $a = new sanpham(); $query = "SELECT * FROM sanpham"; $result = mysql_query($query) or die(mysql_error()); $total = mysql_num_rows($result); $perpage = 12; $numofpage = ceil($total / $perpage); $loai = $_GET['loai']; if (isset($_GET['page']) == true) { $start = ($_GET['page'] - 1) * $perpage; } else { $start = 0; } $sp = new XTemplate("sp.php"); $h = $_GET['h']; $query = "SELECT * FROM sanpham WHERE loaisanpham = '{$loai}'"; $tukhoaQ = ""; if (isset($_GET['h'])) { $tukhoaQ = " and idnsx = {$h} "; } $l = "LIMIT {$start},{$perpage}"; $query = $query . $tukhoaQ . $l; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)) {
<?php include "xtemplate.class.php"; include "model.php"; mysql_connect("localhost", "root", ""); mysql_select_db("baitap"); $sanpham = new XTemplate("home.php"); $a = new sanpham(); $d1 = $a->select_banchay(); $sanpham->assign("bc1", $d1[0]); $sanpham->assign("bc2", $d1[1]); $sanpham->assign("bc3", $d1[2]); $d1 = $a->select_capnhat(); $sanpham->assign("cn1", $d1[0]); $sanpham->assign("cn2", $d1[1]); $sanpham->assign("cn3", $d1[2]); $sanpham->assign("cn4", $d1[3]); $sanpham->parse("main"); $sanpham->out("main");
<?php include "xtemplate.class.php"; include "model.php"; $a = new sanpham(); $p = $a->ngay(); print_r($p);
<?php include "model.php"; $a = new sanpham(); $d = $a->ngay(); $c = 24 / 12 / 2014; if ($c < $d) { echo $d; }
if (isset($_FILES[$hinh]['name'])) { if ($_FILES[$hinh]['error'] == 0) { move_uploaded_file($_FILES[$hinh]['tmp_name'], $path . '/' . $_FILES[$hinh]['name']); $path1 = substr($path, 3); return $path1 . "/" . $_FILES[$hinh]['name']; } } } $hinh1 = upload_image_2('hinh1', $path); /// $hinh2 = upload_image_2('hinh2', $path); /// $hinh3 = upload_image_2('hinh3', $path); /// $hinh4 = upload_image_2('hinh4', $path); /// class sanpham extends DB_Business { function __construct() { // Khai báo tên bảng $this->_table_name = 'sanpham'; // Khai báo tên field id $this->_key = 'id'; // Gọi hàm khởi tạo cha parent::__construct(); } } $sanpham = new sanpham(); $sanpham->add_new(array('name' => $name, 'phone' => $phone, 'id' => $id, 'hinh1' => $hinh1, 'hinh2' => $hinh2, 'hinh3' => $hinh3, 'hinh4' => $hinh4, 'detail' => $mota, 'khuvuc' => $khuvuc, 'time' => $time, 'giaca' => $giaca, 'email' => $email, 'ten_nd' => $name_nd, 'danhmuc' => $danhmuc)); }
<?php include "xtemplate.class.php"; include "model.php"; mysql_connect("localhost", "root", ""); mysql_select_db("baitap"); $sanpham = new XTemplate("home.php"); $a = new sanpham(); $d1 = $a->select_caocap(); $sanpham->assign("bc1", $d1[0]); $sanpham->assign("bc2", $d1[1]); $sanpham->assign("bc3", $d1[2]); $d1 = $a->select_capnhat(); $sanpham->assign("cn1", $d1[0]); $sanpham->assign("cn2", $d1[1]); $sanpham->assign("cn3", $d1[2]); $sanpham->assign("cn4", $d1[3]); $sanpham->parse("main"); $sanpham->out("main");