本文整理汇总了PHP中db::db_query方法的典型用法代码示例。如果您正苦于以下问题:PHP db::db_query方法的具体用法?PHP db::db_query怎么用?PHP db::db_query使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类db
的用法示例。
在下文中一共展示了db::db_query方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SelectAppliSearch
public function SelectAppliSearch($name, $enseigne, $irt, $trigramme)
{
$tabParam = array();
if ($name) {
$tabParam['libelle'] = $name;
}
if ($enseigne) {
$tabParam['enseigne'] = $enseigne;
}
if ($irt) {
$tabParam['irt'] = $irt;
}
if ($trigramme) {
$tabParam['trigramme'] = $trigramme;
}
$rq = "SELECT ID,LIBELLE,ENSEIGNE,IRT,TRIGRAMME FROM " . SCHEMA . ".APPLICATION ";
$rq .= "WHERE ";
$l = 1;
foreach ($tabParam as $key => $value) {
$or = $l != count($tabParam) ? " AND" : "";
$rq .= "UPPER(REPLACE({$key},' ','')) LIKE '%" . strtoupper(str_replace(' ', '', $value)) . "%' " . $or;
$l++;
}
$rq .= " ORDER BY NAME";
$db = new db();
$db->db_connect();
$db->db_query($rq);
$res = $db->db_fetch_array();
return $res;
}
示例2: SupprimerUtilisateur
public function SupprimerUtilisateur($id)
{
$rq = "DELETE FROM " . SCHEMA . ".UTILISATEURS_OSI WHERE ID=" . $id;
$SCHEMA = new db();
$SCHEMA->db_connect();
$SCHEMA->db_query($rq);
}
示例3: db
<?php
// ------- IMPORTANT ----- Only run this file once!
//This document creates 6 mysql database tables for the XMl system - boatdetails, descriptions, images, videos, features, engines. All are linked by BoatID
require "../classes/db.class.php";
$db = new db();
//Create Boat Details Table
$query = "CREATE TABLE boatdetails (\n BoatID int(10) NOT NULL,\n Added date NOT NULL,\n NewUsed char(4) character set utf8 default NULL,\n Make varchar(100) character set utf8 NOT NULL,\n Model varchar(100) character set utf8 NOT NULL,\n MakeModel varchar(200) character set utf8 NOT NULL,\n Length_ft float NOT NULL,\n Length_mt float NOT NULL,\n LOA float default NULL,\n LOAUnit varchar(10) character set utf8 default NULL,\n LWL float default NULL,\n LWLUnit varchar(10) character set utf8 default NULL,\n Year year(4) NOT NULL,\n Price int(11) NOT NULL,\n PriceCurrency char(3) character set utf8 NOT NULL,\n TaxStatus varchar(20) character set utf8 NOT NULL,\n Fuel varchar(15) character set utf8 NOT NULL,\n HullMaterial varchar(20) character set utf8 NOT NULL,\n Keel varchar(15) character set utf8 NOT NULL,\n Designer varchar(50) character set utf8 default NULL,\n Builder varchar(50) character set utf8 default NULL,\n Name varchar(50) character set utf8 default NULL,\n Status varchar(15) character set utf8 default NULL,\n Coop char(5) character set utf8 default NULL,\n Category varchar(50) character set utf8 NOT NULL,\n Class varchar(50) character set utf8 NOT NULL,\n Description text character set utf8 NOT NULL,\n LocationCountry char(100) character set utf8 NOT NULL,\n LocationCity varchar(40) character set utf8 NOT NULL,\n LocationState varchar(20) character set utf8 default NULL,\n Company varchar(30) character set utf8 NOT NULL,\n OfficeID mediumint(9) default NULL,\n BrokerName varchar(30) character set utf8 NOT NULL,\n BrokerEmail varchar(40) character set utf8 NOT NULL,\n BrokerTel varchar(20) character set utf8 NOT NULL,\n BrokerFax varchar(20) character set utf8 default NULL,\n Beam float default NULL,\n BeamUnit varchar(10) character set utf8 default NULL,\n BridgeClearance float default NULL,\n BridgeClearanceUnit varchar(10) character set utf8 default NULL,\n MinDraft float default NULL,\n MinDraftUnit varchar(10) character set utf8 default NULL,\n MaxDraft float default NULL,\n MaxDraftUnit varchar(10) character set utf8 default NULL,\n CabinHeadroom float default NULL,\n CabinHeadroomUnit varchar(10) character set utf8 default NULL,\n Freeboard float default NULL,\n FreeboardUnit varchar(10) character set utf8 default NULL,\n DryWeight float default NULL,\n DryWeightUnit varchar(10) character set utf8 default NULL,\n Ballast float default NULL,\n BallastUnit varchar(10) character set utf8 default NULL,\n Displacement float default NULL,\n DisplacementUnit varchar(10) character set utf8 default NULL,\n CruisingSpeed smallint(6) default NULL,\n CruisingSpeedUnit varchar(10) character set utf8 default NULL,\n MaxSpeed smallint(6) default NULL,\n MaxSpeedUnit varchar(10) character set utf8 default NULL,\n FuelTankCap smallint(6) default NULL,\n FuelTankCapUnit varchar(10) character set utf8 default NULL,\n FuelTankNo tinyint(4) default NULL,\n WaterTankCap smallint(6) default NULL,\n WaterTankCapUnit varchar(10) character set utf8 default NULL,\n WaterTankNo tinyint(4) default NULL,\n HoldingTankCap smallint(6) default NULL,\n HoldingTankCapUnit varchar(10) character set utf8 default NULL,\n HoldingTankNo tinyint(4) default NULL,\n SingleBerthNo tinyint(4) default NULL,\n DoubleBerthNo tinyint(4) default NULL,\n TwinBerthNo tinyint(4) default NULL,\n CabinNo tinyint(4) default NULL,\n BathroomNo tinyint(4) default NULL,\n HeadNo tinyint(4) default NULL,\n PRIMARY KEY (BoatID),\n FULLTEXT KEY MakeModel (MakeModel)\n)";
$result = $db->db_query($query);
if (!$result) {
die("Database access failed");
}
//Create Descriptions Table
$query = "CREATE TABLE descriptions (\n\tBoatID INT NOT NULL,\n\tAddTitle VARCHAR(150) CHARACTER SET utf8 NOT NULL,\n\tAddDescription TEXT CHARACTER SET utf8 NOT NULL\n\t\t)";
$result = $db->db_query($query);
if (!$result) {
die("Database access failed");
}
//Create Images Table
$query = "CREATE TABLE images (\n\tBoatID INT NOT NULL,\n\tImageURL VARCHAR(100) CHARACTER SET utf8 NOT NULL,\n\tImageRanking CHAR(2) CHARACTER SET utf8 NOT NULL,\n\tImageTitle VARCHAR(150) CHARACTER SET utf8 NOT NULL\n\t\t)";
$result = $db->db_query($query);
if (!$result) {
die("Database access failed");
}
//Create Videos Table
$query = "CREATE TABLE videos (\n\tBoatID INT NOT NULL,\n\tVideoURL VARCHAR(150) CHARACTER SET utf8 NOT NULL,\n\tVideoTitle VARCHAR(150) CHARACTER SET utf8 NOT NULL,\n\tVideoThumb VARCHAR(100) CHARACTER SET utf8 NOT NULL,\n\tVideoEmbed TEXT CHARACTER SET utf8 NOT NULL\n\t\t)";
$result = $db->db_query($query);
if (!$result) {
die("Database access failed");
}
//Create Features Table
示例4:
<fb:like href="<?php
echo $url;
?>
" send="true" width="470" show_faces="true" font=""></fb:like>
<br/><br/>
</div>
<!-- START IMAGE GALLERY -->
<?php
$boatid = $_GET['BoatID'];
?>
<div id="image-gallery">
<div id="gallery">
<?php
$Query = "SELECT * FROM images WHERE BoatID={$id}";
$imagedata = $db->db_query($Query);
while ($image = $db->db_rs($imagedata)) {
?>
<img src="<?php
echo $image['ImageURL'];
?>
" /><br/>
<?php
}
?>
</div>
<script type="text/javascript">
Galleria.loadTheme('galleria/themes/classic/galleria.classic.min.js');
$("#gallery").galleria({
autoplay: 5000,
width: 650,
示例5: db
<?php
session_start();
$login = $_POST['Username'];
$pass = $_POST['Userpasswd'];
if (isset($login) && $login && isset($pass) && $pass) {
require_once '../inc/config.inc.php';
require_once '../classes/db.php';
require_once '../inc/fonctions.inc.php';
$rq = "SELECT ID,NOM,PRENOM,MAIL,LOGIN,PASSWD,PROFIL FROM " . SCHEMA . ".UTILISATEURS_OSI WHERE LOGIN='" . $login . "'";
$SCHEMA = new db();
$SCHEMA->db_connect();
$SCHEMA->db_query($rq);
$res = $SCHEMA->db_fetch_array();
$total = $SCHEMA->total_record();
if ($res[0]) {
if (password_verify($pass, $res[0][5])) {
$_SESSION['auth'] = $res[0];
unset($_SESSION['flash']);
$_SESSION['flash']['success'] = "Vous êtes connecté.";
$contenu_fichier_json = file_get_contents('../inc/TraceFiche.json');
$tr = json_decode($contenu_fichier_json, true);
if (is_array($tr)) {
foreach ($tr as $key => $value) {
if ($value['user'] == $userConnected) {
unset($tr[$key]);
}
}
}
$json = json_encode($tr);
file_put_contents('../inc/TraceFiche.json', $json);
示例6: array
<?php
//This document imports the XML feeds from the spice rack service, you will need to set up a cron job to run this file once a day or more often if the client requires it
ini_set('max_execution_time', '160');
//Set IMT Spicerack URLS, add a new line in the array for each office URL, comment out code below to use elba single broker feed
$urls = array("http://account.boatwizard.com/spice-rack/owner/6105/boats?status=on", "http://account.boatwizard.com/spice-rack/owner/19462/boats?status=on", "http://account.boatwizard.com/spice-rack/owner/19486/boats?status=on");
//-------------No need to edit below this line--------------
//Include Database File
require "classes/db.class.php";
$db = new db();
//Clear Database
$clear = "DELETE FROM boatdetails";
$db->db_query($clear);
$clear = "DELETE FROM descriptions";
$db->db_query($clear);
$clear = "DELETE FROM engines";
$db->db_query($clear);
$clear = "DELETE FROM features";
$db->db_query($clear);
$clear = "DELETE FROM images";
$db->db_query($clear);
$clear = "DELETE FROM videos";
$db->db_query($clear);
$clear = "DELETE FROM currencies";
$db->db_query($clear);
//Import currencies
$currencycodes = array("AUD", "CAD", "DKK", "EUR", "NZD", "NOK", "GBP", "RUB", "SEK", "USD");
foreach ($currencycodes as $currencycode) {
if ($currencycode == "EUR") {
$rate = 1;
} else {
示例7: SelectStat
/**
* Selectionnez la liste des stats
*
* @return $none
*/
public function SelectStat()
{
$requette = "SELECT ID,REFCHANGEMENT,DATEPUBIR,DATEPUBPM,TYPECAUSE,TYPECAUSESECONDAIRE,TYPOLIGYGTS,KINDIMPACT,RESPONSIBLETEAM,FOURNISSEURRESPONSIBLE,POWERPROD,LEGACY,COMPOSANT,COMPOSANTCOMPLEMENT,ZONEGEOGRAPHIQUE ";
$requette = "FROM " . SCHEMA . ".STATISTIQUE ";
$db = new db();
$db->db_connect();
$db->db_query($requette);
$res = $db->db_fetch_array();
$db->close();
$tab = array();
for ($i = 0; $i < count($res); $i++) {
$valeur = $res[$i];
array_push($tab, $this->SetParam($valeur[0], $valeur[1], $valeur[2], $valeur[3], $valeur[4], $valeur[5], $valeur[6], $valeur[7], $valeur[8], $valeur[9], $valeur[10], $valeur[11], $valeur[12], $valeur[13], $valeur[14]));
}
return $tab;
}
示例8: Supprimer
public function Supprimer()
{
$base = new db();
$base->db_connect();
//Suppression de Stat
if ($this->getIdStat()) {
$rq = "DELETE FROM " . SCHEMA . ".STATISTIQUE ";
$rq .= "WHERE ID=" . $this->getIdStat();
$base->db_query($rq);
}
//Suppression d'impact
$rq = "DELETE FROM " . SCHEMA . ".IMPACT ";
$rq .= "WHERE INCIDENT_ID=" . $this->getNumero();
$base->db_query($rq);
// SUppression de l'incident
$rq = "DELETE FROM " . SCHEMA . ".INCIDENT ";
$rq .= "WHERE ID=" . $this->getNumero();
$base->db_query($rq);
$base->close();
}
示例9: pdffullspecs
$pdf = new pdffullspecs('P', 'mm', 'A4');
$pdf->SetDrawColor(153, 153, 153);
$pdf->SetBoat($boat);
$pdf->AddFont('Verdana', '', 'verdana.php');
$pdf->AddFont('Verdana-Bold', '', 'verdanab.php');
$pdf->SetMargins(MARGIN + TITLE_MARGIN, 0, MARGIN + TITLE_MARGIN);
$pdf->SetTitle($boat['Year'] . " " . $boat['Make'] . " " . $boat['Model'] . " - " . $boat['PriceCurrency'] . " " . $boat['Price']);
$pdf->AddPageExplicit();
$pdf->SetTextColor(0, 0, 0);
//create title
$pdf->Title($boat['Make'] . " " . $boat['Model']);
$pdf->Cell(CONTENT_WIDTH, 4, "Price: " . $boat['PriceCurrency'] . $boat['Price'], 0, 0, "L");
$pdf->Ln(TITLE_MARGIN);
// print main image
$Queryboat = "SELECT * FROM images WHERE BoatID={$id} ORDER BY ImageRanking LIMIT 0, 1";
$imagedata = $db->db_query($Queryboat);
while ($image = $db->db_rs($imagedata)) {
list($width, $height) = getimagesize($image['ImageURL']);
$height_ratio = MAX_IMAGE_HEIGHT / $height;
$width_ratio = MAX_IMAGE_WIDTH / $width;
$scale = $width_ratio < $height_ratio ? $width_ratio : $height_ratio;
$image_height = $height * $scale;
$image_width = $width * $scale;
$x_offset = (CONTENT_WIDTH - $image_width) / 2;
$pdf->Image($image['ImageURL'], $x_offset + MARGIN + TITLE_MARGIN, null, $image_width, $image_height);
}
// Print out the introduction
$pdf->Cell(INTRO1_WIDTH, INTRO_HEIGHT, "", 0, 0, "L");
$pdf->Cell(INTRO2_WIDTH - INTRO1_WIDTH, INTRO_HEIGHT, "", 0, 1, "L");
$pdf->SetFont('helvetica', '', 9);
$secondColumnX = $pdf->GetX() + INTRO1_WIDTH;
示例10: Supprimer
/**
* Modification d'un objet
*
* @return mixed
*/
public function Supprimer($id)
{
$rq = "DELETE FROM " . SCHEMA . ".CALENDRIER";
$rq .= " WHERE ID=" . $id;
$db = new db();
$db->db_connect();
$db->db_query($rq);
$db->close();
}
示例11:
</div>
</div>
</div>
<section>
<div class="row">
<div class="span12">
<!-- content-wrap starts here -->
<div id="content-wrap">
<form name="sortandfilter" class="" action="<?php echo $searchurl;?>" method="get">
<div id="boat-content">
<!-- START PAGE NUMBERS -->
<div id="page-numbers">
<?php
$result=$db->db_query($Query);
$all_result=$db->db_rows($result);
// calculate total number of pages needed
$pages=ceil($all_result/$results_per_page);
//Calculate offset based on current page
if (isset($_GET['page'])){
$offset=$results_per_page*($_GET['page']-1);
}else{
$offset=0;
}
//Finalise query adding offset and number of results per page
$Query.= " LIMIT $offset, $results_per_page";
示例12: chargerImpact
public function chargerImpact($id)
{
$req = "SELECT ID,INCIDENT_ID,APPLICATION_ID,TO_CHAR(DATESTART,'DD/MM/YYYY HH24:MI'),TO_CHAR(DATEEND,'DD/MM/YYYY HH24:MI'),DUREEREELLE,JOURHOMME,IMPACTMETIER,IMPACT,SLA,SEVERITE,DESCRIPTION,CREATED,UPDATED ";
$req .= "FROM " . SCHEMA . ".IMPACT WHERE ID=" . $id . " ";
$req .= "ORDER BY ID ASC";
$base = new db();
$base->db_connect();
$base->db_query($req);
$res = $base->db_fetch_array();
$base->close();
$this->setParam($res[0][0], $res[0][1], $res[0][2], $res[0][3], $res[0][4], $res[0][5], $res[0][6], $res[0][7], $res[0][8], $res[0][9], $res[0][10], $res[0][11], $res[0][12], $res[0][13]);
return $this;
}
示例13: incidents
require_once '../inc/fonctions.inc.php';
require_once '../classes/db.php';
require_once '../classes/incidents.php';
if (isset($_GET['supprimer'])) {
$incidents = new incidents();
$incidents->chargerIncident($_GET['id']);
$incidents->Supprimer();
$contenu_fichier_json = file_get_contents('../inc/TraceFiche.json');
$tr = json_decode($contenu_fichier_json, true);
unset($tr[$_GET['id']]);
$json = json_encode($tr);
file_put_contents('../inc/TraceFiche.json', $json);
$_SESSION['flash']['success'] = "L'incident est bien supprimé!";
}
$req = "SELECT ID,INCIDENT FROM " . SCHEMA . ".INCIDENT";
$req .= " ORDER BY ID DESC";
$db = new db();
$db->db_connect();
$db->db_query($req);
$res = $db->db_fetch_array();
if (!isset($res[0][0])) {
require_once '../inc/header.inc.php';
?>
<h1>Pas d'incidents</h1>
<a class="btn btn-success" href="add.php">Ajouter Incident</a>
<?php
require_once '../inc/footer.inc.php';
} else {
header('Location:modif.php?id=' . $res[0][0]);
}
//debug($res);