本文整理汇总了PHP中bd::prepare方法的典型用法代码示例。如果您正苦于以下问题:PHP bd::prepare方法的具体用法?PHP bd::prepare怎么用?PHP bd::prepare使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bd
的用法示例。
在下文中一共展示了bd::prepare方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
public function update($package)
{
$con = new bd();
$sql = "UPDATE package SET id_city=" . $package->getIdCity() . ", name='" . $package->getName() . "', " . "description='" . $package->getDescription() . "', price=" . $package->getPrice() . ", " . "price_promo=" . $package->getPricePromo() . ", date_start='" . $package->getDateStart() . "', date_end='" . $package->getDateEnd() . "', " . "id_user=" . $package->getIdUser() . ", thumbnail='" . $package->getThumbnail() . "' WHERE idpackage=" . $package->getIdPackage();
$r = $con->prepare($sql);
$r->execute();
}
示例2: subir
public function subir($ar, $ex, $dir)
{
$this->dir = $dir;
$this->archivo = explode(".", $ar['name']);
$this->extensiones = $ex;
$random = date("d:m:y:h:i") * rand() * 9999999;
if (in_array($this->archivo[1], $this->extensiones)) {
$this->url = $dir . $random . "." . $this->archivo[1];
if (!file_exists($this->dir)) {
@mkdir($this->dir, 777);
}
$this->arr = array(':nombre' => "hola", ':des' => "Hola", ':url' => $this->url);
$this->archivo = $ar;
if (move_uploaded_file($this->archivo['tmp_name'], $this->url)) {
$base = new bd(TBD, SER, BD, US, CL);
$i = 1;
$sql = $base->prepare("INSERT INTO imagen(idimagen, nombre, ruta, foto) VALUES ({$i}+1, {$this->archivo}[1], {$this->url}, {$this->archivo}['tmp_name'])");
if ($sql->execute($this->arr)) {
echo "Imagen subida y almacenada correctamente";
} else {
echo "Error";
}
} else {
echo "error";
}
} else {
echo "Extension invalida";
}
}
示例3: insert
public function insert($city)
{
$con = new bd();
$sql = 'INSERT INTO city (name, state, country, description, thumbnail, id_gallery, id_user) VALUES ' . '("' . $city->getName() . '", "' . $city->getState() . '", ' . '"' . $city->getCountry() . '", "' . $city->getDescription() . '", ' . '"' . $city->getThumbnail() . '", ' . $city->getIdGallery() . ', ' . $city->getIdUser() . ')';
$r = $con->prepare($sql);
$r->execute();
}
示例4: insert
public function insert($form)
{
$con = new bd();
$sql = "INSERT INTO form_interest (id_package, first_name, last_name, guests_number, couple_room, individual_room, double_room, triple_room, observation, email, area_code, phone, newsletter) VALUES " . "(" . $form->getIdPackage() . ", '" . $form->getFirstName() . "', " . "'" . $form->getLastName() . "', " . $form->getGuestsNumber() . ", " . $form->getCoupleRoom() . ", " . $form->getIndividualRoom() . ", " . $form->getDoubleRoom() . ", " . $form->getTripleRoom() . ", '" . $form->getObservation() . "', '" . $form->getEmail() . "', " . $form->getAreaCode() . ", " . $form->getPhone() . ", " . $form->getNewsletter() . ")";
$r = $con->prepare($sql);
$r->execute();
}
示例5: getUser
public function getUser($login, $password)
{
$con = new bd();
$sql = 'Select * from user where login="' . $login . '" AND password = MD5("' . $password . '")';
$r = $con->prepare($sql);
$r->execute();
$result = $r->fetch();
$user = new user($result['iduser'], $result['login'], $result['password'], $result['name'], $result['privilege']);
return $user;
}
示例6: getLastPublishedTime
public function getLastPublishedTime($uid, $sn)
{
$db = new bd();
$statement = $db->prepare("SELECT * FROM manager_stats WHERE userid=? AND social_network=? ORDER BY time DESC LIMIT 1");
if ($statement->execute(array($uid, $sn))) {
$fetch = $statement->fetchAll();
return $fetch[0]["time"];
} else {
return false;
}
}
示例7: buscarAmigos2
public function buscarAmigos2($id, $tipo = NULL, $busqueda = NULL)
{
$bd = new bd();
$querynatural = "SELECT ua.usuarios_id numero, seudonimo, CONCAT(nombre,' ', apellido) nombre, estados_id estado\n\t\t\t\t\t\t FROM usuarios_naturales un, usuarios_accesos ua, usuarios u \n\t\t\t\t\t\t WHERE u.id = un.usuarios_id AND u.id = ua.usuarios_id ";
$queryjuridico = "SELECT ua.usuarios_id numero, seudonimo, razon_social nombre, estados_id estado \n\t\t\t\t\t\t FROM usuarios_juridicos uj, usuarios_accesos ua, usuarios u \n\t\t\t\t\t\t WHERE u.id = uj.usuarios_id AND u.id = ua.usuarios_id ";
$estado = "";
$union = "";
$search = "";
if (!is_null($tipo)) {
if ($tipo == "jur") {
$querynatural = "";
} elseif ($tipo == "nat") {
$queryjuridico = "";
} elseif ($tipo == "all") {
$union = " UNION ALL ";
} elseif (is_numeric($tipo)) {
$estado = " AND estado = {$tipo} ";
$union = " UNION ALL ";
}
} else {
$union = " UNION ALL ";
}
if (!empty($busqueda)) {
$search = " AND (nombre LIKE '%{$busqueda}%' OR seudonimo LIKE '%{$busqueda}%')";
}
$statement = "SELECT numero, seudonimo, nombre, estado \n\t\t\t\t\t FROM ({$querynatural}\n\t\t\t\t\t\t {$union}\n\t\t\t\t\t\t {$queryjuridico}) tabla, usuarios_amigos \n\t\t\t\t\t WHERE usuarios_id = numero {$estado} {$search} ";
die($statement);
try {
$sql = $bd->prepare($statement);
$sql->execute(array($id));
if ($sql->rowCount() > 0) {
return $sql->fetchAll();
} else {
return false;
}
} catch (PDOException $ex) {
return $bd->showError($ex);
}
}
示例8: getLastPublishedTime
public function getLastPublishedTime($id, $sn)
{
$db = new bd();
$statement = $db->prepare("SELECT * FROM manager_stats WHERE userid=:uid AND sn=':sn' ORDER BY time DESC LIMIT 1");
$statement->bindParam(':uid', $uid);
$statement->bindParam(':sn', $sn);
$statement->execute();
$fetch = $statement->fetchAll();
return $fetch[0]["time"];
}