本文整理汇总了PHP中Sql_query函数的典型用法代码示例。如果您正苦于以下问题:PHP Sql_query函数的具体用法?PHP Sql_query怎么用?PHP Sql_query使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Sql_query函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fill
function fill($prefix, $listid)
{
global $server_name, $tables, $table_prefix;
# check for not too many
$domain = getConfig('domain');
$res = Sql_query("select count(*) from {$tables['user']}");
$row = Sql_fetch_row($res);
if ($row[0] > 50000) {
error('Hmm, I think 50 thousand users is quite enough for a test<br/>This machine does need to do other things you know.');
print '<script language="Javascript" type="text/javascript"> document.forms[0].output.value="Done. Now there are ' . $row[0] . ' users in the database";</script>' . "\n";
return 0;
}
# fill the database with "users" who have any combination of attribute values
$attributes = array();
$res = Sql_query("select * from {$tables['attribute']} where type = \"select\" or type = \"checkbox\" or type=\"radio\"");
$num_attributes = Sql_Affected_rows();
$total_attr = 0;
$total_val = 0;
while ($row = Sql_fetch_array($res)) {
array_push($attributes, $row['id']);
++$total_attr;
$values[$row['id']] = array();
$res2 = Sql_query("select * from {$table_prefix}" . 'listattr_' . $row['tablename']);
while ($row2 = Sql_fetch_array($res2)) {
array_push($values[$row['id']], $row2['id']);
++$total_val;
}
}
$total = $total_attr * $total_val;
if (!$total) {
Fatal_Error('Can only do stress test when some attributes exist');
return 0;
}
for ($i = 0; $i < $total; ++$i) {
$data = array();
reset($attributes);
while (list($key, $val) = each($attributes)) {
$data[$val] = current($values[$val]);
if (!$data[$val]) {
reset($values[$val]);
$data[$val] = current($values[$val]);
}
next($values[$val]);
}
$query = sprintf('insert into %s (email,entered,confirmed) values("testuser%s",now(),1)', $tables['user'], $prefix . '-' . $i . '@' . $domain);
$result = Sql_query($query, 0);
$userid = Sql_insert_id();
if ($userid) {
$result = Sql_query("replace into {$tables['listuser']} (userid,listid,entered) values({$userid},{$listid},now())");
reset($data);
while (list($key, $val) = each($data)) {
if ($key && $val) {
Sql_query("replace into {$tables['user_attribute']} (attributeid,userid,value) values(" . $key . ",{$userid}," . $val . ')');
}
}
}
}
return 1;
}
示例2: Subcategories_getBySuperCat
function Subcategories_getBySuperCat($super_category)
{
$sql = "SELECT * FROM sub_category WHERE super_cat = '" . $super_category . "'";
return Sql_query($sql);
}
示例3: Sql_query
<p>На этой странице Вы можете подготовить письмо для дальнейшей отправки. Можно указать всю необходимую информацию, исключая списки рассылки для отправки. Затем, в момент отправки подготовленного письма, можно будет выбрать списки рассылки и письмо будет отправлено. </p>
<p>Ваше подготовленное письмо постоянно, то есть оно не исчезнет после отправки и может быть использовано много раз повторно. Будьте осторожны, пользуясь этой возможностью, потому что это может привести к тому, что Вы будете отправлять одни и те же письма Вашим подписчикам несколько раз.</p>
<p> Эта функциональность специально реализована с целью использовать при совместной работе в системе нескольких администраторов. Если главный администратор готовит такое письмо, простые администраторы могут отправлять его по своим спискам рассылки. В этом случае, Вы можете использовать дополнительные метки в письме: атрибуты администратора.</p>
<p>Для примера, если у Вас есть атрибут администратора <b>Name</b> (Имя), Вы можете добавить метку [LISTOWNER.NAME], она будет заменена на <b>Имя</b> владельца списка, кому производится отправка этого письма. Значение будет установлено вне зависимости от того, кто отправляет письмо. Таким образом, если главный администратор отправляет письмо по списку, которые принадлежит кому-то ещё, метка [LISTOWNER] будет заменена на значение владельца списка, а не значения главного администратора.</p>
<p>Для справки:<br/>
Метка [LISTOWNER] задаётся в формате <b>[LISTOWNER.АТРИБУТ]</b></p>
<p>На текущий момент заданы следующие атрибуты администратора:
<table border=1><tr><td><b>Атрибут</b></td><td><b>Метка</b></td></tr>
<?php
$req = Sql_query("select name from {$tables['adminattribute']} order by listorder");
if (!Sql_Affected_Rows()) {
print '<tr><td colspan=2>Атрибутов администратора нет</td></tr>';
}
while ($row = Sql_Fetch_Row($req)) {
if (strlen($row[0]) < 20) {
printf('<tr><td>%s</td><td>[LISTOWNER.%s]</td></tr>', $row[0], strtoupper($row[0]));
}
}
?>
</p>
示例4: Users_getByID
function Users_getByID($id)
{
$sql = "SELECT * FROM users WHERE id = " . $id;
return Sql_query($sql)[0];
}
示例5: Error
if (sizeof($_POST) || $_GET["unblacklist"]) {
print Error($GLOBALS['I18N']->get('you only have privileges to view this page, not change any of the information'));
return;
}
break;
case "none":
default:
$subselect = " and " . $tables["list"] . ".id = 0";
break;
}
if (isset($_GET["unblacklist"])) {
$unblacklist = sprintf('%d', $_GET["unblacklist"]);
unBlackList($unblacklist);
Redirect("userhistory&id=" . $unblacklist);
}
$result = Sql_query("SELECT * FROM {$tables["user"]} where id = {$id}");
if (!Sql_Affected_Rows()) {
Fatal_Error($GLOBALS['I18N']->get('no such User'));
return;
}
$user = sql_fetch_array($result);
print '<h3>' . $GLOBALS['I18N']->get('user') . ' ' . PageLink2("user&id=" . $user["id"], $user["email"]) . '</h3>';
print '<div class="actions">';
//printf('<a href="%s" class="button">%s</a>',getConfig("preferencesurl").
//'&uid='.$user["uniqid"],$GLOBALS['I18N']->get('update page'));
//printf('<a href="%s" class="button">%s</a>',getConfig("unsubscribeurl").'&uid='.$user["uniqid"],$GLOBALS['I18N']->get('unsubscribe page'));
print PageLinkButton("user&id={$id}", $GLOBALS['I18N']->get('Details'));
if ($access != "view") {
printf("<a class=\"delete button\" href=\"javascript:deleteRec('%s');\">" . $GLOBALS['I18N']->get('delete') . "</a>", PageURL2("user", "", "delete={$id}"));
}
print '</div>';
示例6: sprintf
$count_query = sprintf('select * from %s where id in (%s)', $GLOBALS['tables']['user'], join(', ', $userids));
if (!empty($_GET["calculate"])) {
printf('.. ' . $GLOBALS['I18N']->get('%d users apply'), $num_users) . '</p>';
}
if ($messageid) {
Sql_query(sprintf('update %s set userselection = "%s" where id = %d', $tables["message"], addslashes($count_query), $messageid));
}
if (!isset($_GET['calculate'])) {
$ls->addButton($GLOBALS['I18N']->get("calculate"), $baseurl . '&tab=' . $_GET["tab"] . '&calculate=1');
} else {
$ls->addButton($GLOBALS['I18N']->get("reload"), $baseurl . '&tab=' . $_GET["tab"]);
}
$existing_criteria = $ls->display();
} else {
if ($messageid) {
Sql_query(sprintf('update %s set userselection = "" where id = %d', $tables["message"], $messageid));
}
}
}
// end of define STACKED_ATTRIBUTES
##############################
# Stacked attributes, end
##############################
// Pull in $footer variable from post
if (isset($_POST["footer"])) {
$footer = $_POST["footer"];
}
// If $id wasn't passed in (if it was passed, then $_POST should have
// the database value in it already, and if it's empty, then we should
// leave it empty) and $footer is blank, load the default.
if (!$footer) {
示例7: Arbo_construire
function Arbo_construire($code_arbo = '', $type = 'article')
{
/*=============*/
Lib_myLog("Recuperation de l'arbo a partir de la BDD");
if ($type == 'tache') {
// On récupère tous les taches de la base
$args_taches['id_tache'] = '*';
$liste_taches = Taches_chercher($args_taches);
$tab_intitules = array();
foreach ($liste_taches as $tache) {
$tab_intitules[$tache['id_tache']] = $tache['titre'];
$tab_etats[$tache['id_tache']] = $tache['etat'];
$tab_priorites[$tache['id_tache']] = $tache['data1'];
}
}
if ($type == 'article') {
// On récupère tous les articles de la base
$args_articles['id_article'] = '*';
$liste_articles = Articles_chercher($args_articles);
$tab_intitules = array();
$tab_urls = array();
foreach ($liste_articles as $article) {
$tab_intitules[$article['id_article']] = $article['titre'];
$tab_etats[$article['id_article']] = $article['etat'];
$tab_urls[$article['id_article']] = $article['meta_url'];
}
}
$sql = " SELECT * \n\t\t\tFROM " . $GLOBALS['prefix'] . "arbo\n\t\t\tWHERE code_arbo = '{$code_arbo}'\n\t\t\tORDER BY famille ASC, ordre ASC";
$result = Sql_query($sql);
$tab_sql = array();
if ($result && Sql_errorCode($result) === "00000") {
while ($row = Sql_fetch($result)) {
$id = $row['id_arbo'];
$id_pere = $row['id_pere'];
$type_pere = $row['type_pere'];
$tab_sql[$id]["id_arbo"] = $id;
$tab_sql[$id]["id_arbo_pere"] = $row['id_arbo_pere'];
$tab_sql[$id]["code_arbo"] = $row['code_arbo'];
$tab_sql[$id]["famille"] = $row['famille'];
$tab_sql[$id]["id_pere"] = $id_pere;
if ($type == 'tache') {
$tab_sql[$id]["tache"] = $liste_taches[$id_pere];
}
if ($type == 'article') {
$tab_sql[$id]["article"] = $liste_articles[$id_pere];
}
$tab_sql[$id]["type_pere"] = $type_pere;
$tab_sql[$id]["ordre"] = $row['ordre'];
$tab_sql[$id]["couleur"] = $row['couleur'];
$tab_sql[$id]["etat"] = ($type_pere == 'article' || $type_pere == 'tache') && isset($tab_etats[$id_pere]) && $tab_etats[$id_pere] != '' ? $tab_etats[$id_pere] : $row['etat'];
$tab_sql[$id]["intitule"] = ($type_pere == 'article' || $type_pere == 'tache') && isset($tab_intitules[$id_pere]) && $tab_intitules[$id_pere] != '' ? $tab_intitules[$id_pere] : Sql_prepareTexteAffichage($row['intitule']);
$tab_sql[$id]["intitule_canonize"] = $row['intitule_canonize'];
$tab_sql[$id]["priorite"] = $type_pere == 'tache' && isset($tab_priorites[$id_pere]) && $tab_priorites[$id_pere] != '' ? $tab_priorites[$id_pere] : '';
if ($type_pere == 'tache' && isset($tab_etats[$id_pere]) && $tab_etats[$id_pere] == 'inactif') {
if ($row['famille'] != '' && $row['id_arbo_pere'] == 0) {
$tab_famille = explode('-', $row['famille']);
$index_pere = count($tab_famille) - 2;
$tab_sql[$tab_famille[$index_pere]]['nb_taches_a_faire']++;
if (!empty($tab_famille[$index_pere - 1])) {
$tab_sql[$tab_famille[$index_pere - 1]]['nb_taches_a_faire']++;
}
} else {
$tab_sql[$id]['nb_taches_a_faire'] = 0;
}
}
if ($type_pere == 'tache' && isset($tab_etats[$id_pere]) && $tab_etats[$id_pere] == 'actif') {
if ($row['famille'] != '' && $row['id_arbo_pere'] == 0) {
$tab_famille = explode('-', $row['famille']);
$index_pere = count($tab_famille) - 2;
$tab_sql[$tab_famille[$index_pere]]['nb_taches_terminees']++;
if (!empty($tab_famille[$index_pere - 1])) {
$tab_sql[$tab_famille[$index_pere - 1]]['nb_taches_terminees']++;
}
} else {
$tab_sql[$id]['nb_taches_terminees'] = 0;
}
}
// On détermine le niveau de profondeur dans l'arborescence
$tab_sql[$id]["niveau"] = substr_count($row['famille'], "-");
}
}
/*=============*/
Lib_myLog("Tab sql:", $tab_sql);
/*=============*/
Lib_myLog("Construction de l'arbo");
$tab_result = Arbo_getTab($tab_sql, 0, '');
return $tab_result;
}
示例8: deleteBounce
function deleteBounce($id = 0)
{
if (!$id) {
return;
}
$id = sprintf('%d', $id);
Sql_query(sprintf('delete from %s where id = %d', $GLOBALS['tables']['bounce'], $id));
Sql_query(sprintf('delete from %s where bounce = %d', $GLOBALS['tables']['user_message_bounce'], $id));
Sql_query(sprintf('delete from %s where bounce = %d', $GLOBALS['tables']['bounceregex_bounce'], $id));
}
示例9: elseif
?>
'
FCKConfig.SmileyImages = [<?php
echo $smileys;
?>
] ;
FCKConfig.SmileyColumns = 8 ;
FCKConfig.SmileyWindowWidth = 320 ;
FCKConfig.SmileyWindowHeight = 240 ;
<?php
exit;
} elseif ($_GET['action'] == 'js4') {
ob_end_clean();
header('Content-type: text/plain');
$req = Sql_query(sprintf('select name from %s where type in ("textline","select") order by listorder', $GLOBALS['tables']['attribute']));
$attnames = ';preferences url;unsubscribe url';
$attcodes = ';[PREFERENCES];[UNSUBSCRIBE]';
while ($row = Sql_Fetch_Row($req)) {
$attnames .= ';' . strtolower(substr($row[0], 0, 15));
$attcodes .= ';[' . strtoupper($row[0]) . ']';
}
$imgdir = $_SERVER['DOCUMENT_ROOT'] . $GLOBALS['pageroot'] . '/' . FCKIMAGES_DIR . '/';
$enable_image_upload = is_dir($imgdir) && is_writable($imgdir) ? 'true' : 'false';
if (defined('UPLOADIMAGES_DIR')) {
$imgdir = $_SERVER['DOCUMENT_ROOT'] . '/' . UPLOADIMAGES_DIR . '/';
$enable_image_upload = is_dir($imgdir) && is_writable($imgdir) ? 'true' : 'false';
}
$smileypath = $_SERVER['DOCUMENT_ROOT'] . $GLOBALS['pageroot'] . '/images/smiley';
$smileyextensions = array('gif');
$smileys = '';
示例10: Sql_query
In het bericht veld kan u "variabelen" gebruiken, die zullen worden vervangen met de overeenkomstige info voor een gebruiker:
<br />De variabelen moeten van de vorm <b>[NAAM]</b> zijn, waar NAAM kan worden vervangen met de naam van een van je attributen.
<br />Bijvoorbeeld als u een attribuut "Voornaam" heeft, plaats [VOORNAAM] ergens in het bericht om aan te duiden waar de "Voornaam" waarde van de ontvangers moet worden ingevoegd.
</p><p>Momenteel heeft u de volgende attributen ingesteld:
<table border=1><tr><td><b>Attribuut</b></td><td><b>Placeholder</b></td></tr>
<?php
$req = Sql_query("select name from {$tables["attribute"]} order by listorder");
while ($row = Sql_Fetch_Row($req)) {
if (strlen($row[0]) < 20) {
printf('<tr><td>%s</td><td>[%s]</td></tr>', $row[0], strtoupper($row[0]));
}
}
print '</table>';
if (ENABLE_RSS) {
?>
<p>U kan een templates aanmaken voor berichten die worden verzonden met RSS items. Om dit te doen, klik op de "Tijdsschema" tab en duid de frequentie
voor het bericht aan. Het bericht zal dan worden gebruikt om de lijst met items naar gebruikers op de lijst te verzenden, die deze frequentie hebben ingesteld.
U moet het veld (of placeholder) [RSS] in je bericht gebruiken om aan te duiden waar de lijst moet komen.</p>
<?php
}
?>
<p>Om de inhoud van een webpagina te verzenden, voeg de volgende toe aan de inhoud van je bericht:<br/>
<b>[URL:</b>http://www.voorbeeld.be/pad/naar/bestand.html<b>]</b></p>
<p>U kan eenvoudige gebruikers info toevoegen aan deze URL, geen attribuut informatie:</br>
<b>[URL:</b>http://www.voorbeeld.org/gebruikersprofiel.php?email=<b>[</b>email<b>]]</b><br/>
</p>
示例11: ListAvailableLists
function ListAvailableLists($userid = 0,$lists_to_show = "") {
global $tables;
$list = $_POST["list"];
$subselect = "";$listset = array();
$showlists = explode(",",$lists_to_show);
foreach ($showlists as $listid)
if (preg_match("/^\d+$/",$listid))
array_push($listset,$listid);
if (sizeof($listset) >= 1) {
$subselect = "where id in (".join(",",$listset).") ";
}
$some = 0;
$html = '<ul class="list">';
$result = Sql_query("SELECT * FROM {$tables["list"]} $subselect order by listorder");
while ($row = Sql_fetch_array($result)) {
if ($row["active"]) {
$html .= '<li class="list"><input type="checkbox" name="list['.$row["id"] . ']" value=signup ';
if ($list[$row["id"]] == "signup")
$html .= "checked";
if ($userid) {
$req = Sql_Fetch_Row_Query(sprintf('select userid from %s where userid = %d and listid = %d',
$tables["listuser"],$userid,$row["id"]));
if (Sql_Affected_Rows())
$html .= "checked";
}
$html .= "/><b>".$row["name"].'</b><div class="listdescription">';
$desc = nl2br(StripSlashes($row["description"]));
$html .= '<input type=hidden name="listname['.$row["id"] . ']" value="'.$row["name"].'"/>';
$html .= $desc.'</div></li>';
$some++;
if ($some == 1) {
$singlelisthtml = sprintf('<input type="hidden" name="list[%d]" value="signup">',$row["id"]);
$singlelisthtml .= '<input type="hidden" name="listname['.$row["id"] . ']" value="'.$row["name"].'"/>';
}
}
}
$html .= '</ul>';
$hidesinglelist = getConfig("hide_single_list");
if (!$some) {
global $strNotAvailable;
return '<p>'.$strNotAvailable.'</p>';
} elseif ($some == 1 && $hidesinglelist == "true") {
return $singlelisthtml;
} else {
global $strPleaseSelect;
return '<p>'.$strPleaseSelect .':</p>'.$html;
}
}
示例12: date
$timeleft = ($num_users - $sent) * $secpermsg;
$eta = date('D j M H:i', time() + $timeleft);
setMessageData($messageid, 'ETA', $eta);
setMessageData($messageid, 'msg/hr', $msgperhour);
setMessageData($messageid, 'to process', $num_users - $sent);
}
$processed = $notsent + $sent + $invalid + $unconfirmed + $cannotsend + $failed_sent;
output($GLOBALS['I18N']->get('Processed') . ' ' . $processed . ' ' . $GLOBALS['I18N']->get('out of') . ' ' . $num_users . ' ' . $GLOBALS['I18N']->get('users'));
if ($num_users - $sent <= 0) {
# this message is done
if (!$someusers) {
output($GLOBALS['I18N']->get('Hmmm, No users found to send to'));
}
if (!$failed_sent) {
repeatMessage($messageid);
$status = Sql_query(sprintf('update %s set status = "sent",sent = now() where id = %d', $GLOBALS['tables']['message'], $messageid));
if (!empty($msgdata['notify_end']) && !isset($msgdata['end_notified'])) {
$notifications = explode(',', $msgdata['notify_end']);
foreach ($notifications as $notification) {
sendMail($notification, $GLOBALS['I18N']->get('Message Sending has finished'), sprintf($GLOBALS['I18N']->get('phplist has finished sending the message with subject %s'), $message['subject']));
}
Sql_Query(sprintf('insert ignore into %s (name,id,data) values("end_notified",%d,now())', $GLOBALS['tables']['messagedata'], $messageid));
}
$timetaken = Sql_Fetch_Row_query("select sent,sendstart from {$tables['message']} where id = \"{$messageid}\"");
output($GLOBALS['I18N']->get('It took') . ' ' . timeDiff($timetaken[0], $timetaken[1]) . ' ' . $GLOBALS['I18N']->get('to send this message'));
sendMessageStats($messageid);
}
} else {
if ($script_stage < 5) {
$script_stage = 5;
}
示例13: Saveurs_chercher
/**
Retourne un tableau de saveurs correspondant aux champs du tableau en argument.
@param $args
*/
function Saveurs_chercher($args)
{
$count = 0;
$tab_result = array();
if (isset($args['count'])) {
$sql = " SELECT count(*) nb_enregistrements \n\t\t\t\t\tFROM " . $GLOBALS['prefix'] . "saveur\n\t\t\t\t\tWHERE 1";
} else {
$sql = " SELECT * \n\t\t\t\t\tFROM " . $GLOBALS['prefix'] . "saveur\n\t\t\t\t\tWHERE 1";
}
if (!isset($args['id_saveur']) && !isset($args['pourcent_eth0_dans_arome_pur_1']) && !isset($args['pourcent_eth0_dans_arome_pur_2']) && !isset($args['pourcent_eth0_dans_arome_pur_3']) && !isset($args['pourcent_eth0_dans_arome_pur_4']) && !isset($args['pourcent_eth0_dans_arome_pur_5']) && !isset($args['pourcent_eth0_dans_arome_pur_6']) && !isset($args['pourcent_arome_pur_dans_arome_prod_1']) && !isset($args['pourcent_arome_pur_dans_arome_prod_2']) && !isset($args['pourcent_arome_pur_dans_arome_prod_3']) && !isset($args['pourcent_arome_pur_dans_arome_prod_4']) && !isset($args['pourcent_arome_pur_dans_arome_prod_5']) && !isset($args['pourcent_arome_pur_dans_arome_prod_6']) && !isset($args['pourcent_alcool_prod_dans_arome_prod']) && !isset($args['pourcent_eau_dans_arome_prod']) && !isset($args['pourcent_arome_prod_dans_e_liquide_1']) && !isset($args['pourcent_arome_prod_dans_e_liquide_2']) && !isset($args['pourcent_arome_prod_dans_e_liquide_3']) && !isset($args['etat']) && !isset($args['order_by']) && !isset($args['etat']) && !isset($args['tab_ids_saveurs'])) {
return $tab_result;
}
$condition = "";
if (isset($args['id_saveur']) && $args['id_saveur'] != "*") {
$condition .= " AND id_saveur = '" . $args['id_saveur'] . "' ";
}
if (isset($args['pourcent_eth0_dans_arome_pur_1']) && $args['pourcent_eth0_dans_arome_pur_1'] != "*") {
$condition .= " AND pourcent_eth0_dans_arome_pur_1 = '" . strtr($this->pourcent_eth0_dans_arome_pur_1, ",", ".") . "' ";
}
if (isset($args['pourcent_eth0_dans_arome_pur_2']) && $args['pourcent_eth0_dans_arome_pur_2'] != "*") {
$condition .= " AND pourcent_eth0_dans_arome_pur_2 = '" . strtr($this->pourcent_eth0_dans_arome_pur_2, ",", ".") . "' ";
}
if (isset($args['pourcent_eth0_dans_arome_pur_3']) && $args['pourcent_eth0_dans_arome_pur_3'] != "*") {
$condition .= " AND pourcent_eth0_dans_arome_pur_3 = '" . strtr($this->pourcent_eth0_dans_arome_pur_3, ",", ".") . "' ";
}
if (isset($args['pourcent_eth0_dans_arome_pur_4']) && $args['pourcent_eth0_dans_arome_pur_4'] != "*") {
$condition .= " AND pourcent_eth0_dans_arome_pur_4 = '" . strtr($this->pourcent_eth0_dans_arome_pur_4, ",", ".") . "' ";
}
if (isset($args['pourcent_eth0_dans_arome_pur_5']) && $args['pourcent_eth0_dans_arome_pur_5'] != "*") {
$condition .= " AND pourcent_eth0_dans_arome_pur_5 = '" . strtr($this->pourcent_eth0_dans_arome_pur_5, ",", ".") . "' ";
}
if (isset($args['pourcent_eth0_dans_arome_pur_6']) && $args['pourcent_eth0_dans_arome_pur_6'] != "*") {
$condition .= " AND pourcent_eth0_dans_arome_pur_6 = '" . strtr($this->pourcent_eth0_dans_arome_pur_6, ",", ".") . "' ";
}
if (isset($args['pourcent_arome_pur_dans_arome_prod_1']) && $args['pourcent_arome_pur_dans_arome_prod_1'] != "*") {
$condition .= " AND pourcent_arome_pur_dans_arome_prod_1 = '" . strtr($this->pourcent_arome_pur_dans_arome_prod_1, ",", ".") . "' ";
}
if (isset($args['pourcent_arome_pur_dans_arome_prod_2']) && $args['pourcent_arome_pur_dans_arome_prod_2'] != "*") {
$condition .= " AND pourcent_arome_pur_dans_arome_prod_2 = '" . strtr($this->pourcent_arome_pur_dans_arome_prod_2, ",", ".") . "' ";
}
if (isset($args['pourcent_arome_pur_dans_arome_prod_3']) && $args['pourcent_arome_pur_dans_arome_prod_3'] != "*") {
$condition .= " AND pourcent_arome_pur_dans_arome_prod_3 = '" . strtr($this->pourcent_arome_pur_dans_arome_prod_3, ",", ".") . "' ";
}
if (isset($args['pourcent_arome_pur_dans_arome_prod_4']) && $args['pourcent_arome_pur_dans_arome_prod_4'] != "*") {
$condition .= " AND pourcent_arome_pur_dans_arome_prod_4 = '" . strtr($this->pourcent_arome_pur_dans_arome_prod_4, ",", ".") . "' ";
}
if (isset($args['pourcent_arome_pur_dans_arome_prod_5']) && $args['pourcent_arome_pur_dans_arome_prod_5'] != "*") {
$condition .= " AND pourcent_arome_pur_dans_arome_prod_5 = '" . strtr($this->pourcent_arome_pur_dans_arome_prod_5, ",", ".") . "' ";
}
if (isset($args['pourcent_arome_pur_dans_arome_prod_6']) && $args['pourcent_arome_pur_dans_arome_prod_6'] != "*") {
$condition .= " AND pourcent_arome_pur_dans_arome_prod_6 = '" . strtr($this->pourcent_arome_pur_dans_arome_prod_6, ",", ".") . "' ";
}
if (isset($args['pourcent_alcool_prod_dans_arome_prod']) && $args['pourcent_alcool_prod_dans_arome_prod'] != "*") {
$condition .= " AND pourcent_alcool_prod_dans_arome_prod = '" . strtr($this->pourcent_alcool_prod_dans_arome_prod, ",", ".") . "' ";
}
if (isset($args['pourcent_eau_dans_arome_prod']) && $args['pourcent_eau_dans_arome_prod'] != "*") {
$condition .= " AND pourcent_eau_dans_arome_prod = '" . strtr($this->pourcent_eau_dans_arome_prod, ",", ".") . "' ";
}
if (isset($args['pourcent_arome_prod_dans_e_liquide_1']) && $args['pourcent_arome_prod_dans_e_liquide_1'] != "*") {
$condition .= " AND pourcent_arome_prod_dans_e_liquide_1 = '" . strtr($this->pourcent_arome_prod_dans_e_liquide_1, ",", ".") . "' ";
}
if (isset($args['pourcent_arome_prod_dans_e_liquide_2']) && $args['pourcent_arome_prod_dans_e_liquide_2'] != "*") {
$condition .= " AND pourcent_arome_prod_dans_e_liquide_2 = '" . strtr($this->pourcent_arome_prod_dans_e_liquide_2, ",", ".") . "' ";
}
if (isset($args['pourcent_arome_prod_dans_e_liquide_3']) && $args['pourcent_arome_prod_dans_e_liquide_3'] != "*") {
$condition .= " AND pourcent_arome_prod_dans_e_liquide_3 = '" . strtr($this->pourcent_arome_prod_dans_e_liquide_3, ",", ".") . "' ";
}
if (isset($args['etat']) && $args['etat'] != "*") {
$condition .= " AND etat = '" . $args['etat'] . "' ";
}
if (isset($args['tab_ids_saveurs']) && $args['tab_ids_saveurs'] != "*") {
$ids = implode(",", $args['tab_ids_saveurs']);
$condition .= " AND id_saveur IN (0" . $ids . ") ";
}
if (!isset($args['etat'])) {
$condition .= " AND etat != 'supprime' ";
}
$sql .= $condition;
if (isset($args['order_by']) && !isset($args['asc_desc'])) {
$sql .= " ORDER BY " . $args['order_by'] . " ASC";
}
if (isset($args['order_by']) && isset($args['asc_desc'])) {
$sql .= " ORDER BY " . $args['order_by'] . " " . $args['asc_desc'];
}
if (isset($args['limit']) && !isset($args['start'])) {
$sql .= " LIMIT " . $args['limit'];
}
if (isset($args['limit']) && isset($args['start'])) {
$sql .= " LIMIT " . $args['start'] . "," . $args['limit'];
}
/*=============*/
Lib_myLog("SQL: {$sql}");
$result = Sql_query($sql);
if (isset($args['count'])) {
if ($result && Sql_errorCode($result) === "00000") {
$row = Sql_fetch($result);
//.........这里部分代码省略.........
示例14: addUniqID
function addUniqID($userid)
{
Sql_query(sprintf('update %s set uniqid = "%s" where id = %d', $GLOBALS['tables']['user'], getUniqID(), $userid));
}
示例15: Sql_query
Sql_query(sprintf('insert into %s (name) values("%s")', $valuestable, $firstdata['name']));
$val = Sql_Insert_Id();
Sql_query(sprintf('update %s set value="%s" where attributeid = %d', $tables['user_attribute'], $val, $first));
Sql_query(sprintf('update %s set type="checkboxgroup" where id = %d', $tables['attribute'], $first));
$cbg_initiated = 1;
}
switch ($firstdata['type']) {
case 'textline':
case 'hidden':
case 'textarea':
case 'date':
Sql_query(sprintf('delete from %s where attributeid = %d and value = ""', $tables['user_attribute'], $first));
# we can just keep the data and mark it as the first attribute
Sql_query(sprintf('update ignore %s set attributeid = %d where attributeid = %d', $tables['user_attribute'], $first, $attid), 1);
# delete the ones that didn't copy across, because there was a value already
Sql_query(sprintf('delete from %s where id = %d', $tables['attribute'], $attid));
# mark forms to use the merged attribute
if ($formtable_exists) {
Sql_Query(sprintf('update formfield set attribute = %d where attribute = %d', $first, $attid), 1);
}
break;
case 'radio':
case 'select':
# merge user values
Sql_Query(sprintf('delete from %s where attributeid = %d and value = ""', $tables['user_attribute'], $first));
$req = Sql_Query(sprintf('select * from %s', $table_prefix . 'listattr_' . $attdata['tablename']));
while ($val = Sql_Fetch_Array($req)) {
# check if it already exists
$exists = Sql_Fetch_row_Query(sprintf('select id from %s where name = "%s"', $valuestable, $val['name']));
if (!$exists[0]) {
Sql_Query(sprintf('insert into %s (name) values("%s")', $valuestable, $val['name']));