當前位置: 首頁>>代碼示例>>PHP>>正文


PHP MYSQL_QUERY函數代碼示例

本文整理匯總了PHP中MYSQL_QUERY函數的典型用法代碼示例。如果您正苦於以下問題:PHP MYSQL_QUERY函數的具體用法?PHP MYSQL_QUERY怎麽用?PHP MYSQL_QUERY使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了MYSQL_QUERY函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: sendLoginDetails

 function sendLoginDetails($email)
 {
     global $sitename;
     global $logo;
     $query = MYSQL_QUERY("SELECT `Username`,`Password` FROM `ChallengeMembers` WHERE `Email` = '" . $email . "' ") or die(MYSQL_ERROR());
     if ($query) {
         if (MYSQL_NUM_ROWS($query)) {
             while ($row = MYSQL_FETCH_ARRAY($query)) {
                 $userpassword = $row['Password'];
                 $username = $row['Username'];
             }
             /*send email*/
             include 'email_class.php';
             $em = new EmailTemplate();
             $subject = ucfirst($sitename) . " Login Details";
             $headers = "From: " . ucwords($sitename) . " <admin@domaindirectory.com> \r\n" . 'X-Mailer: PHP/' . phpversion();
             $headers .= 'MIME-Version: 1.0' . "\r\n";
             $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
             $email_message = $username . ",<br /><br /> Thank you for your interest in joining our challenges.\n\t\t\t\t\t\t\t\t\t<br /><br />\n\t\t\t\t\t\t\t\t\tThe following are your login data:\n\t\t\t\t\t\t\t\t\t<br>\n\t\t\t\t\t\t\t\t\tUsername : <b>" . $username . "</b><br />\n\t\t\t\t\t\t\t\t\tPassword : <b>" . $userpassword . "</b>\n\t\t\t\t\t\t\t\t\t<br /><br />\n\t\t\t\t\t\t\t\t\tThank you.<br />\n\t\t\t\t\t\t\t\t\t<b>" . $sitename . "</b>";
             $emailmessage = $em->get($logo, $sitename, $email_message);
             /*first send to guest */
             $sentmail = mail($email, $subject, $emailmessage, $headers);
             /*end of send email*/
             return "OK";
         } else {
             return $email . "not found in database.";
         }
     } else {
         return "Email not found in database.";
     }
 }
開發者ID:AleemDev,項目名稱:OpenSource,代碼行數:31,代碼來源:login_function.php

示例2: sendNewsletter

function sendNewsletter($from, $newsTitle, $newsBody)
{
    $sql = "SELECT * FROM mailing_list WHERE active='1'";
    $result = MYSQL_QUERY($sql);
    $numberOfRows = MYSQL_NUMROWS($result);
    $i = 0;
    while ($i < $numberOfRows) {
        $thisEmail = MYSQL_RESULT($result, $i, "email");
        $thisUid = MYSQL_RESULT($result, $i, "uid");
        $thisName = MYSQL_RESULT($result, $i, "full_name");
        /* recipients */
        $to = $thisEmail;
        // note the comma
        /* subject */
        $subject = $newsTitle;
        /* message */
        $message = "Dear {$thisName} <br>";
        $message .= $newsBody . '<br><br><a href="' . _PREF . 'modules/mailing_ilst/deleteMailing_list.php?thisEmailField=' . $thisEmail . '&thisUidField=' . $thisUid . '">
			To unsubscribe please click here</a>';
        /* To send HTML mail, you can set the Content-type header. */
        $headers = "MIME-Version: 1.0\r\n";
        $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
        /* additional headers */
        $headers .= "To:" . $thisEmail . "\r\n";
        $headers .= "From: " . $from;
        /* and now mail it */
        $s = mail($to, $subject, $message, $headers);
        $i++;
    }
    if ($s) {
        echo '<script>correctMessage("Message Sent successfuly");</script>';
    } else {
        echo '<script>errorMessage("Sorry message has not been sent, an error has occurred");</script>';
    }
}
開發者ID:kifah4itTeam,項目名稱:phpapps,代碼行數:35,代碼來源:mailing.php

