• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP fetch_all函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中fetch_all函数的典型用法代码示例。如果您正苦于以下问题:PHP fetch_all函数的具体用法?PHP fetch_all怎么用?PHP fetch_all使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: content

function content()
{
    if (!user_logged_in()) {
        return must_log_in();
    }
    $user = fetch_one_or_none('users', 'id', user_logged_in());
    if (!array_key_exists('token', $_GET) || !$_GET['token'] || $_GET['token'] != sha1($user->new_email_address)) {
        $errors[] = 'Invalid reset token';
    }
    # This can happen if two accounts try to change address at similar times.
    if (count($errors) == 0 && count(fetch_all('users', 'email_address', $user->new_email_address))) {
        $errors[] = "A user with this email address already exists";
    }
    if (count($errors) == 0) {
        update_all('users', array('email_address' => $user->new_email_address, 'new_email_address' => null), 'id', user_logged_in());
        ?>
    <h2>Address changed</h2>
    <p>Your email address has been changed to
      <tt><?php 
        esc($user->new_email_address);
        ?>
</tt>.</p>
    <?php 
        return;
    }
    page_header('Address verification failed');
    show_error_list($errors);
}
开发者ID:ras52,项目名称:geneopedia,代码行数:28,代码来源:verify-email.php


示例2: do_login

function do_login()
{
    global $errors;
    $errors = array();
    if (!array_key_exists('email', $_POST) || !$_POST['email'] || !array_key_exists('password', $_POST) || !$_POST['password']) {
        $errors[] = "Please provide both an email address and a password";
    }
    if (count($errors)) {
        return;
    }
    $email = $_POST['email'];
    $password = $_POST['password'];
    error_log("Login attempt from <{$email}>");
    $users = fetch_all('users', 'email_address', $email);
    if (count($users) > 1) {
        die('Multiple users with that address!');
    }
    if (count($users) == 0) {
        $errors[] = 'Incorrect email address';
    } elseif (crypt($password, $users[0]->password_crypt) != $users[0]->password_crypt) {
        $errors[] = 'Incorrect password';
    } elseif (!$users[0]->date_verified) {
        $errors[] = 'Your account is not yet activated';
    } elseif (!$users[0]->date_approved) {
        $errors[] = 'Your account is not yet approved';
    }
    if (count($errors)) {
        return;
    }
    $forever = array_key_exists('forever', $_POST) && $_POST['forever'];
    set_login_cookie($uid = $users[0]->id, $forever ? 2147483647 : 0);
    error_log("Login succeeded from <{$email}>");
    redirect_away();
}
开发者ID:ras52,项目名称:geneopedia,代码行数:34,代码来源:login.php


示例3: login_user

function login_user($connection, $post)
{
    $_SESSION['login_errors'] = array();
    if (empty($post['user_name'])) {
        $_SESSION['login_errors'][] = 'User Name cannot be blank';
    }
    if (empty($post['password'])) {
        $_SESSION['login_errors'][] = 'Password cannot be blank';
    }
    if (count($_SESSION['login_errors']) > 0) {
        header('Location: login.php');
    } else {
        $user_name = mysqli_real_escape_string($connection, $post['user_name']);
        $password = mysqli_real_escape_string($connection, $post['password']);
        $query = "SELECT * FROM users WHERE users.user_name = '{$user_name}'";
        $result = fetch_all($query);
        if (!empty($result) && $result[0]['password'] == $password) {
            $_SESSION['user_name'] = $user_name;
            $_SESSION['user_id'] = $result[0]['id'];
            header('Location: success.php');
        } else {
            $_SESSION['login_errors'][] = 'Login Failed';
            header('Location: login.php');
        }
    }
}
开发者ID:jenst44,项目名称:Procedural-PHP-practice,代码行数:26,代码来源:loginProcess.php


示例4: get_column_names_by_table_name

function get_column_names_by_table_name($table)
{
    $result_one_row = fetch_all(mysql_query("SELECT * FROM `{$table}` LIMIT 1"));
    $table_column_names = array();
    for ($i = 0; $i < mysql_num_fields($result_one_row); ++$i) {
        $table_column_names[] = mysql_field_name($result_one_row, $i);
    }
    return $table_column_names;
}
开发者ID:terry80504,项目名称:MySQL-HBase-SQLBridge,代码行数:9,代码来源:common.php


