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


PHP connectdb函数代码示例

本文整理汇总了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);
}
开发者ID:ranajitbanerjee,项目名称:ranajitbanerjee.github.io,代码行数:31,代码来源:EditAndDelete.php

示例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;
}
开发者ID:htwap,项目名称:TuToanGrating,代码行数:26,代码来源:qlloaihanghoa_model.php

示例3: getName

function getName()
{
    connectdb();
    $query = "SELECT name FROM prefs";
    $result = mysql_query($query);
    $row = mysql_fetch_array($result);
    return $row['name'];
}
开发者ID:shishirt22,项目名称:cmaster,代码行数:8,代码来源:functions.php

示例4: viewnews

function viewnews()
{
    global $database;
    if ($database == null) {
        connectdb();
    }
    $result = mysqli_query($database, "SELECT * FROM news");
    return $result;
}
开发者ID:jomarfuriscal,项目名称:projectbantay,代码行数:9,代码来源:viewnews.php

示例5: viewcandidate

function viewcandidate()
{
    global $database;
    if ($database == null) {
        connectdb();
    }
    $result = mysqli_query($database, "SELECT * FROM user WHERE role='candidate'");
    return $result;
}
开发者ID:jomarfuriscal,项目名称:projectbantay,代码行数:9,代码来源:viewuser.php

示例6: viewewg

function viewewg()
{
    global $database;
    if ($database == null) {
        connectdb();
    }
    $result = mysqli_query($database, "SELECT * FROM watchdog_group");
    return $result;
}
开发者ID:jomarfuriscal,项目名称:projectbantay,代码行数:9,代码来源:viewewg.php

示例7: viewannouncement

function viewannouncement()
{
    global $database;
    if ($database == null) {
        connectdb();
    }
    $result = mysqli_query($database, "SELECT * FROM announcement");
    return $result;
}
开发者ID:jomarfuriscal,项目名称:projectbantay,代码行数:9,代码来源:viewannouncement.php

示例8: viewmember

function viewmember($data)
{
    global $database;
    if ($database == null) {
        connectdb();
    }
    $result = mysqli_query($database, "SELECT * FROM watchdog_member WHERE groupname=" . $data);
    return $result;
}
开发者ID:jomarfuriscal,项目名称:projectbantay,代码行数:9,代码来源:viewmember.php

示例9: initDB

 function initDB()
 {
     global $connectedtodb, $db;
     if ($this->switches['Enable_Database']['enabled'] == true) {
         if (!$connectedtodb) {
             connectdb(false);
         }
     }
 }
开发者ID:kagetenshi,项目名称:xenoberage,代码行数:9,代码来源:setup_info_class.php

示例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'];
}
开发者ID:uchechukwudim,项目名称:testandtreatmalaria,代码行数:10,代码来源:connect.php

示例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;
}
开发者ID:htwap,项目名称:TuToanGrating,代码行数:10,代码来源:login_model.php

示例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);
}
开发者ID:jomarfuriscal,项目名称:projectbantay,代码行数:11,代码来源:add_user.php

示例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;
}
开发者ID:htwap,项目名称:TuToanGrating,代码行数:11,代码来源:qlquyennhomquyen_model.php

示例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;
}
开发者ID:htwap,项目名称:TuToanGrating,代码行数:13,代码来源:qlhanghoa_model.php

示例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;
}
开发者ID:htwap,项目名称:TuToanGrating,代码行数:13,代码来源:qldanhmuc_model.php


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