示例3: add

 function add($section, $text)
 {
     global $flouser;
     if (!MYSQL_QUERY("INSERT INTO flobase_log (section, timestamp, currentuser, currentip, logvalue) VALUES('" . mysql_real_escape_string($section) . "', '" . date("U") . "', '" . $flouser->userid . "', '" . mysql_real_escape_string($_SERVER['REMOTE_ADDR']) . "', '" . mysql_real_escape_string($text) . "')")) {
         return false;
     }
     return mysql_insert_id();
 }
開發者ID:Rellfy,項目名稱:florensia-base,代碼行數:8,代碼來源:class_log.php

示例4: signencode

function signencode($sign)
{
    MYSQL_QUERY("CREATE TABLE IF NOT EXISTS `cache_languagesigns` (\n\t\t`id` int(11) NOT NULL auto_increment,\n\t\t`signs` text NOT NULL,\n\t\tPRIMARY KEY  (`id`)\n\t\t)");
    MYSQL_QUERY("INSERT INTO cache_languagesigns (signs) VALUES('" . mysql_real_escape_string($sign) . "')");
    $signs = MYSQL_FETCH_ARRAY(MYSQL_QUERY("SELECT signs FROM cache_languagesigns ORDER BY id DESC LIMIT 1"));
    MYSQL_QUERY("TRUNCATE TABLE cache_languagesigns");
    return $signs['signs'];
}
開發者ID:Rellfy,項目名稱:florensia-base,代碼行數:8,代碼來源:adminlang_backup.php

示例5: getTotalMonetarySponsorship

	function getTotalMonetarySponsorship($challenger_id){
		$total_sponsorship = 0;
		$query = MYSQL_QUERY("SELECT SUM(Amount) AS total_sponsorship FROM SponsorContact WHERE SponsorId = '".$challenger_id."'");
			if($row = MYSQL_FETCH_ARRAY($query)){
				$total_sponsorship = $row['total_sponsorship'];
			}
		return $total_sponsorship;
	}
開發者ID:AleemDev,項目名稱:OpenSource,代碼行數:8,代碼來源:profile_function.php

示例6: set

function set($query)
{
    $queryResponse = MYSQL_QUERY($query) or die($query . " " . mysql_error());
    if (is_resource($queryResponse)) {
        return mysql_fetch_array($queryResponse);
    } else {
        return $queryResponse;
    }
}
開發者ID:abhikalotra,項目名稱:Core-Php,代碼行數:9,代碼來源:dbfunctions.php

示例7: get_valid_languages

 function get_valid_languages()
 {
     global $florensia;
     $queryquesttexttables = MYSQL_QUERY("SHOW TABLES FROM {$florensia->dbname} LIKE 'server_questtext_%'");
     while ($questtexttables = MYSQL_FETCH_ARRAY($queryquesttexttables)) {
         //if (strtr($questtexttables[0], array('server_questtext_'=>''))=="TR") continue;
         $this->languagearray[strtr($questtexttables[0], array('server_questtext_' => ''))] = strtr($questtexttables[0], array('server_questtext_' => ''));
     }
 }
開發者ID:Rellfy,項目名稱:florensia-base,代碼行數:9,代碼來源:class_questtext.php

示例8: displayCollapseListKeyed