示例5: content

function content()
{
    if (!user_logged_in()) {
        return must_log_in();
    }
    $user = fetch_one_or_none('users', 'id', user_logged_in());
    $errors = array();
    if (array_key_exists('change', $_POST)) {
        if (!isset($_POST['email']) || !$_POST['email']) {
            $errors[] = "Please enter an email address";
        } else {
            $email = $_POST['email'];
            if ($email && !validate_email_address($email)) {
                $errors[] = "Invalid email address";
            }
            if (count($errors) == 0 && count(fetch_all('users', 'email_address', $email))) {
                $errors[] = "A user with this email address already exists";
            }
            if (count($errors) == 0) {
                update_all('users', array('new_email_address' => $email), 'id', user_logged_in());
                send_email_change_email($email, $user->name);
                ?>
        <p>We have sent an email to your new address requesting that you
          confirm that change of address.</p>
        <?php 
                return;
            }
        }
    }
    $fields = array();
    page_header('Change email address');
    show_error_list($errors);
    ?>
 
    <form method="post" action="" accept-charset="UTF-8">
      <div class="fieldrow">
        <div class="field">
          <label>Current address:</label>
          <div><tt><?php 
    esc($user->email_address);
    ?>
</tt></div>
        </div>
      </div>

      <div class="fieldrow">
        <?php 
    text_field($fields, 'email', 'New address');
    ?>
      </div>

      <div class="fieldrow">
        <input type="submit" name="change" value="Change"/>
      </div>
    </form>
  <?php 
}
开发者ID:ras52,项目名称:geneopedia,代码行数:57,代码来源:change-email.php


示例6: get_notes

function get_notes($user_id)
{
    $mysql_link = connect();
    $query = sprintf("SELECT * FROM note WHERE user_id='%s'", mysql_real_escape_string($user_id, $mysql_link));
    $result = mysql_query($query, $mysql_link);
    $notes = fetch_all($result);
    disconnect($mysql_link);
    return $notes;
}
开发者ID:romaimperator,项目名称:trustauth-demo,代码行数:9,代码来源:mysql.php


示例7: get_all_comments

function get_all_comments($message_id)
{
    $query = "SELECT comment,\n\t\t\t\t  users.first_name AS first_name,\n\t\t\t\t  users.last_name AS last_name,\n\t\t\t\t  comments.created_at AS created_at\n\t\t\t\t  FROM comments\n\t\t\t\t  LEFT JOIN messages\n\t\t\t\t  ON comments.message_id = messages.id\n\t\t\t\t  LEFT JOIN users\n\t\t\t\t  ON comments.user_id = users.id\n\t\t\t\t  WHERE message_id = '{$message_id}'";
    $comments = fetch_all($query);
    if (count($comments) > 0) {
        $_SESSION["comments"] = $comments;
    } else {
        $_SESSION["comments"] = array();
    }
}
开发者ID:raymondluu,项目名称:the_wall,代码行数:10,代码来源:wall_process.php


示例8: register_user

function register_user($post)
{
    $_SESSION['errors'] = array();
    // Assigning more secure variables to important fields using escape_this_string function
    $username = escape_this_string($post['username']);
    $email = escape_this_string($post['email']);
    $password = escape_this_string($post['password']);
    // Beginning of validation checks
    // Attempt at validating existing information
    $check_data_query = "SELECT users.username, users.email FROM users";
    $existing_users = fetch_all($check_data_query);
    if (!empty($existing_users)) {
        foreach ($existing_users as $user) {
            if ($username == $user['username']) {
                $_SESSION['errors'][] = 'This username is already taken.';
            }
            if ($email == $user['email']) {
                $_SESSION['errors'][] = 'This email is already in use.';
            }
        }
    }
    // Validating non-existing information to make sure nothing is blank or invalid
    if (empty($username)) {
        $_SESSION['errors'][] = "Username cannot be blank.";
    }
    if (empty($post['first_name'])) {
        $_SESSION['errors'][] = "First name cannot be blank.";
    }
    if (empty($post['last_name'])) {
        $_SESSION['errors'][] = "Last name cannot be blank.";
    }
    if (empty($password)) {
        $_SESSION['errors'][] = "Password fields cannot be blank.";
    }
    if ($post['password'] !== $post['confirm_password']) {
        $_SESSION['errors'][] = "Passwords must match.";
    }
    if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
        $_SESSION['errors'][] = "Please use a valid email address.";
    }
    if (count($_SESSION['errors']) > 0) {
        header('Location: main.php');
        exit;
    } else {
        // Here I am gonna encrypt both the email and password and then I'm going to make a query to insert that data into the database
        $salt = bin2hex(openssl_random_pseudo_bytes(22));
        $encrypted_password = md5($password . '' . $salt);
        $query = "INSERT INTO users (username, first_name, last_name, email, password, salt, created_at, updated_at) \n\t\t\t  \t\t  VALUES ('{$username}', '{$post['first_name']}', '{$post['last_name']}', '{$email}', '{$encrypted_password}', '{$salt}', NOW(), NOW())";
        run_mysql_query($query);
        $_SESSION['success'] = "User has been successfully created!";
        header('Location: main.php');
        exit;
    }
}
开发者ID:aquang9124,项目名称:the_wall,代码行数:54,代码来源:process.php


