当前位置: 首页>>代码示例>>PHP>>正文


PHP mysql::fetch方法代码示例

本文整理汇总了PHP中mysql::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP mysql::fetch方法的具体用法?PHP mysql::fetch怎么用?PHP mysql::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mysql的用法示例。


在下文中一共展示了mysql::fetch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: extraerTags

function extraerTags($ID)
{
    global $db_source, $prefix;
    /*
     * Importación de Categorías
     */
    $m = new mysql();
    #SQL: extrae los tags de WP para el ID del post que se pase como parámetro.
    $m->query("SELECT t.term_id,t.slug,t.name,tr.object_id FROM {$db_source}.wp_terms as t \n\n\t\tinner join {$db_source}.wp_term_taxonomy as tt on tt.term_id = t.term_id \n\n\t\tinner join {$db_source}.wp_term_relationships as tr on tr.term_taxonomy_id = t.term_id \n\n\t\tWHERE tt.taxonomy = 'category' and tr.object_id={$ID} \n\n\t\t");
    $sql_tags = "INSERT INTO " . $prefix . "tags(tag_id,tag,urlfriendly) VALUES ";
    $insertTags = false;
    $sql_relation = "INSERT INTO " . $prefix . "tags_rel(tag_id,post_id) VALUES ";
    $hasTags = false;
    /*
     * Para cada tag del post extraido de WP
     * 1.- Revisar si existe, si no, lo inserta.
     */
    if ($m->total() > 0) {
        while ($m->fetch()) {
            $m2 = new mysql();
            /*
             * Si no existe tag, lo insertamos.
             */
            $m2->query("SELECT * FROM " . $prefix . "tags WHERE tag_id=" . $m->sql_quote($m->row['term_id']) . "");
            if (!$m2->fetch()) {
                $sql_tags .= "(" . $m->sql_quote($m->row['term_id']) . "," . "'" . $m->sql_quote($m->row['name']) . "'," . "'" . $m->sql_quote($m->row['slug']) . "'" . "), ";
                $insertTags = true;
            }
            /*
             * Buscamos si existe la relacion entre el tag y el post, si no, la creamos.
             */
            $m2->query("SELECT * FROM " . $prefix . "tags_rel WHERE tag_id=" . $m->sql_quote($m->row['term_id']) . " AND post_id=" . $ID);
            if (!$m2->fetch()) {
                $sql_relation .= " (" . $m->sql_quote($m->row['term_id']) . "," . $m->sql_quote($ID) . "), ";
                $hasTags = true;
            }
        }
        //while
    } else {
        //no tiene tags, entonces lo ponemos bajo el tag 'general'. Generalmente id=1
        $sql_relation .= " (1," . $m->sql_quote($ID) . "), ";
        $hasTags = true;
    }
    //if
    if ($insertTags) {
        $sql_tags = substr($sql_tags, 0, -2) . ';';
        $m->query($sql_tags);
    }
    if ($hasTags) {
        $sql_relation = substr($sql_relation, 0, -2) . ';';
        $m->query($sql_relation);
    }
}
开发者ID:ravenlp,项目名称:CodiceCMS,代码行数:53,代码来源:index.php

示例2: mysql

 function session_set()
 {
     $db = new mysql();
     $SQL = $db->query("Select * From " . TABLE_SETTINGS . "");
     $Row = $db->fetch($SQL);
     define("DEFAULT_LANGUAGE", $Row[2]);
     //echo"session="; echo $_SESSION['language2'];
     if (!isset($_SESSION['language2'])) {
         $_SESSION['language2'] = DEFAULT_LANGUAGE;
     } elseif (isset($_GET['language'])) {
         $_SESSION['language2'] = $_GET['language'];
     }
     $lang = $_SESSION['language2'];
     if (preg_match("/[^a-z\\.]/", $lang)) {
         $_SESSION['error_lang'] = '1';
         $error = $_SESSION['error_lang'];
     } else {
         $result = $db->query("Select * From " . TABLE_LANGUAGES . " Where shot_lang Like '" . $lang . "'");
         $num = $db->num($result);
         if ($num == 0) {
             $_SESSION['error_lang'] = '1';
             $error = $_SESSION['error_lang'];
             $_SESSION['language'] = DEFAULT_LANGUAGE;
         } else {
             unset($_SESSION['error_lang']);
             return $lang;
         }
     }
 }