function displayCollapseListKeyed($id = '0', $idFull = '0', $note = null, $pageName = 'main', $key = null, $htmlXtra = null)
{
    // Find this $key object
    $sql = "SELECT *, objects.id AS objectsId FROM wires, objects ";
    $sql .= "WHERE wires.fromid = {$id} AND wires.toid = objects.id ";
    $sql .= "AND objects.name1 LIKE '{$key}' ";
    $sql .= "AND wires.active=1 AND objects.active=1 ";
    $sql .= "LIMIT 1";
    $result = MYSQL_QUERY($sql);
    // Find connected objects
    if ($myrow = MYSQL_FETCH_ARRAY($result)) {
        $foundObjectId = $myrow['objectsId'];
        $sql = "SELECT *, objects.id AS objectsId FROM wires, objects ";
        $sql .= "WHERE wires.fromid = {$foundObjectId} AND wires.toid = objects.id ";
        $sql .= "AND wires.active=1 AND objects.active=1 ";
        $sql .= "ORDER BY rank ASC";
        $result = MYSQL_QUERY($sql);
        // Output collapseList
        $i = 0;
        $notes = explode(",", $note);
        echo "\n\t<!-- collapseList -->";
        echo "\n\n\t<ul class = 'ieFix'>";
        while ($myrow = MYSQL_FETCH_ARRAY($result)) {
            $name = $myrow["name1"];
            if (substr($name, 0, 1) != "." && substr($name, 0, 1) != "_") {
                for ($ii = 0; $ii < count($notes); $ii++) {
                    if ($notes[$ii] == $myrow['objectsId']) {
                        $notesOut[$ii] = null;
                    } else {
                        $notesOut[$ii] = $notes[$ii];
                    }
                }
                $notesOutFiltered = array_filter($notesOut);
                $noteOut = implode(",", $notesOutFiltered);
                $noteOutStub = $noteOut ? $noteOut . "," : "";
                echo in_array($myrow['objectsId'], $notes) ? "\n\t\t<li class = 'collapseListOpen'>\n\t\t\t\t\t\t\t- <a href='" . $pageName . ".html?id=" . $idFull . "&amp;note=" . $noteOut . "'>" . $myrow["name1"] . "</a>" : "\n\t\t<li class = 'collapseListClosed'>\n\t\t\t\t\t\t\t+ <a href='" . $pageName . ".html?id=" . $idFull . "&amp;note=" . $noteOutStub . $myrow['objectsId'] . "'>" . $myrow["name1"] . "</a>";
                if ($htmlXtra) {
                    // Hack for Objectif
                    // $htmlXtra  = "Download the complete <a href='MEDIA/PDF/Deball.pdf' target='_new'>PDF here</a>.<br/>";
                    $htmlXtra = "Download the <a href=\"javascript: windowPop('" . $myrow['url'] . "','poppdf', '450', '550')\">PDF</a>.<br/>";
                    $htmlXtra .= "View the <a href=\"javascript: windowPop('popimage.html?id=" . $myrow['objectsId'] . "','popimage', '800', '533')\">installation images</a>.<br/>";
                    $htmlXtra .= "Read the <a href=\"javascript: windowPop('poptext.html?id=" . $myrow['objectsId'] . "','poptext', '450', '800')\">exhibition text</a>.<br/><br/>";
                    //echo "\n	<br /><br />".$myrow["deck"]."<br/>" . $htmlXtra . "</li>";
                    echo nl2br("\n\t<br />" . $myrow["deck"] . "<br/><br />" . $htmlXtra . "</li>");
                    // End hack
                } else {
                    echo nl2br("\n\t<br />" . $myrow["deck"] . "<br/><br /></li>");
                }
                $i++;
            }
        }
        echo "\n\t</ul>";
    }
}
開發者ID:reinfurt,項目名稱:MOLLYS,代碼行數:54,代碼來源:displayCollapseListKeyed.php

示例9: user_detail

function user_detail($username)
{
    $user = array();
    $result = MYSQL_QUERY("SELECT username, user_dir, aktiv, last_login, dl_bytes, ul_bytes, count FROM users WHERE username = '{$username}'") or die("DB-Fehler-Nummer" . mysql_errno() . "|| Meldung: " . mysql_error());
    while ($row = mysql_fetch_row($result)) {
        for ($i = 0; $i < mysql_num_fields($result); $i++) {
            array_push($user, $row[$i]);
        }
    }
    return $user;
}
開發者ID:BackupTheBerlios,項目名稱:pic2base-svn,代碼行數:11,代碼來源:function.php

示例10: CheckIfVerified

 function CheckIfVerified($code)
 {
     $query = MYSQL_QUERY("SELECT `ChallengeMemberId` FROM `ChallengeMembers` WHERE VerificationCode = '" . $code . "' ") or die(MYSQL_ERROR());
     if (MYSQL_NUM_ROWS($query) > 0) {
         while ($row = MYSQL_FETCH_ARRAY($query)) {
             $member_id = $row['ChallengeMemberId'];
             $result = MYSQL_QUERY("UPDATE `ChallengeMembers` SET `Verified` = '1' WHERE `ChallengeMemberId` = '" . $member_id . "' ") or die(MYSQL_ERROR());
         }
         return true;
     } else {
         return false;
     }
 }