示例9: checkduplicate

function checkduplicate($text)
{
    // if the last string is a forward slash, then remove the forward slash and re-evaluate
    if (substr($text, strlen($text) - 1, 1) !== '/') {
        $text = $text . '/';
    }
    $query = 'SELECT * FROM scrapper WHERE ref_link = "' . $text . '"';
    $query_result = fetch_all($query);
    if (count($query_result) == 0) {
        return true;
    }
    return false;
}
开发者ID:eddiebanz,项目名称:tourism,代码行数:13,代码来源:crawler_lib.php


示例10: login_user

function login_user($post)
{
    $query = "SELECT * FROM users WHERE users.email = '{$post['email']}' AND users.password = '{$post['password']}'";
    $user = fetch_all($query);
    if (count($user) > 0) {
        $_SESSION['user_id'] = $user[0]['id'];
        $_SESSION['f_name'] = $user[0]['first_name'];
        $_SESSION['logged_in'] = true;
        header('location: success.php');
    } else {
        $_SESSION['errors'][] = 'check credentials';
        header('location: index.php');
    }
}
开发者ID:Eggsix,项目名称:dojo_projects,代码行数:14,代码来源:process.php


示例11: post_comment

function post_comment($post)
{
    if (empty($post['comments'])) {
        $_SESSION['errors'][] = "Please submit a comment.";
        header("Location: success.php");
        exit;
    } elseif (!empty($post['comments'])) {
        $query = "INSERT INTO comments (comment, created_at, updated_at, users_id, messages_id)\r\n\t\t\t\tVALUES ('{$post['comments']}', NOW(), NOW(), '{$post['user_id']}', '{$post['message_id']}')";
        run_mysql_query($query);
        $query = "SELECT * FROM users\r\n\t\t\t\tLEFT JOIN comments\r\n\t\t\t\tON users.id = comments.users_id";
        $_SESSION['comments'] = fetch_all($query);
        header("Location: success.php");
        die;
    }
}
开发者ID:aespidol,项目名称:wall,代码行数:15,代码来源:wall_process.php


示例12: login_user

function login_user($post)
{
    $query = "SELECT * FROM users\n\t\t\t\t  WHERE users.password = '{$_POST['password']}'\n\t\t\t\t  AND users.email = '{$_POST['email']}'";
    $user = fetch_all($query);
    if (count($user) > 0) {
        $_SESSION["user_id"] = $user[0]["id"];
        $_SESSION["first_name"] = $user[0]["first_name"];
        $_SESSION["logged_in"] = TRUE;
        header("Location: success.php");
        die;
    } else {
        $_SESSION["errors"][] = "Can't find a user with those credentials!";
        header("Location: index.php");
        die;
    }
}
开发者ID:raymondluu,项目名称:login_and_registration,代码行数:16,代码来源:process.php


示例13: login_user