开发者ID:sharifov,项目名称:MyProcedureFramework,代码行数:29,代码来源:class.session.php

示例3: onDefault

 function onDefault()
 {
     global $_out;
     if ($form = $this->getForm('form_edit')) {
         if (($row = $this->getRow()) && ($mysql = new mysql()) && ($rs = $mysql->query('select * from `' . $mysql->getTableName(apArticles::tableArticles) . '` where id=' . $row)) && ($r = $mysql->fetch($rs))) {
             $form->setTitle('Change data "' . $r['title'] . '"');
         }
         $form->load();
         if ($ff = $form->getField('row')) {
             $ff->setValue($this->getRow());
         }
         $_out->addSectionContent($form->getRootElement());
     }
 }
开发者ID:PapaKot,项目名称:Horowitz,代码行数:14,代码来源:apMetaArticles.php

示例4: step3

function step3($data)
{
    if (!isset($_POST['host']) || !isset($_POST['username']) || !isset($_POST['password']) || !isset($_POST['database']) || !isset($_POST['adress'])) {
        return "Es trat ein Fehler bei der �rmittlung der Daten auf.";
    }
    $mysql = new mysql(array());
    if (!@$mysql->connect($_POST['host'], $_POST['username'], $_POST['password'])) {
        return "Es konnte keine Verbindung zum Server hergestellt werden.<br />&Uuml;berpr&uuml;fe bitte deine Angaben auf ihre Richtigkeit.<br />" . mysql_error();
    }
    if (!@$mysql->select_db($_POST['database'])) {
        return "Die gew&uuml;nschte Datenbank konnte nicht ausgew&auml;hlt werden.<br />Entweder existiert diese nicht oder der gew&auml;hlte Benutzer hat keine Zugriffsrechte.<br />" . mysql_error();
    }
    $_SESSION['install']['mysql']['host'] = $_POST['host'];
    $_SESSION['install']['mysql']['username'] = $_POST['username'];
    $_SESSION['install']['mysql']['password'] = $_POST['password'];
    $_SESSION['install']['mysql']['database'] = $_POST['database'];
    $_SESSION['install']['tic_adress'] = $_POST['adress'];
    $tables = array("gn4accounts", "gn4allianzen", "gn4cron", "gn4flottenbewegungen", "gn4forum", "gn4gnuser", "gn4incplanets", "gn4log", "gn4nachrichten", "gn4nachtwache", "gn4meta", "gn4scans", "gn4attflotten", "gn4attplanung", "gn4vars", "gn4channels");
    $mysql->query("SHOW TABLE STATUS") or die($mysql->error(__FILE__, __LINE__));
    $tableexits = array();
    while ($row = $mysql->fetch()) {
        $tableexits[$row['Name']] = 1;
    }
    echo "<div style=\"border:1px #000000 solid;width:400px;padding:3px;\"><b>Schritt 3: &Uuml;berpr&uuml;fe Tabellen</b>\n          <form action=\"\" method=\"post\"><input type=\"hidden\" name=\"step\" value=\"4\" \\>\n          <table style=\"text-align:left;\" cellspacing=\"0\" cellpadding=\"0\">\n            <tr style=\"font-weight:bold;\"><td>Tabellenname</td><td>Installieren</td></tr>";
    $showwarning = 0;
    foreach ($tables as $table) {
        if ($tableexits[$table]) {
            $color = "#800000";
            $showwarning = 1;
            $input = "<input type=\"checkbox\" name=\"check[]\" value=\"" . $table . "\" checked=\"checked\"/>";
        } else {
            $color = "#008000";
            $input = "<input type=\"checkbox\" checked=\"checked\" disabled = \"disabled\" /><input type=\"hidden\"  name=\"check[]\" value=\"" . $table . "\" />";
        }
        echo "<tr style=\"color:" . $color . "\"><td>{$table}</td><td style=\"text-align:center\">" . $input . "</td></tr>";
    }
    if ($showwarning) {
        echo "</table><br /><div style=\"text-align:left\"><b>ACHTUNG:</b> Rot makierte Tabellen existieren bereits und werden, sofern die Installation fortgesetzt wird, inklusive ihrer Daten berschrieben.</div>";
    }
    echo "<input type=\"submit\" value=\"Weiter\" /></form>\n            </div>";
    return "";
}
开发者ID:albertlast,项目名称:ticenter_tic,代码行数:42,代码来源:steps.php

