本文整理汇总了PHP中MysqliDb::rawQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP MysqliDb::rawQuery方法的具体用法?PHP MysqliDb::rawQuery怎么用?PHP MysqliDb::rawQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MysqliDb
的用法示例。
在下文中一共展示了MysqliDb::rawQuery方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getComentarios
/**
* @descr Obtiene las comentarios
*/
function getComentarios($post_id)
{
$db = new MysqliDb();
$results = $db->rawQuery('SELECT
c.post_comentario_id,
c.post_id,
c.titulo,
c.detalles,
c.parent_id,
c.creador_id,
c.votos_up,
c.votos_down,
c.fecha,
u.nombre,
u.apellido
FROM
posts_comentarios c
LEFT JOIN
usuarios u ON u.usuario_id = c.creador_id
WHERE
c.post_id = ' . $post_id . '
order by c.post_comentario_id;');
echo json_encode($results);
}
示例2: getListComposersDb
function getListComposersDb()
{
$db = new MysqliDb(HOST, USER, PASSWORD, DBNAME);
$query = "SELECT * FROM composers";
$composers = $db->rawQuery($query);
return $composers;
}
示例3: order_paid
function order_paid()
{
require_once './submodules/php-mysqli-database-class/MysqliDb.php';
require './includes/config.php';
$db = new MysqliDb($db_host, $db_user, $db_pass, $db_name);
$payid = $_GET['out_trade_no'];
$aPayId = explode('_', $payid);
$mtrid = $aPayId[1];
$params = json_encode($_GET);
//验证是否已经支付过
$db->where("mtr_id = '{$mtrid}'")->get('mark_trafficpolice_reward');
if ($db->count == 0) {
$aNew = array('mtr_id' => $mtrid, 'pay_id' => $payid, 'pay_success' => 1, 'pay_money' => $_GET['total_fee'], 'pay_date' => $_GET['gmt_payment'], 'pay_params' => $params, 'created_date' => $db->now());
$id = $db->insert('mark_trafficpolice_reward', $aNew);
//给用户增加余额
$sql = "SELECT mt.user_id,u.user_money FROM `mark_trafficpolice` mt\n LEFT JOIN mark_trafficpolice_received mtr ON mt.id=mtr.mt_id\n LEFT JOIN users u ON u.user_id=mt.user_id\n WHERE mtr.id= '{$mtrid}'";
$aUser = $db->rawQuery($sql);
if ($db->count) {
$aUpdate = array('user_money' => $aUser[0]['user_money'] + $_GET['total_fee'], 'updated_date' => $db->now());
$db->where('user_id', $aUser[0]['user_id']);
$db->update('users', $aUpdate);
}
} else {
echo "already rewarded";
}
}
示例4: get
$function = $_GET["function"];
if ($function == 'get') {
get();
}
}
function get()
{
$db = new MysqliDb();
$results = $db->rawQuery('select oferta_laboral_id, DATE_FORMAT(fecha,"%d-%m-%Y") fecha, titulo, detalle, cliente_id, status, 0 cliente from ofertas_laborales order by oferta_laboral_id desc');
foreach ($results as $key => $row) {
$db->where('cliente_id', $row["cliente_id"]);
示例5: GET
function GET($matches)
{
if ($matches[1]) {
$db = new MysqliDb($this->config["host"], $this->config["user"], $this->config["pass"], $this->config["base"]);
$result = $db->where('idVIP', $matches[1])->get('VIP', 1);
$realisateur = $db->where('realisateur', $matches[1])->get('film');
$params = array($matches[1]);
$acteur = $db->rawQuery("SELECT * FROM joue, film WHERE joue.idfilm = film.idfilm AND joue.idVIP = ?", $params);
$photo = $db->rawQuery("SELECT * FROM vip_photo, photo WHERE photo.idphoto = vip_photo.idphoto AND vip_photo.idVIP = ?", $params);
$data = array();
$data["vip"] = $result[0];
$data["acteur"] = $acteur;
$data["realisateur"] = $realisateur;
$data["photo"] = $photo;
if (!empty($result) && count($result) > 0) {
SimplestView::render("header");
SimplestView::render('vip', $data);
SimplestView::render("footer");
}
}
}
示例6: insertCompositionsOnDB
function insertCompositionsOnDB()
{
$composers = getListComposers();
foreach ($composers as $index => $composer) {
$slug = getSlugComposer($composer);
$relevance = $index + 1;
$db = new MysqliDb(HOST, USER, PASSWORD, DBNAME);
$query = "INSERT INTO `composers`(`slug`,`name`,`relevance`)";
$query .= " VALUES ('" . $slug . "','" . $composer . "','" . $relevance . "');";
echo $query . PHP_EOL;
$db->rawQuery($query);
}
}
示例7: insertComposersOnDB
function insertComposersOnDB()
{
$db = new MysqliDb(HOST, USER, PASSWORD, DBNAME);
$composers = getListComposersDb();
foreach ($composers as $index => $composer) {
$compositions = extractCompositionsFromSearchHtmls($composer['name']);
foreach ($compositions as $composition) {
echo "Inserting " . $composition . "..." . PHP_EOL;
$relevance = $index + 1;
$query = "INSERT INTO `compositions`(`composer_id`,`name`,`relevance`)";
$query .= " VALUES ('" . $composer['id'] . "','" . escapeSingleQuote($composition) . "','" . $relevance . "');";
$db->rawQuery($query);
}
}
}
示例8: getSlider
function getSlider($conProductos)
{
$db = new MysqliDb();
// $results = $db->get('sliders');
// $results = $db->rawQuery('Select slider_id, o.producto_id producto_id, kit_id, precio, o.descripcion descripcion,
// imagen, titulo, p.nombre producto from sliders o inner join productos p on o.producto_id = p.producto_id;');
$results = $db->rawQuery('Select oferta_id slider_id, o.producto_id producto_id, kit_id, precio, o.descripcion descripcion,
imagen, titulo, 0 producto from ofertas o;');
if ($conProductos) {
foreach ($results as $key => $row) {
$db->where('producto_id', $row["producto_id"]);
$producto = $db->get('productos');
$results[$key]["producto"] = $producto;
}
}
echo json_encode($results);
}
示例9: MysqliDb
<?php
require_once 'MysqliDb.php';
require_once 'config.php';
$db = new MysqliDb(DB_SERVER, DB_USER, DB_PASS, DB_NAME);
$table = $db->rawQuery("CREATE TABLE IF NOT EXISTS\n `auction` (\n `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,\n `auction_code` CHAR(50) NOT NULL,\n `auction_page` CHAR(150) NOT NULL,\n PRIMARY KEY(`id`)\n )\nENGINE = InnoDB\nDEFAULT CHARACTER SET = utf8");
echo 'ok';
$table2 = $db->rawQuery("CREATE TABLE IF NOT EXISTS\n `au_doc` (\n `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,\n `auction_id` INT NOT NULL,\n `au_doc_name` CHAR(250) NOT NULL,\n `au_doc_link` CHAR(250) NOT NULL,\n PRIMARY KEY(`id`)\n )\nENGINE = InnoDB\nDEFAULT CHARACTER SET = utf8");
echo 'ok';
示例10: test
foreach ($compositions as $numComposition => $composition) {
// There were some problems when retrieving the data from YouTube
// so, to avoid retrieving everything from scratch we set a start number
if ($numComposition < $startComposition) {
continue;
}
$maxResults = 25;
$youtube = new Google_Service_YouTube($client);
$searchResponse = $youtube->search->listSearch('id,snippet', array('q' => $composition['composition'] . " " . $composition['composer'], 'maxResults' => $maxResults, 'type' => 'video', 'order' => 'relevance', 'videoEmbeddable' => 'true'));
foreach ($searchResponse as $index => $result) {
$relevance = $index + 1;
$videoId = $result->getId()->getVideoId();
$videoTitle = $result->getSnippet()->getTitle();
$videoDescription = $result->getSnippet()->getDescription();
$query = "INSERT INTO `videos`(`composition_id`,`youtube_id`,`title`,`description`,`relevance` )";
$query .= " VALUES ('" . $composition['id'] . "','" . $videoId . "','" . escapeSingleQuote($videoTitle) . "','" . escapeSingleQuote($videoDescription) . "','" . $relevance . "');";
$db->rawQuery($query);
}
echo $numComposition + 1 . "/" . $countCompositions . ": Inserting videos for " . $composition['composition'] . PHP_EOL;
usleep(150);
// To avoid having problems with YouTube API quota limit
}
function test()
{
$client = new Google_Client();
$client->setApplicationName("Amadeus");
$client->setDeveloperKey(YOUTUBE_API_KEY);
$youtube = new Google_Service_YouTube($client);
$searchResponse = $youtube->search->listSearch('id,snippet', array('q' => 'test', 'maxResults' => 25, 'type' => 'video', 'order' => 'relevance', 'videoEmbeddable' => 'true'));
print_r($searchResponse);
}
示例11: printToServer
$id = $db->insert('history', $data);
break;
case 'getContractContent':
$db = new MysqliDb();
$db->where('id', $_GET['id']);
$contracts = $db->getOne('contracts');
echo json_encode($contracts);
break;
case 'getHistory':
$db = new MysqliDb();
$history = $db->rawQuery("SELECT * FROM history WHERE contract_id = ? AND doc_id = ? order by date desc", array($_POST['id'], $_POST['index']));
echo json_encode($history);
break;
case 'getHistoryId':
$db = new MysqliDb();
$history = $db->rawQuery("SELECT id,create_date FROM vwhistory WHERE contract_id = ? AND doc_id = ? order by id desc", array($_POST['id'], $_POST['index']));
echo json_encode($history);
break;
case 'saveStatus':
$db = new MysqliDb();
$db->where('id', $_GET['id']);
$data = array('initialed' => implode(",", $_POST['status']));
$templates = $db->update('contracts', $data);
echo json_encode($data);
break;
default:
# code...
break;
}
function printToServer($content, $name, $client, $folder_name, $version)
{
示例12: getCategorias
/**
* @descr Obtiene las categorias
*/
function getCategorias()
{
$db = new MysqliDb();
$results = $db->rawQuery('SELECT c.*, (select count(producto_id) from productos_categorias p where p.categoria_id= c.categoria_id) total, d.nombre nombrePadre FROM categorias c LEFT JOIN categorias d ON c.parent_id = d.categoria_id;');
echo json_encode($results);
}
示例13: getNoticias
function getNoticias()
{
$db = new MysqliDb();
$results = $db->rawQuery('Select noticia_id, titulo, detalles, fecha, creador_id, vistas, tipo, 0 fotos, 0 comentarios from noticias;');
foreach ($results as $key => $row) {
$db->where('noticia_id', $row["noticia_id"]);
$fotos = $db->get('noticias_fotos');
$results[$key]["fotos"] = $fotos;
$db->where('noticia_id', $row["noticia_id"]);
$comentarios = $db->get('noticias_comentarios');
$results[$key]["comentarios"] = $comentarios;
}
echo json_encode($results);
}
示例14: MysqliDb
<?php
require_once 'MysqliDb.php';
require_once 'config.php';
$db = new MysqliDb(DB_SERVER, DB_USER, DB_PASS, DB_NAME);
$users = $db->rawQuery("CREATE TABLE\n `users` (\n `login` CHAR(50) NOT NULL,\n `password` CHAR(150) NOT NULL,\n `name` CHAR(30) NOT NULL,\n `email` CHAR(50) NOT NULL,\n PRIMARY KEY(`login`)\n )");
echo 'ok';
示例15: stripslashes
$subject = stripslashes(trim($_POST['subject']));
$message = stripslashes(trim($_POST['message']));
$phone = stripslashes(trim($_POST['phone']));
//$name = 'sadf';
//$email = 'jayden.schulz09@gmail.com';
//$subject = 'sadf';
//$/message = 'dsf';
if (empty($name)) {
$errors['name'] = 'Name is required.';
}
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$errors['email'] = 'Email is invalid.';
}
if (empty($subject)) {
$errors['subject'] = 'Subject is required.';
}
if (empty($message)) {
$errors['message'] = 'Message is required.';
}
// if there are any errors in our errors array, return a success boolean or false
if (!empty($errors)) {
$data['success'] = false;
$data['errors'] = $errors;
} else {
$data['success'] = true;
$data['message'] = 'Congratulations. Your message has been sent successfully';
$db->rawQuery("INSERT INTO `twistitlabs`.`contacts` (`name`,`email`,`subject`,`message`, `phone`) VALUES ('{$name}','{$email}','{$subject}','{$message}', '{$phone}')");
}
// return all our data to an AJAX call
echo json_encode($data);
}