function login_user($post)
{
    $query = "SELECT * FROM users WHERE users.password = '{$post['password']}'\r\n\t\t\tAND users.email = '{$post['email']}'";
    $user = fetch_all($query);
    $query = "SELECT * FROM users\r\n\t\t \t\t  LEFT JOIN messages\r\n\t\t \t\t  ON users.id = messages.users_id\r\n\t\t \t\t  ORDER BY messages.created_at ASC";
    $_SESSION['records'] = fetch_all($query);
    $query = "SELECT * FROM users \r\n\t\t\t\tLEFT JOIN comments\r\n\t\t\t\tON users.id = comments.users_id";
    $_SESSION['comments'] = fetch_all($query);
    if (count($user) > 0) {
        $_SESSION['user_id'] = $user[0]['id'];
        $_SESSION['first_name'] = $user[0]['first_name'];
        $_SESSION['logged_in'] = TRUE;
        header("location: success.php");
    } else {
        $_SESSION['errors'][] = "can't find a user with those credentials";
        header("location: index.php");
        die;
    }
}
开发者ID:aespidol,项目名称:wall,代码行数:19,代码来源:process.php


示例14: login_user

function login_user($post)
{
    $query = "SELECT * FROM users WHERE users.password = '{post['password']}' \n\t\t\t\t  AND users.email = '{$post['email']}'";
    $user = fetch_all($query);
    echo $user;
    if (count($user) > 0) {
        $_SESSION['user_id'] = $user[0]['id'];
        $_SESSION['first_name'] = $user[0]['first_name'];
        $_SESSION['logged_in'] = TRUE;
        header('location: success.php');
    } else {
        //			$_SESSION['errors'][] = array();
        $_SESSION['errors'][] = "can't find a user with those credentials";
        //			header('location: index.php');
        //			die();
    }
    echo $query;
    //		die();
}
开发者ID:jreyles,项目名称:lamp-stack,代码行数:19,代码来源:process.php