示例5: run

 function run()
 {
     global $_out;
     $mysql = new mysql();
     $row = filter_var(param('row'), FILTER_VALIDATE_INT);
     if (($rs = $mysql->query('select * from `' . $mysql->getTableName($this->table) . '` where ' . '`section`="' . $this->getSection()->getId() . '" and `module`="' . $this->getConf('module', true) . '" and `id_article`=' . ($row ? $row : 0))) && ($r = $mysql->fetch($rs))) {
         if ($v = $r['title']) {
             $_out->setMeta('title', $v);
         }
         if ($v = $r['keywords']) {
             $_out->setMeta('keywords', $v);
         }
         if ($v = $r['description']) {
             $_out->setMeta('description', $v);
         }
         if (($v = $r['h1']) && ($e = $_out->query('/page/section')->item(0))) {
             $e->setAttribute('h1', $v);
         }
     }
 }
开发者ID:PapaKot,项目名称:Horowitz,代码行数:20,代码来源:metaArticles.php

示例6: mysql

require_once ROOT . "/classes/adm_authorize.php";
// Load JsHttpRequest backend.
require_once ROOT . "/classes/JsHttpRequest/JsHttpRequest.php";
$sql = new mysql($sql);
$auth = new adm_authorize($sql);
// Create main library object. You MUST specify page encoding!
$JsHttpRequest = new JsHttpRequest("windows-1251");
if (!$auth->check()) {
    $GLOBALS['_RESULT'] = array("q" => "You are not logged in");
    exit;
}
$sql->query("DELETE FROM `" . PREF . "projects` WHERE p_id=" . $_REQUEST['pid'] . " LIMIT 1");
$res = $sql->query("SELECT img_id AS id, `img_filename` AS fname, `img_project_id` AS cid FROM `" . PREF . "img` WHERE img_project_id=" . $_REQUEST['pid']);
if (mysql_num_rows($res) > 0) {
    $r = array();
    while ($row = $sql->fetch($res)) {
        if ($row['cid'] == '0') {
            unlink(ROOT . "/images/unsorted/" . $row['fname'] . ".jpg");
            unlink(ROOT . "/images/unsorted/thumb_" . $row['fname'] . ".jpg");
        } else {
            unlink(ROOT . "/images/" . $row['fname'] . ".jpg");
            unlink(ROOT . "/images/thumb_" . $row['fname'] . ".jpg");
        }
        $r[] = $row['id'];
    }
    $sql->query("DELETE FROM `" . PREF . "img` WHERE img_project_id=" . $_REQUEST['pid']);
    $res = $sql->query("SELECT link_value AS v FROM `" . PREF . "kvi_links` WHERE link_img IN (" . implode(', ', $r) . ")");
    if (mysql_num_rows($res) > 0) {
        $v = array();
        while ($row = $sql->fetch($res)) {
            $v[] = $row['v'];
开发者ID:Teleta,项目名称:ld-art,代码行数:31,代码来源:delproj.php

示例7: mysql

<?php

$db = new mysql();
$Sql = $db->query("Select * From " . TABLE_NEWS . " Where news_id='{$id}' AND lang_id='{$lang}'");
$Row = $db->fetch($Sql);
if ($_POST['add'] == "yes") {
    $_POST[content] = mysql_real_escape_string($_POST[content]);
    if ($_POST['imgs'] == "yes") {
        $new_name = "new" . time() . date('dmy');
        $target = "../files/news/";
        $fname = $_FILES['image']['name'];
        $zname = explode(".", $fname);
        $ns = end($zname);
        $target = $target . basename("{$new_name}.{$ns}");
        $imgname = $_FILES['image']['tmp_name'];
        if (move_uploaded_file($imgname, $target)) {
        } else {
            exit;
        }
        $thumb = "{$new_name}.{$ns}";
        $created = $_POST[year] . "-" . $_POST[month] . "-" . $_POST[day];
        $crtime = date("H:i");
        $created = $_POST[year] . "-" . $_POST[month] . "-" . $_POST[day];
        $db->query("UPDATE " . TABLE_NEWS . " SET title='" . protect($_POST['title']) . "',  sh_desc='" . protect($_POST['sh_desc']) . "', content='" . $_POST['content'] . "', thumb='" . $thumb . "', created='" . $created . "'  WHERE news_id='{$_POST['uid']}' AND lang_id='{$lang}'");
        echo "<script>document.location='index.php?options=news'</script>";
    } else {
        $created = $_POST[year] . "-" . $_POST[month] . "-" . $_POST[day];
        $db->query("UPDATE " . TABLE_NEWS . " SET title='" . protect($_POST['title']) . "',  sh_desc='" . protect($_POST['sh_desc']) . "', content='" . $_POST['content'] . "', created='" . $created . "'  WHERE news_id='{$_POST['uid']}' AND lang_id='{$lang}'");
        echo "<script>document.location='index.php?options=news'</script>";
    }
}
开发者ID:sharifov,项目名称:MyProcedureFramework,代码行数:31,代码来源:editnews.php

示例8: mysql

error_reporting(0);
require_once "../cfg.php";
require_once ROOT . "/classes/adm_authorize.php";
// Load JsHttpRequest backend.
require_once ROOT . "/classes/JsHttpRequest/JsHttpRequest.php";
$sql = new mysql($sql);
$auth = new adm_authorize($sql);
// Create main library object. You MUST specify page encoding!
$JsHttpRequest = new JsHttpRequest("windows-1251");
if (!$auth->check()) {
    $GLOBALS['_RESULT'] = array("q" => "You are not logged in");
    exit;
}
$sql->query("SELECT `img_project_id` AS cid, `img_filename` AS fname FROM `" . PREF . "img` WHERE img_id=" . $_REQUEST['img'] . " LIMIT 1");
$r = $sql->fetch();
$sql->query("DELETE FROM `" . PREF . "img` WHERE img_id=" . $_REQUEST['img']);
// kills just uploaded images
if ($r['cid'] == '0') {
    unlink(ROOT . "/images/unsorted/" . $r['fname'] . ".jpg");
    unlink(ROOT . "/images/unsorted/thumb_" . $r['fname'] . ".jpg");
} else {
    $res = $sql->query("SELECT link_value AS v FROM `" . PREF . "kvi_links` WHERE link_img=" . $_REQUEST['img']);
    if (mysql_num_rows($res) > 0) {
        $v = array();
        while ($row = $sql->fetch()) {
            $v[] = $row['v'];
        }
        $sql->query("DELETE FROM `" . PREF . "kvi_links` WHERE link_img=" . $_REQUEST['img']);
        $sql->query("DELETE FROM `" . PREF . "values` WHERE value_id IN (" . implode(' ,', $v) . ")");
    }
开发者ID:Teleta,项目名称:ld-art,代码行数:30,代码来源:delbyid.php

示例9: mysql

<?php

error_reporting(0);
require_once "../cfg.php";
require_once ROOT . "/classes/adm_authorize.php";
// Load JsHttpRequest backend.
require_once ROOT . "/classes/JsHttpRequest/JsHttpRequest.php";
$sql = new mysql($sql);
$auth = new adm_authorize($sql);
// Create main library object. You MUST specify page encoding!
$JsHttpRequest = new JsHttpRequest("windows-1251");
if (!$auth->check()) {
    $GLOBALS['_RESULT'] = array("q" => "You are not logged in");
    exit;
}
$f = $sql->fetch($sql->query("SELECT img_filename AS fname\n\tFROM `" . PREF . "img`\n\tWHERE img_id='" . $_REQUEST['img'] . "' LIMIT 1"));
$oldname = $f['fname'];
$r = $sql->fetch($sql->query("SELECT MAX(img_order) AS num\n\tFROM `" . PREF . "img`\n\tWHERE img_project_id='" . $_REQUEST['pid'] . "'"));
while (file_exists(ROOT . "/images/" . $f['fname'] . ".jpg")) {
    $f['fname'] = md5(md5(rand(0, 1000000)) . $f['fname'] . md5(rand(0, 100000)));
}
$query = "UPDATE `" . PREF . "img`\n\tSET img_project_id='" . $_REQUEST['pid'] . "', img_order='" . ($r['num'] + 1) . "', img_filename='" . $f['fname'] . "'\n\tWHERE img_id='" . $_REQUEST['img'] . "'";
if (!$sql->query($query)) {
    echo mysql_error();
} else {
    rename(ROOT . "/images/unsorted/" . $oldname . ".jpg", ROOT . "/images/" . $f['fname'] . ".jpg");
    rename(ROOT . "/images/unsorted/thumb_" . $oldname . ".jpg", ROOT . "/images/thumb_" . $f['fname'] . ".jpg");
}
开发者ID:Teleta,项目名称:ld-art,代码行数:28,代码来源:attachIM.php

示例10: JsHttpRequest

$JsHttpRequest = new JsHttpRequest("windows-1251");
if (!$auth->check()) {
    $GLOBALS['_RESULT'] = array("q" => "You are not logged in");
    exit;
}
switch ($_REQUEST['q']) {
    case "delete":
        $q = "DELETE FROM `" . PREF . "values`\n\t\tWHERE value_id='" . $_REQUEST['pid'] . "'\n\t\tLIMIT 1";
        $sql->query($q);
        $q = "DELETE FROM `" . PREF . "kvi_links`\n\t\tWHERE link_value='" . $_REQUEST['pid'] . "'\n\t\tLIMIT 1";
        $sql->query($q);
        $GLOBALS['_RESULT'] = array('q' => mysql_error());
        break;
    case "newrow":
        $q = "SELECT MAX(v.value_sort) AS max\n\t\t\tFROM `" . PREF . "kvi_links` AS ln, `" . PREF . "values` AS v\n\t\t\tWHERE ln.link_value=v.value_id AND ln.link_img='" . $_REQUEST['id'] . "'";
        $max = $sql->fetch($sql->query($q));
        $q = "INSERT INTO `" . PREF . "values`\n\t\tVALUES (NULL, '" . mysql_real_escape_string($_REQUEST['eng']) . "', '" . mysql_real_escape_string($_REQUEST['rus']) . "', '" . ($max['max'] ? $max['max'] + 1 : '1') . "')";
        $res = $sql->query($q);
        $my_id = mysql_insert_id();
        $q = "INSERT INTO `" . PREF . "kvi_links`\n\t\tVALUES ('" . $_REQUEST['id'] . "', '" . $_REQUEST['key'] . "', '" . $my_id . "')";
        $res = $sql->query($q);
        $GLOBALS['_RESULT'] = array('id' => $my_id, 'ok' => true);
        break;
    case "edit":
        $q = "UPDATE `" . PREF . "values` SET\n\t\t\tvalue_name_eng='" . mysql_real_escape_string($_REQUEST['e']) . "', value_name_rus='" . mysql_real_escape_string($_REQUEST['r']) . "'\n\t\t\tWHERE value_id='" . $_REQUEST['id'] . "'\n\t\t\tLIMIT 1";
        $res = $sql->query($q);
        $q = "UPDATE `" . PREF . "kvi_links` SET link_key='" . $_REQUEST['key'] . "'\n\t\t\tWHERE link_value='" . $_REQUEST['id'] . "'\n\t\t\tLIMIT 1";
        $res = $sql->query($q);
        break;
    case "resize":
        //var_dump($_REQUEST);
开发者ID:Teleta,项目名称:ld-art,代码行数:31,代码来源:jimage.php

示例11: mysql

<?php

$db = new mysql();
$Sql = $db->query("Select * From " . TABLE_PAGES . " Where id='{$id}' AND lang_id='{$lang}'");
$Row = $db->fetch($Sql);
if ($_POST['add'] == "yes") {
    if (isset($_POST['link'])) {
        $_POST[link] = mysql_real_escape_string(strip_tags($_POST[link])) . '##' . mysql_real_escape_string(strip_tags($_POST[p]));
        $db->query("UPDATE " . TABLE_PAGES . " SET pagename='" . protect($_POST['pagename']) . "', link='" . $_POST['link'] . "'  WHERE id='{$_POST['uid']}' AND lang_id='{$lang}'");
        $db->query("UPDATE " . TABLE_PAGES . " SET type='" . $_POST['type'] . "'  WHERE id='{$_POST['uid']}'");
        echo "<script>document.location='index.php'</script>";
    } else {
        if (isset($_POST['news'])) {
            $db->query("UPDATE " . TABLE_PAGES . " SET pagename='" . protect($_POST['pagename']) . "' WHERE id='{$_POST['uid']}' AND lang_id='{$lang}'");
            $db->query("UPDATE " . TABLE_PAGES . " SET type='" . $_POST['type'] . "'  WHERE id='{$_POST['uid']}'");
            echo "<script>document.location='index.php'</script>";
        } else {
            if (get_magic_quotes_gpc()) {
            } else {
                $_POST[content] = mysql_real_escape_string($_POST['content']);
            }
            $db->query("UPDATE " . TABLE_PAGES . " SET pagename='" . protect($_POST['pagename']) . "', content='" . $_POST[content] . "'  WHERE id='{$_POST['uid']}' AND lang_id='{$lang}'");
            $db->query("UPDATE " . TABLE_PAGES . " SET type='" . $_POST['type'] . "'  WHERE id='{$_POST['uid']}'");
            echo "<script>document.location='index.php'</script>";
        }
    }
}
if ($_GET['action'] == "delete") {
    $db->query("DELETE From " . TABLE_PAGES . " WHERE sub_id='" . $id . "'");
    $db->query("DELETE From " . TABLE_PAGES . " WHERE id='" . $id . "'");
    $new_archive_id = $id + 120;
开发者ID:sharifov,项目名称:MyProcedureFramework,代码行数:31,代码来源:editpage.php

示例12: mysql

<?php

if ($_POST['add'] == "yes") {
    $db = new mysql();
    $result2 = $db->query("Select * From " . TABLE_LANGUAGES . "");
    $get_old_id = $db->fetch($db->query("SELECT id FROM " . TABLE_PAGES . " ORDER BY id DESC LIMIT 1"));
    $new_id = $get_old_id[0] + 1;
    $get_old_order = $db->fetch($db->query("SELECT ordering FROM " . TABLE_PAGES . " ORDER BY ordering DESC LIMIT 1"));
    $new_order = $get_old_order[0] + 1;
    if ($_POST['subid'] == "0") {
        $sub = "0";
    } else {
        $sub = $_POST['subid'];
    }
    while ($arr = mysql_fetch_array($result2)) {
        $t = $arr[1];
        $result = $db->query("INSERT INTO " . TABLE_PAGES . " VALUES (\r\n\t\t\t\t'{$new_id}',\r\n\t\t\t\t'{$sub}', \r\n\t\t\t\t'" . $_POST['pagename_' . $t] . "', \r\n\t\t\t\t'{$content}' , \r\n\t\t\t\t'" . ADDDATE . "' , \r\n\t\t\t\t'0' , \r\n\t\t\t\t'{$arr['1']}', \r\n\t\t\t\t'{$_POST['visibility']}', \r\n\t\t\t\t'', \r\n\t\t\t\t'{$_POST['type']}', \r\n\t\t\t\t'top',\r\n\t\t\t\t'{$new_order}',\r\n\t\t\t\t''\r\n\t\t)");
    }
    echo "<script>document.location='index.php'</script>";
}
开发者ID:sharifov,项目名称:MyProcedureFramework,代码行数:20,代码来源:addpage.php

示例13: mysql

error_reporting(0);
require_once "../cfg.php";
require_once ROOT . "/classes/adm_authorize.php";
// Load JsHttpRequest backend.
require_once ROOT . "/classes/JsHttpRequest/JsHttpRequest.php";
$sql = new mysql($sql);
$auth = new adm_authorize($sql);
// Create main library object. You MUST specify page encoding!
$JsHttpRequest = new JsHttpRequest("windows-1251");
if (!$auth->check()) {
    $GLOBALS['_RESULT'] = array("q" => "You are not logged in");
    exit;
}
switch ($_REQUEST['q']) {
    case "newrow":
        $sort = $sql->fetch($sql->query("SELECT MAX(sort) AS max FROM `" . PREF . "links`"));
        $res = $sql->query("INSERT INTO `" . PREF . "links` VALUES (NULL, '" . mysql_real_escape_string($_REQUEST['url']) . "', '" . mysql_real_escape_string($_REQUEST['eng']) . "', '" . mysql_real_escape_string($_REQUEST['rus']) . "', '" . ($sort['max'] + 1) . "')");
        $GLOBALS['_RESULT'] = array("id" => mysql_insert_id(), "ok" => true);
        break;
    case "delete":
        $sql->query("DELETE FROM `" . PREF . "links` WHERE id='" . $_REQUEST['pid'] . "'");
        $GLOBALS['_RESULT'] = array();
        break;
    case "edit":
        $q = array();
        if ($_REQUEST['url'] != '') {
            $q[] = "url='" . mysql_real_escape_string($_REQUEST['url']) . "'";
        } else {
            echo 'no url !!!';
            return false;
        }
开发者ID:Teleta,项目名称:ld-art,代码行数:31,代码来源:jlinks.php

示例14: mysql

<?php

error_reporting(0);
require_once "../cfg.php";
require_once ROOT . "/classes/adm_authorize.php";
// Load JsHttpRequest backend.
require_once ROOT . "/classes/JsHttpRequest/JsHttpRequest.php";
$sql = new mysql($sql);
$auth = new adm_authorize($sql);
// Create main library object. You MUST specify page encoding!
$JsHttpRequest = new JsHttpRequest("windows-1251");
if (!$auth->check()) {
    $GLOBALS['_RESULT'] = array("q" => "You are not logged in");
    exit;
}
$f = $sql->fetch($sql->query("SELECT img_filename AS fname, img_project_id AS pid, img_order AS ord\n\tFROM `" . PREF . "img`\n\tWHERE img_id='" . $_REQUEST['img'] . "' LIMIT 1"));
$oldname = $f['fname'];
while (file_exists(ROOT . "/images/" . $f['fname'] . ".jpg")) {
    $f['fname'] = md5(md5(rand(0, 1000000)) . $f['fname'] . md5(rand(0, 100000)));
}
$query = "UPDATE `" . PREF . "img`\n\tSET img_project_id='0', img_order='0', img_filename='" . $f['fname'] . "'\n\tWHERE img_id='" . $_REQUEST['img'] . "'";
if (!$sql->query($query)) {
    echo mysql_error();
} else {
    rename(ROOT . "/images/" . $oldname . ".jpg", ROOT . "/images/unsorted/" . $f['fname'] . ".jpg");
    rename(ROOT . "/images/thumb_" . $oldname . ".jpg", ROOT . "/images/unsorted/thumb_" . $f['fname'] . ".jpg");
    $sql->query("UPDATE `" . PREF . "img`\n\tSET img_order=img_order-1 WHERE img_project_id='" . $f['pid'] . "' AND img_order > '" . $f['ord'] . "'");
}
开发者ID:Teleta,项目名称:ld-art,代码行数:28,代码来源:unattachIM.php

示例15: mysql

<?php

if ($_POST['add'] == "yes") {
    $db = new mysql();
    $pass = md5($_POST['pass']);
    $usr = trim($_POST['username']);
    $nums = $db->num($db->query("SELECT * FROM " . TABLE_ADMINKA . " Where username like '{$usr}'"));
    if ($nums > 0) {
        $_SESSION['error_admin'] = "This user uje var :)";
        echo "<script>document.location='index.php?options=users&action=error'</script>";
        exit;
    }
    $get_old_id = $db->fetch($db->query("SELECT id FROM " . TABLE_ADMINKA . " ORDER BY id DESC LIMIT 1"));
    $new_id = $get_old_id[0] + 1;
    $result = $db->query("INSERT INTO " . TABLE_ADMINKA . " VALUES (\r\n\t\t'{$new_id}', \r\n\t\t'" . trim($_POST['username']) . "', \r\n\t\t'" . $pass . "')");
    echo "<script>document.location='index.php?options=users'</script>";
}
if ($_GET['action'] == "delete") {
    $db->query("DELETE From " . TABLE_ADMINKA . " WHERE id='" . $id . "'");
    echo "<script>document.location='index.php?options=users'</script>";
}
if ($_GET[action] == "edit") {
    $pass = md5($_POST['pass']);
    $db->query("UPDATE " . TABLE_ADMINKA . " SET pass='" . $pass . "' WHERE id='" . $_POST[uid] . "'");
    echo "<script>document.location='index.php?options=users'</script>";
}
开发者ID:sharifov,项目名称:MyProcedureFramework,代码行数:26,代码来源:users.php


注:本文中的mysql::fetch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。