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


PHP DB::m方法代码示例

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


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

示例1: get_tree_nodes

    public static function get_tree_nodes($tree_name)
    {
        $dbh = DB::m();
        $tree_name = mysql_real_escape_string($tree_name, $dbh);
        $query = <<<SQL
SELECT
\thpi_navigation_trees.title AS tree_title,
\thpi_navigation_nodes.id AS node_id,
\thpi_navigation_nodes.parent_id AS parent_id,
\thpi_navigation_nodes.sort_order AS sort_order,\t
\thpi_navigation_nodes.open_in_new_window AS open_in_new_window,
\thpi_navigation_urls.title AS url_title,
\thpi_navigation_urls.href AS url_href
FROM
\thpi_navigation_trees
\t\tINNER JOIN hpi_navigation_nodes ON
\t\t\thpi_navigation_trees.id = hpi_navigation_nodes.tree_id
\t\tINNER JOIN hpi_navigation_urls ON
\t\t\thpi_navigation_nodes.url_id = hpi_navigation_urls.id
WHERE
\thpi_navigation_trees.title = '{$tree_name}'
ORDER BY
\tsort_order ASC
\t
SQL;
        #echo $query; exit;
        $result = mysql_query($query, $dbh);
        $nodes = array();
        while ($row = mysql_fetch_assoc($result)) {
            $nodes[] = $row;
        }
        return $nodes;
    }
开发者ID:saulhoward,项目名称:haddock-cms,代码行数:33,代码来源:Navigation_1DTreeRetriever.inc.php

示例2: render_tree

    public static function render_tree($tree_name)
    {
        $dbh = DB::m();
        $query = <<<SQL
SELECT
\thpi_navigation_trees.title AS tree_title,
\thpi_navigation_nodes.id AS node_id,
\thpi_navigation_nodes.parent_id AS parent_id,
\thpi_navigation_nodes.sort_order AS sort_order,\t
\thpi_navigation_nodes.open_in_new_window AS open_in_new_window,
\thpi_navigation_urls.title AS url_title,
\thpi_navigation_urls.href AS url_href
FROM
\thpi_navigation_trees
\t\tINNER JOIN hpi_navigation_nodes ON
\t\t\thpi_navigation_trees.id = hpi_navigation_nodes.tree_id
\t\tINNER JOIN hpi_navigation_urls ON
\t\t\thpi_navigation_nodes.url_id = hpi_navigation_urls.id
WHERE
\thpi_navigation_trees.title = '{$tree_name}'
ORDER BY
\tsort_order ASC
\t
SQL;
        #echo $query; exit;
        $result = mysql_query($query, $dbh);
        $nodes = array();
        while ($row = mysql_fetch_assoc($result)) {
            $nodes[] = $row;
        }
        #print_r($nodes);
        #exit;
        $links_tree = new Navigation_LinksTree($node);
        $links_tree->render_ol();
    }
开发者ID:saulhoward,项目名称:haddock-cms,代码行数:35,代码来源:Navigation_SPoE.inc.php

示例3: is_user_id_allowed_to_view_drama

    public function is_user_id_allowed_to_view_drama($user_id, Oedipus_Drama $drama)
    {
        $user = NULL;
        $drama_id = $drama->get_id();
        if (InputValidation_NumberValidator::validate_database_id($user_id)) {
            $dbh = DB::m();
            $user_id = mysql_real_escape_string($user_id, $dbh);
            $query = <<<SQL
SELECT
\tcount(user_id) AS count
FROM
\toedipus_users_allowed_to_view_drama_links
WHERE
\toedipus_users_allowed_to_view_drama_links.user_id = {$user_id}
\tAND
\toedipus_users_allowed_to_view_drama_links.drama_id = {$drama_id}
SQL;
            $result = mysql_query($query, $dbh);
            if ($row = mysql_fetch_assoc($result)) {
                if ($row['count'] == 1) {
                    return TRUE;
                }
                return FALSE;
            }
        }
    }
开发者ID:saulhoward,项目名称:oedipus-decision-maker,代码行数:26,代码来源:Oedipus_UsersHelper.inc.php

示例4: edit_something

    public function edit_something()
    {
        //print_r($_POST);exit;
        //print_r($_GET);exit;
        $dbh = DB::m();
        $id = mysql_real_escape_string($_GET['id']);
        $name = mysql_real_escape_string($_POST['name']);
        $url = mysql_real_escape_string($_POST['url']);
        $status = mysql_real_escape_string($_POST['status']);
        $haddock_class_name = mysql_real_escape_string($_POST['haddock_class_name']);
        $stmt = <<<SQL
UPDATE
\thpi_video_library_external_video_providers
SET
\tname = '{$name}',
\turl = '{$url}',
\thaddock_class_name = '{$haddock_class_name}',
\tstatus = '{$status}'
WHERE
\tid = {$id}

SQL;
        // print_r($stmt);exit;
        $result = mysql_query($stmt, $dbh);
        return $id;
    }
开发者ID:saulhoward,项目名称:haddock-cms,代码行数:26,代码来源:VideoLibrary_ManageExternalVideoProvidersAdminRedirectScript.inc.php

示例5: render_news_item

    public static function render_news_item($news_item_id)
    {
        $dbh = DB::m();
        $query = <<<SQL
SELECT
\t*
FROM
\thpi_news_items
WHERE
\tid = {$news_item_id}
SQL;
        $result = mysql_query($query, $dbh);
        if (mysql_num_rows($result) == 0) {
            throw new Exception('No news item found!');
        } else {
            $news_item = mysql_fetch_assoc($result);
            /*
             * The title,
             */
            echo '<h3>';
            echo $news_item['title'];
            echo "&nbsp;\n";
            echo date('d/m/y', strtotime($news_item['submitted']));
            echo "</h3>\n";
            /*
             * The first paragraph.
             */
            $item = $news_item['item'];
            $item = stripslashes($item);
            $paragraphs = Strings_Splitter::blank_line_separated($item);
            foreach ($paragraphs as $p) {
                echo "<p>{$p}</p>\n";
            }
        }
    }
开发者ID:saulhoward,项目名称:haddock-cms,代码行数:35,代码来源:News_SPoE.inc.php

示例6: delete_everything

    public function delete_everything()
    {
        $dbh = DB::m();
        $stmt = <<<SQL
TRUNCATE TABLE
\thpi_polls_answers
SQL;
        mysql_query($stmt, $dbh);
    }
开发者ID:saulhoward,项目名称:haddock-cms,代码行数:9,代码来源:Polls_ManageAnswersAdminRedirectScript.inc.php

示例7: delete_everything

    public function delete_everything()
    {
        $dbh = DB::m();
        $stmt = <<<SQL
TRUNCATE TABLE
\thpi_navigation_nodes
SQL;
        mysql_query($stmt, $dbh);
    }
开发者ID:saulhoward,项目名称:haddock-cms,代码行数:9,代码来源:Navigation_ManageNodesAdminRedirectScript.inc.php

示例8: content

    public function content()
    {
        $dbh = DB::m();
        $query = <<<SQL
SELECT
\t*
FROM
\thpi_polls_questions
ORDER BY
\tquestion ASC
SQL;
        $result = mysql_query($query, $dbh);
        $questions = array();
        while ($row = mysql_fetch_assoc($result)) {
            $questions[] = $row;
        }
        ?>
<table>
	<caption>Questions</caption>
	<thead>
		<tr>
			<th>Question</th>
			<th>Current</th>
			<th>Make Current</th>
		</tr>
	</thead>
	<tbody>
<?php 
        foreach ($questions as $question) {
            echo "<tr>\n";
            echo "<td>\n";
            echo stripcslashes($question['question']);
            echo "</td>\n";
            echo "<td>\n";
            echo $question['current'];
            echo "</td>\n";
            echo "<td>\n";
            if ($question['current'] == 'Yes') {
                echo '&nbsp;';
            } else {
                echo '<a ';
                $return_to = $this->get_current_base_url();
                $return_to = urlencode($return_to->get_as_string());
                echo ' href="/haddock/public-html/public-html/index.php?oo-page=1&page-class=Polls_ChooseCurrentQuestionAdminRedirectScript&question_id=' . $question['id'] . '&return_to=' . $return_to . '" ';
                echo '>';
                echo "Do it";
                echo "</a>\n";
            }
            echo "</td>\n";
            echo "</tr>\n";
        }
        ?>
	</tbody>
</table>
<?php 
    }
开发者ID:saulhoward,项目名称:haddock-cms,代码行数:56,代码来源:Polls_ChooseCurrentQuestionAdminPage.inc.php