示例15: np_character_from_blueprint

 function np_character_from_blueprint($blueprint, $level = 1, $username = 'phaos_npc')
 {
     $this->level = intval($level);
     if ($level < 0) {
         $level = 1;
         echo "<p>bad level input for npc!</p>";
     }
     //define main vars
     $this->id = -1;
     $this->name = $blueprint["name"];
     $this->user = $username;
     $this->cclass = $blueprint["class"];
     $this->race = $blueprint["race"];
     $this->sex = rand(0, 1) ? 'Female' : 'Male';
     $this->image = $blueprint["image_path"];
     $this->age = $this->level * $this->level;
     $this->location = 0;
     //define attribute vars
     $this->strength = (int) ($blueprint["min_damage"] + 3 * ($this->level - 1));
     $this->dexterity = (int) ($blueprint["max_damage"] - $blueprint["min_damage"] + 2 * $this->level + 2);
     $this->wisdom = (int) ($blueprint["xp_given"] / 2 + $this->level);
     //define changeable vars( well except constitution )
     $this->hit_points = $blueprint["hit_points"] + rand(0, $this->level * 3);
     $this->constitution = (int) (($this->hit_points + 10) / 6);
     $this->stamina_points = ($this->constitution + $this->strength) * 5;
     $this->level = $this->level;
     //This are the most significant changes from 0.90
     $ac_left = fairInt($blueprint['AC'] * sqrt($this->level * 0.25));
     $this->xp = fairInt($blueprint["xp_given"] * (0.5 + sqrt($this->level * 0.25)));
     $this->gold = fairInt($blueprint["gold_given"] * (0.5 + sqrt($this->level * 0.25)));
     $this->stat_points = 0;
     //skills
     $this->fight = 4 + $this->level;
     $this->defence = (int) ($blueprint['AC'] / 4 + $this->level - 1);
     $this->lockpick = 1 + (int) ($this->wisdom / 4);
     $this->traps = 1 + (int) ($this->wisdom / 2);
     //define equipment vars
     $this->weapon = 0;
     $this->armor = 0;
     $this->boots = 0;
     $this->shield = 0;
     $this->gloves = 0;
     $this->helm = 0;
     //FIXME: we need natural armor to clothe e.g. dragons
     //FIXME: armor class needs to be spent more evenly among armor types
     if ($ac_left > 0) {
         $armors = fetch_all("select id, armor_class from phaos_armor where armor_class<={$ac_left} order by armor_class DESC LIMIT 1");
         if (count($armors) > 0) {
             $this->armor = $armors[0]['id'];
             $this->armor_ac = $armors[0]['armor_class'];
             $ac_left -= $this->armor_ac;
         }
     }
     if ($ac_left > 0) {
         $boots = fetch_all("select id, armor_class from phaos_boots where armor_class<={$ac_left} order by armor_class DESC LIMIT 1");
         if (count($boots) > 0) {
             $this->boots = $boots[0]['id'];
             $this->boots_ac = $boots[0]['armor_class'];
             $ac_left -= $this->boots_ac;
         }
     }
     //fill weapon:
     $blueprint['avg_damage'] = (int) (($blueprint["min_damage"] + $blueprint["max_damage"]) * 0.5);
     $weapons = fetch_all("select * from phaos_weapons where min_damage<={$blueprint['min_damage']} and {$blueprint['avg_damage']}<= 2*max_damage order by RAND() LIMIT 1");
     if (count($weapons) > 0) {
         $this->weapon = $weapons[0]['id'];
         $this->weapon_min = $weapons[0]['min_damage'];
         $this->weapon_max = $weapons[0]['max_damage'];
         $this->weapon_name = $weapons[0]['name'];
     } else {
         $this->weapon_min = 0;
         $this->weapon_max = 0;
         $this->weapon_name = "natural weapon";
     }
     $this->weaponless = $blueprint['avg_damage'] + 2 * (int) $this->level;
     //calculated stuff
     $this->available_points = $this->strength + $this->dexterity + $this->wisdom + $this->constitution;
     $this->max_hp = $this->constitution * 6;
     $this->max_stamina = ($this->constitution + $this->strength) * 10;
     $this->max_rep = 7;
     if ($this->hit_points > $this->max_hp) {
         $this->max_hp = $this->hit_points;
     }
     if ($this->stamina_points > $this->max_stamina) {
         $this->max_stamina = $this->stamina_points;
     }
     //other stuff
     $actTime = time();
     $this->regen_time = $actTime;
     $this->stamina_time = $actTime;
     $this->rep_time = $actTime;
     $this->no_regen_hp = $blueprint["hit_points"];
     //regeneration
     $this->time_since_regen = $actTime - $this->regen_time;
     $this->stamina_time_since_regen = $actTime - $this->stamina_time;
     $this->rep_time_since_regen = $actTime - $this->rep_time;
     //reputation
     $this->rep_points = rand(0, $this->level - 1);
     $this->rep_helpfull = rand(0, $this->level - 1);
     $this->rep_generious = rand(0, $this->level - 1);
//.........这里部分代码省略.........
开发者ID:renlok,项目名称:PhaosRPG,代码行数:101,代码来源:class_character.php


示例16: asurvey

function asurvey()
{
    global $prefix, $sqldbdb, $MySQL, $set, $langmessage;
    if (file_exists("addons/survey/lang/lang_" . $set['language'] . ".php")) {
        require_once "addons/survey/lang/lang_" . $set['language'] . ".php";
    } else {
        require_once "addons/survey/lang/lang_en_US.php";
    }
    // Check if table exists in the database
    if ($MySQL == 0) {
        if (!($aa = sqlite_fetch_column_types($prefix . "surveynames", $sqldbdb))) {
            dbquery("CREATE TABLE " . $prefix . "surveynames ( id INTEGER NOT NULL PRIMARY KEY, surveyid INTEGER NOT NULL, surveyname VARCHAR(80), place INTEGER NOT NULL, adminlevel INTEGER NOT NULL)");
        }
        if (!($aa = sqlite_fetch_column_types($prefix . "surveyvotes", $sqldbdb))) {
            dbquery("CREATE TABLE " . $prefix . "surveyvotes ( id INTEGER NOT NULL PRIMARY KEY, surveyid INTEGER NOT NULL, vote INTEGER NOT NULL, voterid INTEGER NOT NULL)");
        }
    } else {
        dbquery("CREATE TABLE IF NOT EXISTS " . $prefix . "surveynames ( id INTEGER NOT NULL auto_increment, surveyid INTEGER NOT NULL, surveyname VARCHAR(80), place INTEGER NOT NULL, adminlevel INTEGER NOT NULL, PRIMARY KEY (id))");
        dbquery("CREATE TABLE IF NOT EXISTS " . $prefix . "surveyvotes ( id INTEGER NOT NULL auto_increment, surveyid INTEGER NOT NULL, vote INTEGER NOT NULL, voterid INTEGER NOT NULL, PRIMARY KEY (id))");
    }
    if (isset($_POST['surveysubmit'])) {
        if ($_POST['surveysubmit'] == "New Survey" && $_POST['surveyname'] != "") {
            if (!is_intval($_POST['adminlevel'])) {
                die($langmessage[98]);
            }
            dbquery("INSERT INTO " . $prefix . "surveynames ( id, surveyid, surveyname, place, adminlevel) VALUES ( null, 0, \"" . encode(sanitize($_POST['surveyname'])) . "\", 0, " . $_POST['adminlevel'] . ")");
        }
        if ($_POST['surveysubmit'] == "Delete Survey" && $_POST['surveyid'] != "") {
            if (!is_intval($_POST['surveyid'])) {
                die($langmessage[98]);
            }
            dbquery("DELETE FROM " . $prefix . "surveynames WHERE (id=" . $_POST['surveyid'] . " AND surveyid=0) OR surveyid=" . $_POST['surveyid']);
            dbquery("DELETE FROM " . $prefix . "surveyvotes WHERE surveyid=" . $_POST['surveyid']);
        }
        if ($_POST['surveysubmit'] == "Add Option" && $_POST['option'] != "") {
            if (!is_intval($_POST['surveyid']) || !is_intval($_POST['place'])) {
                die($langmessage[98]);
            }
            dbquery("INSERT INTO " . $prefix . "surveynames ( id, surveyid, surveyname, place, adminlevel) VALUES ( null, " . $_POST['surveyid'] . ", \"" . encode(sanitize($_POST['option'])) . "\", " . $_POST['place'] . ", 0)");
        }
    }
    $out .= "<h2>{$surveymessage['15']}</h2>\n<hr />\n";
    $out .= "<h3>{$surveymessage['1']}</h3>\n";
    $out .= "<form name=\"form1\" method=\"POST\" action=\"\">\n";
    $out .= "<table>\n<tr><td>{$surveymessage['2']}:&nbsp;</td><td><input type=\"text\" name=\"surveyname\" value=\"\" size=\"50\" /></td></tr>\n";
    $out .= "<tr><td>{$surveymessage['3']}:&nbsp;</td><td><SELECT name=\"adminlevel\">\n";
    $out .= "<option value=\"0\">{$langmessage['161']}</option>\n";
    $out .= "<option value=\"2\">{$langmessage['162']}</option>\n";
    $out .= "<option value=\"3\">{$langmessage['29']}</option>\n";
    $out .= "<option value=\"4\">{$langmessage['163']}</option>\n";
    $out .= "</SELECT></td></tr>\n";
    $out .= "<tr><td><input type=\"hidden\" name=\"surveysubmit\" value=\"New Survey\" /></td>";
    $out .= "<td><input type=\"submit\" value=\"{$surveymessage['1']}\" name=\"aaa\" /></td></tr>\n";
    $out .= "</table>\n</form>\n";
    $out .= "<hr /><h3>{$surveymessage['5']}</h3>\n";
    $out .= "<form name=\"form2\" method=\"POST\" action=\"\">\n";
    $out .= "<table>\n";
    $out .= "<tr><td>{$surveymessage['5']}:&nbsp;</td><td><SELECT name=\"surveyid\">\n";
    $output = dbquery("SELECT * FROM " . $prefix . "surveynames WHERE surveyid=0");
    $row = fetch_all($output);
    $i = 0;
    while ($row[$i]['surveyname']) {
        $out .= "<option value=\"" . $row[$i]['id'] . "\">" . decode($row[$i]['surveyname']) . "</option>\n";
        $i++;
    }
    $out .= "</SELECT></td></tr>\n";
    $out .= "<tr><td><input type=\"hidden\" name=\"surveysubmit\" value=\"Delete Survey\" /></td>";
    $out .= "<td><input type=\"submit\" value=\"{$surveymessage['5']}\" name=\"aaa\" /></td></tr>\n";
    $out .= "</table>\n</form>\n";
    $out .= "<hr /><h3>{$surveymessage['6']}</h3>\n";
    $out .= "<form name=\"form1\" method=\"POST\" action=\"\">\n";
    $out .= "<table>\n";
    $out .= "<tr><td>{$surveymessage['2']}:&nbsp;</td><td><SELECT name=\"surveyid\">\n";
    $row = fetch_all(dbquery("SELECT * FROM " . $prefix . "surveynames WHERE surveyid=0"));
    $i = 0;
    while ($row[$i]['surveyname']) {
        $out .= "<option value=\"" . $row[$i]['id'] . "\">" . decode($row[$i]['surveyname']) . "</option>\n";
        $i++;
    }
    $out .= "</SELECT></td></tr>\n";
    $out .= "<tr><td>{$surveymessage['7']}:&nbsp;</td><td><input type=\"text\" name=\"place\" size=\"2\" value=\"\" /></td></tr>\n";
    $out .= "<tr><td>{$surveymessage['8']}:&nbsp;</td><td><input type=\"text\" name=\"option\" size=\"50\" value=\"\" /></td></tr>\n";
    $out .= "<tr><td><input type=\"hidden\" name=\"surveysubmit\" value=\"Add Option\" /></td>";
    $out .= "<td><input type=\"submit\" name=\"aaa\" value=\"{$surveymessage['9']}\" /></td></tr>\n";
    $out .= "</table>\n</form>\n";
    $out .= "<hr /><h3>{$surveymessage['4']}</h3>\n<ul>";
    $i = 0;
    while ($row[$i]['id']) {
        $out .= "<li>" . $row[$i]['id'] . " - " . decode($row[$i]['surveyname']) . "</li>\n";
        $row1 = fetch_all(dbquery("SELECT * FROM " . $prefix . "surveynames WHERE surveyid=" . $row[$i]['id']));
        $j = 0;
        $out .= "<ul>";
        while ($row1[$j]['id']) {
            $out .= "<li>" . $row1[$j]['surveyname'] . "</li>\n";
            $j++;
        }
        $out .= "</ul>\n";
        $i++;
    }
    $out .= "</ul>\n";
//.........这里部分代码省略.........
开发者ID:squidjam,项目名称:LightNEasy,代码行数:101,代码来源:admin.php


示例17: fetch_record

// get the first record.
// it will be assumed that the table will have an inital record which will contain the main site
// only get the records that are tag for drilling : drill = 'Y'.
// this will only loop(drill) 3times (or 3levels) just to be sure
// anything after the 3rd level will be ignored
// get the details of the site to determine how many levels to drill
$query = "SELECT * FROM sites WHERE drill = 'Y' AND status = 'Pending'";
$results = fetch_record($query);
// loop through the list
for ($list_loop = 0; $list_loop <= count($results); $list_loop++) {
    // set runtime to only 10 minutes
    set_time_limit(600);
    for ($loopCounter = 0; $loopCounter <= $results['level']; $loopCounter++) {
        // get the first link
        $query = "SELECT * FROM scrapper WHERE main_site_id =" . $results['site_id'] . " AND drill = 'Y' AND drillStatus = 'Not Started'";
        $query_results = fetch_all($query);
        if (count($query_results) == 0) {
            // update the site record
            $query = "UPDATE sites SET drill='N', status='Completed' WHERE main_site_id =" . $results['site_id'];
            run_mysql_query($query);
            $loopCounter = $results['level'];
        } else {
            foreach ($query_results as $listing) {
                grabAnchors($listing, $results['site_address']);
            }
        }
    }
    // update the site record
    $query = "UPDATE sites SET drill='N', status='Completed' WHERE main_site_id =" . $results['site_id'];
    run_mysql_query($query);
}
开发者ID:eddiebanz,项目名称:tourism,代码行数:31,代码来源:gapangin.php


示例18: gpc

        } else {
            DB::insert('gongqiu_member', gpc('member_'));
            showmessage($_lang['edit_ok']);
        }
    }
} elseif ($op == 'mycredit') {
    if (empty($gongqiu_config['extcredits'])) {
        showmessage($_lang['no_extcredits']);
    } else {
        $credit = DB::result_first("SELECT extcredits{$gongqiu_config['extcredits']} FROM " . DB::table('common_member_count') . " WHERE uid='{$_G['uid']}'");
        $credit_log = fetch_all('gongqiu_up', " as su LEFT JOIN " . DB::table('gongqiu_goods') . " as sg ON su.goods_id = sg.goods_id WHERE sg.member_uid='{$_G['uid']}'");
    }
} elseif ($op == 'quiteup') {
    $goods_id = intval($_GET['goods_id']);
    DB::update('gongqiu_goods', array('goods_up' => ''), " goods_id='{$goods_id}'");
    showmessage($_lang['edit_ok'], $gongqiu_config['root'] . "?mod=member&op=mypost");
} elseif ($op == 'setpostup') {
    $goods_id = intval($_GET['goods_id']);
    $goods = fetch_all('gongqiu_goods', " WHERE goods_id='{$goods_id}'", " goods_title,goods_id,member_uid ");
    $goods = $goods[0];
    include template("gongqiu:{$style}/setpostup");
    exit;
} elseif ($op == 'jubao') {
    $goods_id = intval($_GET['goods_id']);
    $goods = fetch_all('gongqiu_goods', " WHERE goods_id='{$goods_id}'", " goods_title,goods_id,member_uid ");
    $goods = $goods[0];
    include template("gongqiu:{$style}/jubao");
    exit;
}
$navtitle = $_lang['member'] . " - " . $gongqiu_config['name'];
include template("gongqiu:{$style}/member");
开发者ID:edmundwong,项目名称:V604,代码行数:31,代码来源:member.inc.php


