本文整理汇总了PHP中mysqli_stmt_num_rows函数的典型用法代码示例。如果您正苦于以下问题:PHP mysqli_stmt_num_rows函数的具体用法?PHP mysqli_stmt_num_rows怎么用?PHP mysqli_stmt_num_rows使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mysqli_stmt_num_rows函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: authenticate_user
function authenticate_user($data)
{
global $db;
$email = $data['email'];
$password = $data['password'];
//getting the salt
$stmt = mysqli_prepare($db, "SELECT salt FROM users WHERE email = ? LIMIT 1");
mysqli_stmt_bind_param($stmt, "s", $email);
mysqli_stmt_execute($stmt);
mysqli_stmt_store_result($stmt);
mysqli_stmt_bind_result($stmt, $salt);
if (mysqli_stmt_num_rows($stmt)) {
mysqli_stmt_fetch($stmt);
$password = hash('sha256', "{$password}" . "{$salt}");
//adding salt to given pass hashing and checking if the resulting hash is the same as the original
mysqli_stmt_close($stmt);
$stmt = mysqli_prepare($db, "SELECT uid, username, email FROM users WHERE email = ? AND password = ?");
mysqli_stmt_bind_param($stmt, "ss", $email, $password);
mysqli_stmt_execute($stmt);
mysqli_stmt_store_result($stmt);
mysqli_stmt_bind_result($stmt, $uid, $username, $email);
if (mysqli_stmt_num_rows($stmt)) {
mysqli_stmt_fetch($stmt);
mysqli_stmt_close($stmt);
$user = ['userid' => $uid, 'username' => $username, 'email' => $email];
return $user;
} else {
return false;
}
} else {
return false;
}
}
开发者ID:AlexandrosKal,项目名称:mylib,代码行数:33,代码来源:user_functions.php
示例2: checkrows
function checkrows()
{
include "components/db_connect.php";
$username = $_POST['email'];
$x = "select * from details where email='{$username}'";
$result = mysqli_prepare($con, $x);
mysqli_stmt_execute($result);
mysqli_stmt_store_result($result);
$y = mysqli_stmt_num_rows($result);
include "components/db_disconnect.php";
return $y;
}
开发者ID:ncs-jss,项目名称:newMCQ-,代码行数:12,代码来源:register.php
示例3: printf
if (mysqli_stmt_prepare($stmt, 'SELECT unknown_column FROM this_table_does_not_exist') || mysqli_stmt_execute($stmt)) {
printf("[041] The invalid SELECT statement is issued on purpose\n");
}
if (-1 !== ($tmp = mysqli_stmt_affected_rows($stmt))) {
printf("[042] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp);
}
if ($IS_MYSQLND) {
if (false !== ($tmp = mysqli_stmt_store_result($stmt))) {
printf("[043] Expecting boolean/false, got %s\\%s\n", gettype($tmp), $tmp);
}
} else {
if (true !== ($tmp = mysqli_stmt_store_result($stmt))) {
printf("[043] Libmysql does not care if the previous statement was bogus, expecting boolean/true, got %s\\%s\n", gettype($tmp), $tmp);
}
}
if (0 !== ($tmp = mysqli_stmt_num_rows($stmt))) {
printf("[044] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
}
if (-1 !== ($tmp = mysqli_stmt_affected_rows($stmt))) {
printf("[045] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp);
}
mysqli_stmt_close($stmt);
$stmt = mysqli_stmt_init($link);
if (!mysqli_stmt_prepare($stmt, "DROP TABLE IF EXISTS test_mysqli_stmt_affected_rows_table_1") || !mysqli_stmt_execute($stmt)) {
printf("[046] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
}
mysqli_stmt_close($stmt);
if (!is_null($tmp = mysqli_stmt_affected_rows($stmt))) {
printf("[047] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
}
mysqli_close($link);
开发者ID:alphaxxl,项目名称:hhvm,代码行数:31,代码来源:mysqli_stmt_affected_rows.php
示例4: login
function login()
{
include_once 'database_conn.php';
// check is form filled
if (isFormFilled()) {
// if not filled, stop
return;
}
$uid = sanitizeData($_POST['username']);
$pswd = sanitizeData($_POST['password']);
$columnLengthSql = "\n\t\t\tSELECT COLUMN_NAME, CHARACTER_MAXIMUM_LENGTH\n\t\t\tFROM INFORMATION_SCHEMA.COLUMNS\n\t\t\tWHERE TABLE_NAME = 'te_users'\n\t\t\tAND (column_name = 'username'\n\t\t\tOR column_name = 'passwd')";
$COLUMN_LENGTH = getColumnLength($conn, $columnLengthSql);
$isError = false;
$errMsg[] = validateStringLength($uid, $COLUMN_LENGTH['username']);
//uid
$errMsg[] = validateStringLength($pswd, $COLUMN_LENGTH['passwd']);
//pswd
for ($i = 0; $i < count($errMsg); $i++) {
if (!($errMsg[$i] === true)) {
echo "{$errMsg[$i]}";
$isError = true;
}
}
//if contain error, halt continue executing the code
if ($isError) {
return;
}
// check is uid exist
$checkUIDSql = "SELECT passwd, salt FROM te_users WHERE username = ?";
$stmt = mysqli_prepare($conn, $checkUIDSql);
mysqli_stmt_bind_param($stmt, "s", $uid);
mysqli_stmt_execute($stmt);
mysqli_stmt_store_result($stmt);
if (mysqli_stmt_num_rows($stmt) <= 0) {
echo "Sorry we don't seem to have that username.";
return;
}
mysqli_stmt_bind_result($stmt, $getHashpswd, $getSalt);
while (mysqli_stmt_fetch($stmt)) {
$hashPswd = $getHashpswd;
$salt = $getSalt;
}
// if exist, then get salt and db hashed password
// create hash based on password
// hash pswd using sha256 algorithm
// concat salt in db by uid
// hash using sha256 algorithm
$pswd = hash("sha256", $salt . hash("sha256", $pswd));
// check does it match with hased password from db
if (strcmp($pswd, $hashPswd) === 0) {
echo "Success login<br/>";
// add session
$_SESSION['logged-in'] = $uid;
// go to url
$url = $_SERVER['REQUEST_URI'];
header("Location: {$url}");
} else {
echo "Fail login<br/>";
}
}
开发者ID:lowjiayou,项目名称:YearTwoWebOne,代码行数:60,代码来源:login.php
示例5: evalLoggedUser
function evalLoggedUser($con, $id, $u, $p)
{
$sql = "SELECT lastlogin FROM users WHERE id=? AND name=? AND pass=? LIMIT 1";
if ($stmt = mysqli_prepare($con, $sql)) {
mysqli_stmt_bind_param($stmt, "iss", $id, $u, $p);
mysqli_stmt_execute($stmt);
// $query = mysqli_query($conx, $sql);
$numrows = mysqli_stmt_num_rows($stmt);
if ($numrows > 0) {
return true;
}
}
}
开发者ID:funklegeorge,项目名称:bathtubbingo,代码行数:13,代码来源:checkLogin.php
示例6: verificaMesGrafico
function verificaMesGrafico($string)
{
include "conf-conexao.php";
include "script-time.php";
// selecione o total de meses quando ano for igua a anoCorrente
$consultaSqlVerificaMes = "SELECT MES FROM tab_dados_grafico WHERE MES LIKE '%{$string}%' AND ANO = {$anoCorrente}";
$stmt = mysqli_prepare($conexao, $consultaSqlVerificaMes);
if ($stmt) {
mysqli_stmt_execute($stmt);
mysqli_stmt_store_result($stmt);
echo mysqli_stmt_num_rows($stmt);
}
}
开发者ID:thalysssonNascimento,项目名称:grafico-chart,代码行数:13,代码来源:verificaMesGrafico.php
示例7: obtenerCantidadPorDNI
function obtenerCantidadPorDNI($dni)
{
$conect = conectar();
$sql = "SELECT COUNT(prod.id) as cantidad\n FROM persona as per\n INNER JOIN producto as prod ON (prod.persona_id = per.id)\n WHERE per.dni = ?\n GROUP BY per.dni";
$stmt = $conect->prepare($sql);
$stmt->bind_param('i', $dni);
$stmt->execute();
$stmt->bind_result($cantidad);
$stmt->store_result();
if (mysqli_stmt_num_rows($stmt) > 0) {
$row = mysqli_stmt_fetch($stmt);
$result = array('estado' => true, 'cantidad' => $cantidad);
} else {
$result = array('estado' => false);
}
return $result;
}
开发者ID:tatu-carreta,项目名称:colgate,代码行数:17,代码来源:funcionesRegistro.php
示例8: getAllActivitiesByUser
function getAllActivitiesByUser($params)
{
$connection = dbConnect();
$options = ['columns' => 'a.id, ud.nome as demandante, s.sigla,
sa.status, a.titulo, a.data, a.tempo_gasto, a.id_status', 'join' => [['type' => 'INNER JOIN', 'table' => 'setores s', 'columns' => 's.id = a.id_setor'], ['type' => 'INNER JOIN', 'table' => 'status_atividade sa', 'columns' => 'sa.id = a.id_status'], ['type' => 'INNER JOIN', 'table' => 'usuarios ud', 'columns' => 'ud.id = a.id_demandante']], 'where' => ['a.id_responsavel' => $_SESSION['id']], 'order_by' => 'a.data DESC', 'limit' => $params['limit'] . ', ' . $params['offset']];
$sql = buildSelect('atividades a', $options);
$stmt = mysqli_prepare($connection, $sql);
mysqli_stmt_bind_param($stmt, 'i', $_SESSION['id']);
mysqli_stmt_execute($stmt);
mysqli_stmt_store_result($stmt);
mysqli_stmt_bind_result($stmt, $id, $demandante, $sigla, $status, $titulo, $data, $tempo_gasto, $id_status);
$result = [];
while (mysqli_stmt_fetch($stmt)) {
array_push($result, ["id" => $id, "demandante" => $demandante, "sigla" => $sigla, "status" => $status, "titulo" => $titulo, "data" => $data, "tempo_gasto" => $tempo_gasto, "id_status" => $id_status]);
}
$numRows = mysqli_stmt_num_rows($stmt);
mysqli_stmt_close($stmt);
dbClose($connection);
return ['result' => $result, 'numRows' => $numRows];
}
开发者ID:Calcio,项目名称:CursoPHPBasico,代码行数:20,代码来源:queries.php
示例9: func_test_mysqli_stmt_num_rows
function func_test_mysqli_stmt_num_rows($stmt, $query, $expected, $offset)
{
if (!mysqli_stmt_prepare($stmt, $query)) {
printf("[%03d] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
return false;
}
if (!mysqli_stmt_execute($stmt)) {
printf("[%03d] [%d] %s\n", $offset + 1, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
return false;
}
if (!mysqli_stmt_store_result($stmt)) {
printf("[%03d] [%d] %s\n", $offset + 2, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
return false;
}
if ($expected !== ($tmp = mysqli_stmt_num_rows($stmt))) {
printf("[%03d] Expecting %s/%d, got %s/%d\n", $offset + 3, gettype($expected), $expected, gettype($tmp), $tmp);
}
mysqli_stmt_free_result($stmt);
return true;
}
开发者ID:gleamingthecube,项目名称:php,代码行数:20,代码来源:ext_mysqli_tests_mysqli_stmt_num_rows.php
示例10: getDocID
function getDocID($url)
{
$con = $GLOBALS["con"];
$sql = "SELECT docID FROM documents WHERE URL=?";
$stmt = mysqli_prepare($con, $sql) or die(mysqli_error($con));
mysqli_stmt_bind_param($stmt, 's', $url) or die(mysqli_stmt_error($stmt));
mysqli_stmt_execute($stmt) or die(mysqli_stmt_error($stmt));
mysqli_stmt_store_result($stmt);
if (mysqli_stmt_num_rows($stmt) < 1) {
mysqli_stmt_close($stmt);
$sql = "INSERT INTO documents (URL) VALUES (?)";
$stmt = mysqli_prepare($con, $sql) or die(mysqli_error($con));
mysqli_stmt_bind_param($stmt, 's', $url) or die(mysqli_stmt_error($stmt));
mysqli_stmt_execute($stmt) or die(mysqli_stmt_error($stmt));
mysqli_stmt_bind_result($stmt, $docID);
mysqli_stmt_fetch($stmt);
return getDocID($url);
} else {
mysqli_stmt_bind_result($stmt, $docID);
mysqli_stmt_fetch($stmt);
return $docID;
}
}
开发者ID:jreinstra,项目名称:dragonfly-main,代码行数:23,代码来源:download.php
示例11: get_key
function get_key($dbh, $config, $key)
{
$data = array();
$result = 0;
$stmt = mysqli_prepare($dbh, "SELECT name,try_interval,last_try FROM " . $config['table_prefix'] . "keys WHERE `key` = ? LIMIT 0,1");
mysqli_stmt_bind_param($stmt, "s", $key);
mysqli_stmt_execute($stmt);
mysqli_stmt_store_result($stmt);
$result = mysqli_stmt_num_rows($stmt);
mysqli_stmt_bind_result($stmt, $name, $try_interval, $last_try);
while (mysqli_stmt_fetch($stmt)) {
$data['name'] = $name;
$data['try_interval'] = $try_interval;
$data['last_try'] = $last_try;
}
mysqli_stmt_close($stmt);
unset($stmt);
if ($result) {
return $data;
} else {
return 0;
}
}
开发者ID:basvdburg,项目名称:php-notify-telegram,代码行数:23,代码来源:functions.php
示例12: session_set_cookie_params
//var_dump($_POST);
$lifetime = 86400;
session_set_cookie_params($lifetime, $httponly = true);
if ($link->connect_error) {
die("Connection failed: " . $link->connect_error);
}
//&& $username != $_SESSION['username']
if (!isset($_SESSION['username'])) {
//echo "2";
$username = $_POST['username'];
$password = md5($_POST['password']);
$query = mysqli_prepare($link, "SELECT username, password FROM member WHERE username = ? ");
mysqli_stmt_bind_param($query, 's', $username);
mysqli_stmt_execute($query);
mysqli_stmt_store_result($query);
$rows = mysqli_stmt_num_rows($query);
mysqli_stmt_bind_result($query, $user, $pass);
mysqli_stmt_fetch($query);
if ($rows == 1) {
if ($password == $pass) {
$_SESSION['username'] = $username;
} else {
//password is just wrong or something went wrong with the hashing
echo "wrong hash or pass";
header("location:index.php?invalidcredA");
exit;
}
} else {
//wrong username or multiple entries
header("location:index.php?invalidcredB");
exit;
开发者ID:RayM4,项目名称:DB-Project,代码行数:31,代码来源:homepage.php
示例13: logSubject
function logSubject($title)
{
$con = $GLOBALS["con"];
$sql = "SELECT subjectID FROM subjects WHERE Name=?";
//$title
$stmt = mysqli_prepare($con, $sql) or die(mysqli_error($con));
mysqli_stmt_bind_param($stmt, 's', $title) or die(mysqli_stmt_error($stmt));
mysqli_stmt_execute($stmt) or die(mysqli_stmt_error($stmt));
mysqli_stmt_store_result($stmt);
$rows = mysqli_stmt_num_rows($stmt);
mysqli_stmt_close($stmt);
if ($rows < 1) {
$sql = "INSERT INTO subjects (Name) VALUES (?)";
//$title
$stmt = mysqli_prepare($con, $sql) or die(mysqli_error($con));
mysqli_stmt_bind_param($stmt, 's', $title) or die(mysqli_stmt_error($stmt));
mysqli_stmt_execute($stmt) or die(mysqli_stmt_error($stmt));
mysqli_stmt_close($stmt);
}
}
开发者ID:jreinstra,项目名称:dragonfly-main,代码行数:20,代码来源:parse.php
示例14: mysqli_connect
$pass = "t3st3r123";
$db = "test";
$connection = mysqli_connect($host, $user, $pass, $db) or die("ei saa ühendust mootoriga");
mysqli_query($connection, "SET CHARACTER SET UTF8") or die("Ei saanud baasi utf-8-sse - " . mysqli_error($connection));
// php and mysql datetime compatibility http://stackoverflow.com/questions/2215354/php-date-format-when-inserting-into-datetime-in-mysql
$visitTime = date("Y-m-d H:i:s");
$visitorAddress = $_SERVER['REMOTE_ADDR'];
// Insert visitors IP ind current time to DB
$insertVisitQuery = "INSERT INTO rturi_stats (ip, time) VALUES ('" . $visitorAddress . "', '" . $visitTime . "');";
mysqli_query($connection, $insertVisitQuery) or die("Ei saanud kirjet lisatud - " . mysqli_error($connection));
// query how many visits there have been from users IP
$selectNumberOfVisitsQuery = "SELECT * FROM rturi_stats WHERE ip = '" . $visitorAddress . "';";
//row count code copied from http://php.net/manual/en/mysqli-stmt.num-rows.php
if ($stmt = mysqli_prepare($connection, $selectNumberOfVisitsQuery)) {
/* execute query */
mysqli_stmt_execute($stmt);
/* store result */
mysqli_stmt_store_result($stmt);
$numberOfVisits = mysqli_stmt_num_rows($stmt);
/* close statement */
mysqli_stmt_close($stmt);
}
// get the earliest visit datetime from DB
// some help from mysqli tutorial http://codular.com/php-mysqli
$selectEarliestVisitQuery = "SELECT MIN(time) FROM rturi_stats WHERE ip ='88.196.181.145';";
$earliestVisitQueryResult = mysqli_query($connection, $selectEarliestVisitQuery) or die("Kõige varasema külstuse aja päring ebaõnnestus - " . mysqli_error($connection));
$resultRow = $earliestVisitQueryResult->fetch_assoc();
$earliestVisit = $resultRow['MIN(time)'];
echo "Sinu IP aadress on " . $_SERVER['REMOTE_ADDR'] . "<br><br>";
echo "See on sinu " . $numberOfVisits . ". külastus sellel lehel. Esimene külastus oli " . $earliestVisit;
mysqli_close($connection);
开发者ID:rturi,项目名称:I244,代码行数:31,代码来源:userStats.php
示例15: printf
if (($tmp = count($fields_res_meta)) !== $num_fields) {
printf("[015] Expecting int/%d got %s/%s\n", $num_fields, gettype($tmp), $tmp);
}
if ($fields_res_meta != $fields) {
printf("[016] Prepared Statement metadata differs from normal metadata, dumping\n");
var_dump($fields_res_meta);
var_dump($fields);
}
if (function_exists('mysqli_stmt_get_result') && $stmt->prepare('EXPLAIN SELECT t1.*, t2.* FROM test AS t1, test AS t2') && $stmt->execute()) {
if (!($res_stmt = mysqli_stmt_get_result($stmt))) {
printf("[017] Cannot fetch result from PS [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
}
if (($tmp = mysqli_num_rows($res_stmt)) !== $num_rows) {
printf("[018] Expecting int/%d got %s/%s\n", $num_rows, gettype($tmp), $tmp);
}
if (mysqli_stmt_num_rows($stmt) !== 0) {
printf("[019] Expecting int/0 got %s/%s\n", gettype($tmp), $tmp);
}
if (($tmp = mysqli_stmt_field_count($stmt)) !== $num_fields) {
printf("[020] Expecting int/%d got %s/%s\n", $num_fields, gettype($tmp), $tmp);
}
if (($tmp = $res_stmt->field_count) !== $num_fields) {
printf("[021] Expecting int/%d got %s/%s\n", $num_fields, gettype($tmp), $tmp);
}
$fields_stmt = mysqli_fetch_fields($res_stmt);
if (($tmp = count($fields_stmt)) !== $num_fields) {
printf("[022] Expecting int/%d got %s/%s\n", $num_fields, gettype($tmp), $tmp);
}
reset($fields);
foreach ($fields_stmt as $fields_stmt_val) {
list(, $fields_val) = each($fields);
开发者ID:gleamingthecube,项目名称:php,代码行数:31,代码来源:ext_mysqli_tests_mysqli_explain_metadata.php
示例16: mysqli_stmt_bind_param
}
?>
<br><br><h1 class='blue'>Competitive Analysis</h1><br>
<?php
/* run prepared queries to see if any data is already present in intellectual_property table */
/* create a prepared statement */
if ($stmt = mysqli_prepare($link, "SELECT * FROM competitive_analysis WHERE id=?")) {
/* bind variables to marker */
mysqli_stmt_bind_param($stmt, 's', $_SESSION['id']);
/* execute query */
mysqli_stmt_execute($stmt);
/* store result */
mysqli_stmt_store_result($stmt);
printf("%d results<br>", mysqli_stmt_num_rows($stmt));
/* bind result variables */
mysqli_stmt_bind_result($stmt, $id, $entry, $behavior, $advantage);
/* print table headers */
echo "<table><thead><tr><th></th><th>Current Behavior</th><th>Our Competitive Advantage</tr></thead>";
while (mysqli_stmt_fetch($stmt)) {
/* print output */
?>
<form action="marketUpdate.php" method="POST">
<input type="hidden" name="table" value="competitiveAnalysis">
<input type="hidden" name="id" value="<?php
echo $id;
?>
">
<input type="hidden" name="entry" value="<?php
echo $entry;
开发者ID:clmpgd,项目名称:business_plan_app,代码行数:31,代码来源:market.php
示例17: mysqli_stmt_close
mysqli_stmt_close($stmt);
}
$sqlsongs = "SELECT title,artist,weight FROM songs WHERE pkg=1";
$sql = "SELECT pid FROM buypackages WHERE uid=?";
$pkglist = "";
if ($stmt = mysqli_prepare($con, $sql)) {
mysqli_stmt_bind_param($stmt, "s", $uid);
mysqli_stmt_execute($stmt);
if (mysqli_stmt_error($stmt)) {
echo 'SQL Error: ' . mysqli_stmt_error($stmt);
}
mysqli_stmt_bind_result($stmt, $pid);
while (mysqli_stmt_fetch($stmt)) {
$sqlsongs = $sqlsongs . " OR pkg=" . $pid;
}
$n = mysqli_stmt_num_rows($stmt);
mysqli_stmt_close($stmt);
}
if ($sb == "sbn") {
$sqlsongs = $sqlsongs . " ORDER BY title";
} else {
if ($sb == "sbp") {
$sqlsongs = $sqlsongs . " ORDER BY weight";
}
}
//echo "<select id=\"songpick\">";
//echo $sqlsongs;
echo "<form>";
if ($stmt = mysqli_prepare($con, $sqlsongs)) {
mysqli_stmt_execute($stmt);
if (mysqli_stmt_error($stmt)) {
开发者ID:funklegeorge,项目名称:bathtubbingo,代码行数:31,代码来源:userSongList.php
示例18: isWaiting
function isWaiting($conn, $UserId, $BlockId)
{
$stmt = mysqli_prepare($conn, "select * from WaitingList where WUserid = ? and Blockid = ?");
mysqli_stmt_bind_param($stmt, "ii", $UserId, $BlockId);
mysqli_stmt_execute($stmt);
mysqli_stmt_store_result($stmt);
$num = mysqli_stmt_num_rows($stmt);
mysqli_stmt_free_result($stmt);
mysqli_stmt_close($stmt);
if ($num > 0) {
return true;
}
return false;
}
开发者ID:zehe,项目名称:nextDoor,代码行数:14,代码来源:DataRetrieval.php
示例19: mysqli
include "header.php";
?>
<?php
$conn = new mysqli("localhost", "my_user", "my*password", "mgabriel");
if (mysqli_connect_errno()) {
echo 'Cannot connect to database: ' . mysqli_connect_error($conn);
} else {
$query = mysqli_prepare($conn, "SELECT profileinfo.firstname, profileinfo.lastname, profileinfo.email, profileinfo.day, profileinfo.time FROM profileinfo inner join services_provided ON services_provided.id=profileinfo.id WHERE services_provided.service_id = ?;") or die("Error: " . mysqli_error($conn));
// bind parameters "s" - string
mysqli_stmt_bind_param($query, "i", $_POST['service_description']);
//run the query mysqli_stmt_execute returns true if the
//query was successful
mysqli_stmt_execute($query) or die("Error. Could not insert into the table." . mysqli_error($conn));
mysqli_stmt_store_result($query);
if (mysqli_stmt_num_rows($query) == 0) {
echo "No entries found";
} else {
// bind variables to prepared statement
mysqli_stmt_bind_result($query, $firstname, $lastname, $email, $day, $time);
// fetch values
$dataArr = [];
while (mysqli_stmt_fetch($query)) {
$dataArr[] = $firstname . ' ' . $lastname . ' ' . $email . ' ' . $day . ' ' . $time;
}
foreach ($dataArr as $profileinfo) {
echo $profileinfo . '<br/>';
}
}
mysqli_stmt_close($query);
//for prepared stmts only
开发者ID:nelsonomuto,项目名称:lamp,代码行数:31,代码来源:results.php
示例20: mysqli_stmt_execute
// print '<li>Possible :'.' '. $tetradinfo['Possible'].'</li>';
// print '<li>Probable :'.' '. $tetradinfo['Probable'].'</li>';
// print '<li>Confirmed :'. ' '.$tetradinfo['Confirmed'].'</li></ul>';
if ($table === "bredstat_1989") {
$query = "SELECT Tetrad FROM {$table} WHERE {$tetradid} > 1";
} else {
$query = "SELECT Tetrad FROM {$table} WHERE {$tetradid} >= 1";
}
// $query = "SELECT Tetrad FROM $table WHERE $tetradid >= 1";
if ($stmt = mysqli_prepare($link, $query)) {
/* execute query */
mysqli_stmt_execute($stmt);
/* store result */
mysqli_stmt_store_result($stmt);
print "<div class='myCount'>";
printf("Total Number of Species: %d\n", mysqli_stmt_num_rows($stmt));
printf("<span class='caret'></span>");
print "</div>";
/* close statement */
mysqli_stmt_close($stmt);
}
if ($table === "bredstat_1989") {
$stmt = "SELECT Tetrad FROM {$table} WHERE {$tetradid} > 1 ORDER BY Tetrad ASC";
} else {
$stmt = "SELECT Tetrad FROM {$table} WHERE {$tetradid} >= 1 ORDER BY Tetrad ASC";
}
// $stmt = "SELECT Tetrad FROM $table WHERE $tetradid >= 1 ORDER BY Tetrad ASC";
if ($res = mysqli_query($link, $stmt)) {
echo '<ol class="rich_species_List group" style="display: none;">';
/* fetch associative array */
while ($row = mysqli_fetch_assoc($res)) {
开发者ID:jayontraps,项目名称:boc,代码行数:31,代码来源:richness.tet.data.php
注:本文中的mysqli_stmt_num_rows函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论