開發者ID:AleemDev,項目名稱:OpenSource,代碼行數:13,代碼來源:register_function.php

示例11: lookupField

 function lookupField($table, $id_field, $lookup_field, $id_value)
 {
     $sql_lookup = "SELECT `{$lookup_field}` from `{$table}` where `{$id_field}` = '{$id_value}'";
     $result_lookup = MYSQL_QUERY($sql_lookup);
     $rows_lookup = MYSQL_NUM_ROWS($result_lookup);
     if ($rows_lookup == null || ($rows_lookup = 0)) {
         return 0;
     } else {
         $filds = explode(",", $lookup_field);
         $ind = 0;
         $value = "";
         while ($ind < count($filds)) {
             $value .= stripslashes(MYSQL_RESULT($result_lookup, 0, $filds[$ind]) . " ");
             $ind++;
         }
         return trim($value);
     }
 }
開發者ID:kifah4itTeam,項目名稱:phpapps,代碼行數:18,代碼來源:login_session_auth.php

示例12: systemCommand

function systemCommand()
{
    //  Get ".System" object
    $sql = "SELECT objects.id AS objectsId FROM wires, objects ";
    $sql .= "WHERE wires.fromid = 0 AND wires.toid = objects.id AND objects.name1 LIKE '.System' ";
    $sql .= "AND wires.active = 1 AND objects.active = 1 ";
    $sql .= "ORDER BY objects.modified DESC LIMIT 1";
    $res = MYSQL_QUERY($sql);
    $row = MYSQL_FETCH_ARRAY($res);
    global $systemObjectId;
    $systemObjectId = $row["objectsId"];
    //  Get "documentBase"
    $sql = "SELECT * FROM wires, objects ";
    $sql .= "WHERE wires.fromid = {$systemObjectId} AND wires.toid = objects.id AND objects.name1 LIKE 'documentBase' ";
    $sql .= "AND wires.active = 1 AND objects.active = 1 ";
    $sql .= "ORDER BY objects.modified DESC LIMIT 1";
    $res = MYSQL_QUERY($sql);
    $row = MYSQL_FETCH_ARRAY($res);
    global $documentBase;
    $documentBase = $row['body'];
    // echo $documentBase;
    //  Establish page
    global $pageName;
    $pageName = basename($PHP_SELF, ".html");
    if (!$pageName) {
        $pageName = "index";
    }
    //  Set document title
    global $documentTitle;
    $documentTitle = $documentTitle ? $documentBase . " | " . $documentTitle : $documentBase;
    //  Parse object commands
    global $objects;
    global $object;
    global $id;
    $objects = explode(",", $id);
    $object = $objects[sizeof($objects) - 1];
    if (!$object) {
        $object = 0;
    }
    if (sizeof($objects) == 1 && empty($objects[sizeof($objects) - 1])) {
        unset($objects);
    }
}
開發者ID:reinfurt,項目名稱:MOLLYS,代碼行數:43,代碼來源:systemCommand.php

示例13: DB_Query

function DB_Query($sql)
{
    global $footer;
    $result = MYSQL_QUERY($sql);
    if (!$result) {
        $message = "數據庫訪問錯誤代碼如下:\r\n";
        $message .= $sql . " \r\n";
        $message .= "錯誤內容: " . mysql_error() . " \r\n";
        $message .= "錯誤代碼: " . mysql_errno() . " \r\n";
        $message .= "時間: " . gmdate('Y-m-d H:i:s', time() + 3600 * 8) . "\r\n";
        $message .= "文件: http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
        echo '<center><font class=red><b>數據庫訪問錯誤!</b></font><br /><p><textarea rows="26" style="width:100%;font-size:12px;">' . htmlspecialchars($message) . '</textarea></p>
		<input type="button" name="back" value=" 返&nbsp;回 " onclick="history.back();return false;" />		
		</center>';
        echo $footer;
        exit;
    } else {
        return true;
    }
}
開發者ID:tecshuttle,項目名稱:51qsk,代碼行數:20,代碼來源:index.php