示例19: addslashes

$op = !empty($_GET['op']) ? addslashes($_GET['op']) : 'post';
$uid = $_G['uid'];
$goods = fetch_all('gongqiu_goods', " WHERE goods_id='{$goods_id}'");
$goods = $goods[0];
$goods['goods_text'] = stripslashes($goods['goods_text']);
$cat = fetch_all("gongqiu_cat", " WHERE cat_status='1' ORDER BY cat_sort DESC ");
if ($op == 'edit') {
    if ($goods['member_uid'] != $_G['uid'] && !is_gongqiu_admin()) {
        showmessage($_lang['no_quanxian']);
    } else {
        $uid = $goods['member_uid'];
    }
}
$member = fetch_all('gongqiu_member', " WHERE member_uid='{$uid}'");
$member = $member[0];
$my_credit = fetch_all("common_member_count", " WHERE uid='{$uid}'", " extcredits{$gongqiu_config['extcredits']} ", "0");
$my_credit = $my_credit["extcredits{$gongqiu_config['extcredits']}"];
if (submitcheck('post_submit') || submitcheck('edit_submit')) {
    if (empty($_GET['province']) && $op == 'post') {
        showmessage($_lang['must_province']);
    }
    if (empty($_GET['goods_text'])) {
        showmessage($_lang['must_goods_text']);
    }
    if (empty($_GET['member_username'])) {
        showmessage($_lang['must_member_username']);
    }
    if (empty($_GET['member_phone'])) {
        showmessage($_lang['must_member_phone']);
    }
    /* begin:发布积分消费	*/
开发者ID:edmundwong,项目名称:V604,代码行数:31,代码来源:post.inc.php


示例20: array

$errors = array();
$_SESSION['errors'] = $errors;
$_SESSION['user_id'] = 0;
if (isset($_POST['action']) && $_POST['action'] == 'register') {
    if (empty($_POST['first_name']) || !ctype_alpha($_POST['first_name'])) {
        $errors[] = "first name must contain only letters and no spaces";
    }
    if (empty($_POST['last_name']) || !ctype_alpha($_POST['last_name'])) {
        $errors[] = "last name must contain only letters and no spaces";
    }
    if (empty($_POST['email']) || !filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
        $errors[] = "please enter a valid email address ([email protected])";
    } else {
        $email = escape_this_string($_POST['email']);
        $query = "SELECT email\n\t\t\t\tFROM users\n\t\t\t\tWHERE email = '{$email}'";
        if (!empty(fetch_all($query))) {
            $errors[] = "username is already taken, please select a new username";
        }
    }
    if (empty($_POST['password']) || strlen($_POST['password']) < 6) {
        $errors[] = "password must be greater than 6 characters";
    }
    if ($_POST['password_conf'] != $_POST['password']) {
        $errors[] = "password confirmation does not match";
    }
    if (count($errors) > 0) {
        $_SESSION['errors'] = $errors;
        header('location: index.php');
        die;
    } else {
        $_SESSION['errors'] = $errors;
开发者ID:kjwill2499,项目名称:CodingDojo,代码行数:31,代码来源:loginProcess.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP fetch_array函数代码示例发布时间:2022-05-15
下一篇:
PHP fetchWordTemplateList函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap