本文整理汇总了PHP中connectdb函数的典型用法代码示例。如果您正苦于以下问题:PHP connectdb函数的具体用法?PHP connectdb怎么用?PHP connectdb使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了connectdb函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchdata
function fetchdata()
{
if (connectdb()) {
$conn = connectdb();
}
echo "<html><head><script type=\"text/javascript\" src=\"script.js\"></script>\n\t\t<link href=\"editpage.css\" rel=\"stylesheet\" type=\"text/css\">\n\t\t</head>";
$data1 = mysqli_query($conn, "Select * from formdata");
echo "<h1> Subscriber details </h1>";
echo "<h2 id='message'></h2>";
echo "<table border=1 width=100>\n\t\t<tr>\n\t\t<th>Name</th>\n\t\t<th>Sex</th>\n\t\t<th>Email</th>\n\t\t<th>Country</th>\n\t\t<th>State</th>\n\t\t<th>Address</th>\n\t\t<th>Mobileno</th>\n\t\t<th>Interests</th>\n\t\t<th>Favorites</th>\n\t\t<th>EDIT</th>\n\t\t<th>Delete</th>\n\t\t</tr>";
while ($result = mysqli_fetch_array($data1)) {
echo "<tr >";
echo "<form method='post' style='width:200px'>";
echo "<td>" . "<input type='text' name='name' value='" . $result['name'] . "'></td>";
echo "<td>" . "<input type='text' name='sex' value='" . $result['sex'] . "'></td>";
echo "<td>" . "<input type='text' name='email' value='" . $result['email'] . "'></td>";
echo "<td>" . "<input type='text' name='country' value='" . $result['country'] . "'></td>";
echo "<td>" . "<input type='text' name='state' value='" . $result['state'] . "'></td>";
echo "<td>" . "<input type='text' name='address' value='" . $result['address'] . "'></td>";
echo "<td>" . "<input type='text' name='mobileno' value='" . $result['mobileno'] . "'></td>";
echo "<td>" . "<input type='text' name='interests' value='" . $result['interest'] . "'></td>";
echo "<td>" . "<input type='text' name='favorites' value='" . $result['favorites'] . "'></td>";
echo "<td>" . "<input type='button' name='edit' value='edit' onclick='modifydata(this)'>" . "</td>";
echo "<td>" . "<input type='button' name='delete' value='delete' onclick='modifydata(this)''>" . "</td>";
echo "</form>";
echo "</tr>";
}
echo "</table>";
echo "</html>";
mysqli_close($conn);
}
示例2: searchLoaiHH
function searchLoaiHH($value, $type)
{
$typesearch = "";
switch ($type) {
case "ID":
$typesearch = "IDLoaiHH";
break;
case "Ten":
$typesearch = "TenLoaiHH";
break;
case "MoTa":
$typesearch = "MoTa";
break;
}
$query_str = "select * from loaihanghoa_tbl where " . $typesearch . "='" . $value . "'";
//return $query_str;
$query_ext = mysql_query($query_str, connectdb()) or die(mysql_error());
if (mysql_num_rows($query_ext) > 0) {
while ($r = mysql_fetch_array($query_ext)) {
$rs[] = $r;
}
} else {
$rs = NULL;
}
return $rs;
}
示例3: getName
function getName()
{
connectdb();
$query = "SELECT name FROM prefs";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
return $row['name'];
}
示例4: viewnews
function viewnews()
{
global $database;
if ($database == null) {
connectdb();
}
$result = mysqli_query($database, "SELECT * FROM news");
return $result;
}
示例5: viewcandidate
function viewcandidate()
{
global $database;
if ($database == null) {
connectdb();
}
$result = mysqli_query($database, "SELECT * FROM user WHERE role='candidate'");
return $result;
}
示例6: viewewg
function viewewg()
{
global $database;
if ($database == null) {
connectdb();
}
$result = mysqli_query($database, "SELECT * FROM watchdog_group");
return $result;
}
示例7: viewannouncement
function viewannouncement()
{
global $database;
if ($database == null) {
connectdb();
}
$result = mysqli_query($database, "SELECT * FROM announcement");
return $result;
}
示例8: viewmember
function viewmember($data)
{
global $database;
if ($database == null) {
connectdb();
}
$result = mysqli_query($database, "SELECT * FROM watchdog_member WHERE groupname=" . $data);
return $result;
}
示例9: initDB
function initDB()
{
global $connectedtodb, $db;
if ($this->switches['Enable_Database']['enabled'] == true) {
if (!$connectedtodb) {
connectdb(false);
}
}
}
示例10: checkResult
function checkResult($question_id, $answer_opt_id)
{
$db = connectdb();
$sql = "SELECT score FROM answer_options WHERE question_id = :question_id AND answer_option_id = :answer_option_id";
$sth = $db->prepare($sql);
$sth->setFetchMode(PDO::FETCH_ASSOC);
$sth->execute(array(':answer_option_id' => $answer_opt_id, ':question_id' => $question_id));
$result = $sth->fetchAll();
return (int) $result[0]['score'];
}
示例11: login
function login($acc, $pw)
{
$str = "Select * from user_tbl where Username='" . $acc . "' and Password='" . $pw . "'";
//$str = "SELECT * FROM user_tbl";
$query = mysql_query($str, connectdb()) or die(mysql_error());
while ($r = mysql_fetch_array($query)) {
$rs[] = $r;
}
return $rs;
}
示例12: cand_prof
function cand_prof($id, $fname, $bdate, $pos, $posrun, $prov, $city)
{
global $database;
if ($database == null) {
connectdb();
}
$sql = "INSERT INTO candidate_profile(user_fk,name,birthday,province,city,current_position,position_running) VALUES ('" . $id . "','" . $fname . "','" . $bdate . "','" . $prov . "','" . $city . "','" . $pos . "','" . $posrun . "')";
var_dump($sql);
mysqli_query($database, $sql) or die("Error: " . mysqli_error($database));
// mysqli_close($database);
}
示例13: checkExistentQ_NQ
function checkExistentQ_NQ($idnhomquyen, $iddm)
{
$str = "select * from quyen_nhomquyen_tbl where IDNhomQuyen='" . $idnhomquyen . "' and IDDM='" . $iddm . "'";
$query = mysql_query($str, connectdb()) or die(mysql_error());
if (mysql_num_rows($query) > 0) {
$rs = true;
} else {
$rs = false;
}
return $rs;
}
示例14: getAllHH
function getAllHH()
{
$query_str = "select * from hanghoa_tbl";
$query_ext = mysql_query($query_str, connectdb()) or die(mysql_error());
if (mysql_num_rows($query_ext) > 0) {
while ($r = mysql_fetch_array($query_ext)) {
$rs[] = $r;
}
} else {
$rs = NULL;
}
return $rs;
}
示例15: getDMCon
function getDMCon($iddmcha)
{
$query_str = "select * from danhmuc_tbl where IDDMCha='" . $iddmcha . "'";
$query_ext = mysql_query($query_str, connectdb()) or die(mysql_error());
if (mysql_num_rows($query_ext) > 0) {
while ($r = mysql_fetch_array($query_ext)) {
$rs[] = $r;
}
} else {
$rs = NULL;
}
return $rs;
}