示例9: render_edit_something_form_ol

    protected function render_edit_something_form_ol()
    {
        $acm = $this->get_admin_crud_manager();
        echo "<ol>\n";
        ?>
			<li>
<?php 
        $dbh = DB::m();
        $query = <<<SQL
SELECT
\tid,
\tquestion
FROM
\thpi_polls_questions
ORDER BY
\tquestion ASC
SQL;
        $result = mysql_query($query, $dbh);
        if ($result && mysql_num_rows($result) > 0) {
            ?>
				<label for="question_id">Question</label>
				<select
					name="question_id"
				>
				<?php 
            while ($row = mysql_fetch_assoc($result)) {
                ?>
					<option value="<?php 
                echo $row['id'];
                ?>
" <?php 
                if ($acm->has_current_var('question_id') && $acm->get_current_var('question_id') == $row['id']) {
                    echo ' selected="selected"';
                }
                ?>
><?php 
                echo stripcslashes($row['question']);
                ?>
</option>
				<?php 
            }
            ?>
				</select>
<?php 
        } else {
            ?>
<p class="error">No questions available!</p>
<?php 
        }
        ?>
			</li>
<?php 
        $this->render_edit_something_form_li_text_input('answer');
        echo "</ol>\n";
    }
开发者ID:saulhoward,项目名称:haddock-cms,代码行数:55,代码来源:Polls_ManageAnswersAdminPage.inc.php

示例10: delete_everything

    public function delete_everything()
    {
        $dbh = DB::m();
        $acm = $this->get_admin_crud_manager();
        $table_name = $acm->get_table_name();
        $stmt = <<<SQL
TRUNCATE TABLE
\t{$table_name}
SQL;
        mysql_query($stmt, $dbh);
    }
开发者ID:saulhoward,项目名称:haddock-cms,代码行数:11,代码来源:Database_ManageSimpleCRUDAdminRedirectScript.inc.php

示例11: restore_all_products

    public static function restore_all_products()
    {
        $dbh = DB::m();
        $stmt = <<<SQL
UPDATE
\thpi_trackit_stock_management_products
SET
\tdeleted = 'No'
SQL;
        #echo $stmt;
        mysql_query($stmt, $dbh);
    }
开发者ID:saulhoward,项目名称:haddock-cms,代码行数:12,代码来源:TrackitStockManagement_ProductsHelper.inc.php

示例12: get_rows_for_query

 public static function get_rows_for_query(Database_SQLSelectQuery $query)
 {
     $rows = array();
     $dbh = DB::m();
     $str_query = $query->get_as_string();
     #echo "\$str_query: $str_query\n";
     #exit;
     $result = mysql_query($str_query, $dbh);
     while ($row = mysql_fetch_assoc($result)) {
         $rows[] = $row;
     }
     #print_r($rows);
     return $rows;
 }
开发者ID:saulhoward,项目名称:haddock-cms,代码行数:14,代码来源:Database_FetchingHelper.inc.php

示例13: delete_everything

    public function delete_everything()
    {
        $dbh = DB::m();
        $stmt = <<<SQL
TRUNCATE TABLE
\thpi_video_library_external_video_libraries
SQL;
        mysql_query($stmt, $dbh);
        $stmt_2 = <<<SQL
TRUNCATE TABLE
\thpi_video_library_ext_vid_to_ext_vid_lib_links
SQL;
        mysql_query($stmt_2, $dbh);
    }
开发者ID:saulhoward,项目名称:haddock-cms,代码行数:14,代码来源:VideoLibrary_ManageExternalVideoLibrariesAdminRedirectScript.inc.php

示例14: disassociate_product_photo

    public static function disassociate_product_photo($product_id, $photograph_id)
    {
        $dbh = DB::m();
        $product_id = mysql_real_escape_string($product_id, $dbh);
        $photograph_id = mysql_real_escape_string($photograph_id, $dbh);
        $stmt = <<<SQL
DELETE FROM
\thpi_shop_product_photograph_links
WHERE
\tproduct_id = {$product_id}
\tAND
\tphotograph_id = {$photograph_id}
SQL;
        mysql_query($stmt, $dbh);
    }
开发者ID:saulhoward,项目名称:haddock-cms,代码行数:15,代码来源:Shop_ProductsHelper.inc.php

示例15: delete_row

    public static function delete_row($id, $table_name)
    {
        $dbh = DB::m();
        $id = mysql_real_escape_string($id, $dbh);
        $table_name = mysql_real_escape_string($table_name, $dbh);
        $stmt = <<<SQL
DELETE
FROM
\t{$table_name}
WHERE
\tid = {$id}
SQL;
        mysql_query($stmt, $dbh);
        if (mysql_error($dbh)) {
            throw new Database_MySQLException($dbh);
        } else {
            return TRUE;
        }
    }
开发者ID:saulhoward,项目名称:haddock-cms,代码行数:19,代码来源:Database_TableHelper.inc.php


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