本文整理汇总了PHP中DbConnect::connection方法的典型用法代码示例。如果您正苦于以下问题:PHP DbConnect::connection方法的具体用法?PHP DbConnect::connection怎么用?PHP DbConnect::connection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DbConnect
的用法示例。
在下文中一共展示了DbConnect::connection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: session_start
<?php
session_start();
header("content-type:text/html;charset=utf-8");
require_once './function/DbConnect.php';
$openid = $_SESSION['openid'];
if (!isset($openid)) {
exit;
}
if (($_POST['name'] == null or $_POST['number']) == null or $_POST['telephone'] == null) {
echo "对不起,信息不全,请重新填写";
sleep(3);
echo "<script language=\"javascript\">";
echo "history.go(-1)";
echo "</script>";
} else {
$con = DbConnect::connection();
DbConnect::insertByUsername($openid, $_POST['name'], $_POST['sex'], $_POST['apartment'], $_POST['number'], $_POST['telephone'], $con);
$url = "order.php";
echo "<script language=\"javascript\">";
echo "location.href=\"{$url}\"";
echo "</script>";
}
示例2: modifyPrice
public static function modifyPrice()
{
echo "<form action=\"manager.php?action=modifyPrice\" method=\"post\"><select name=\"rest\">";
$con = DbConnect::connection();
mysql_select_db("app_mtcds", $con);
$result = mysql_query("select * from restaurant");
while ($row = mysql_fetch_array($result)) {
echo "<option value=" . $row['restid'] . "> " . $row['name'] . "</option>";
}
echo "</select>";
echo "<select name=\"type\">";
$result = mysql_query("select * from type");
while ($row = mysql_fetch_array($result)) {
echo "<option value=" . $row['id'] . "> " . $row['name'] . "</option>";
}
echo "</select>";
echo "<input type='text' name='number'>";
echo "<input type='submit' value='提交'>";
echo "</form>";
}