class danli{
public $db;
protected static $ins=null;
protected function __construct(){
$servername = "localhost";
$username = "dbname";
$password = "cs.123456789";
try {
$this->db = new PDO("mysql:host=$servername;dbname=kuaijiezou", $username, $password);
//echo "Connected successfully";
}
catch(PDOException $e)
{
echo $e->getMessage();
}
}
public static function getins(){
if(self::$ins ==null){
self::$ins = new self();
}
return self::$ins;
}
}
$conn = danli::getins()->db;
$url = "SELECT id,breakfast,lunch,personal,isdayin FROM my_order";//订单状态已接单 支付状态已支付 订单状态未打印
$res = $conn->query($url)->fetch(PDO::FETCH_ASSOC);
if($res['id']){
$orderid = $res['id'];
$isdayin = $res['isdayin'].$num;
$v='';
if($res['breakfast'] ==34){
$v .= ",breakfast=36";
}
if($res['lunch'] ==34){
$v .= ",lunch=36";
}
if($res['personal'] ==34){
$v .= ",personal=36";
}
$v .= ",status=36";
$sqlup = "UPDATE my_order SET isdayin=$isdayin$v WHERE id=".$res['id'];
$count = $conn->exec($sqlup);