示例14: exportfile

 function exportfile($filename, $langid)
 {
     global $florensia;
     $langfile = $florensia->language_abs . "/{$langid}/{$filename}.lang.php";
     if (!rename($langfile, $langfile . '_backup_' . date("Y.m.d-H.i.s"))) {
         $florensia->notice("Cannot rename old file for backup. Please verify your chmod settings!", "warning");
         return false;
     }
     if (!($newfile = fopen($langfile, 'a'))) {
         $florensia->notice("Cannot create new file. Please verify your chmod settings!", "warning");
         return false;
     }
     $newlangfile = new SimpleXMLElement("<{$filename} createdate=\"" . date("Y-m-d H:i:s / U") . "\"></{$filename}>");
     $querylangvar = MYSQL_QUERY("SELECT varname, lang_{$langid} FROM flobase_languagefiles WHERE filename='" . mysql_real_escape_string($filename) . "'");
     while ($langvar = MYSQL_FETCH_ARRAY($querylangvar)) {
         $newlangfile->{$langvar}['varname'] = $langvar['lang_' . $langid];
     }
     $newlangfile->asXML($langfile);
     $florensia->notice("Language file and backup for {$langid}/{$filename} successfully created", "successful");
     return true;
 }
開發者ID:Rellfy,項目名稱:florensia-base,代碼行數:21,代碼來源:class_lang.php

示例15: displayCollapseList

function displayCollapseList($id = '0', $idFull = '0', $note = null, $pageName = 'main')
{
    // Find this .Notes object
    $sql = "SELECT *, objects.id AS objectsId FROM wires, objects ";
    $sql .= "WHERE wires.fromid = {$id} AND wires.toid = objects.id ";
    $sql .= "AND objects.name1 LIKE '.Notes' ";
    $sql .= "AND wires.active=1 AND objects.active=1 ";
    $sql .= "LIMIT 1";
    $result = MYSQL_QUERY($sql);
    // Find connected objects
    if ($myrow = MYSQL_FETCH_ARRAY($result)) {
        $foundObjectId = $myrow['objectsId'];
        $sql = "SELECT *, objects.id AS objectsId FROM wires, objects ";
        $sql .= "WHERE wires.fromid = {$foundObjectId} AND wires.toid = objects.id ";
        $sql .= "AND wires.active=1 AND objects.active=1 ";
        $sql .= "ORDER BY rank ASC";
        $result = MYSQL_QUERY($sql);
        // Output collapseList
        $i = 0;
        $notes = explode(",", $note);
        echo "\n\t<!-- collapseList -->";
        echo "\n\n\t<ul class = 'ieFix'>";
        while ($myrow = MYSQL_FETCH_ARRAY($result)) {
            for ($ii = 0; $ii < count($notes); $ii++) {
                if ($notes[$ii] == $myrow['objectsId']) {
                    $notesOut[$ii] = null;
                } else {
                    $notesOut[$ii] = $notes[$ii];
                }
            }
            $notesOutFiltered = array_filter($notesOut);
            $noteOut = implode(",", $notesOutFiltered);
            $noteOutStub = $noteOut ? $noteOut . "," : "";
            echo in_array($myrow['objectsId'], $notes) ? "\n\t\t<li class = 'collapseListOpen'>\n\t\t\t\t\t\t- <a href='" . $pageName . ".html?id=" . $idFull . "&amp;note=" . $noteOut . "'>" . $myrow["name1"] . "</a>" : "\n\t\t<li class = 'collapseListClosed'>\n\t\t\t\t\t\t+ <a href='" . $pageName . ".html?id=" . $idFull . "&amp;note=" . $noteOutStub . $myrow['objectsId'] . "'>" . $myrow["name1"] . "</a>";
            echo "\n\t<br /><br />" . $myrow["body"] . "<br/></li>";
            $i++;
        }
        echo "\n\t</ul>";
    }
}
開發者ID:reinfurt,項目名稱:MOLLYS,代碼行數:40,代碼來源:displayCollapseList.php


注:本文中的MYSQL_QUERY函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。