本文整理汇总了PHP中Mysql::getQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP Mysql::getQuery方法的具体用法?PHP Mysql::getQuery怎么用?PHP Mysql::getQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mysql
的用法示例。
在下文中一共展示了Mysql::getQuery方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildPage
function buildPage()
{
global $mysql;
$MySQLConnection = new Mysql($mysql['host'], $mysql['port'], $mysql['user'], $mysql['password'], $mysql['database']);
$MySQLConnection->connect();
if ($result = $MySQLConnection->getQuery('SELECT x.matchID AS matchID, x.matchDate AS matchDate, y.teamName AS matchHomeTeam, y.teamLogo AS matchHomeTeamLogo, z.teamName AS matchForeignTeam, z.teamLogo AS matchForeignTeamLogo FROM matches AS x JOIN teams AS y ON y.teamID = matchHomeTeam JOIN teams AS z ON z.teamID = matchForeignTeam;')) {
while ($row = mysqli_fetch_assoc($result)) {
$userTips = getUserTips($MySQLConnection, $row["matchID"]);
echo '
<div class="panel panel-default">
<form id="match_' . $row["matchID"] . '" method="POST">
<div class="panel-body">
<div class="panel-heading">' . $row["matchHomeTeam"] . ' vs. ' . $row["matchForeignTeam"] . '</div>
<div class="input-group">
<label>' . $row["matchHomeTeam"] . '</label>
<input type="number"min="0"value="' . $userTips["tipScoreHome"] . '" name="ScoreHome" id="ScoreHome" required/>
</div>
<div class="input-group">
<label>' . $row["matchForeignTeam"] . '</label>
<input type="number"min="0" value="' . $userTips["tipScoreForeign"] . '" name="ScoreForeign" id="ScoreForeign" required/>
<input type="button" value="Place Tip" onclick="placeTip(' . $row["matchID"] . ');"/>
</div>
</div>
</form>
</div>
';
}
}
}
示例2: buildPage
function buildPage()
{
global $mysql;
$MySQLConnection = new Mysql($mysql['host'], $mysql['port'], $mysql['user'], $mysql['password'], $mysql['database']);
$MySQLConnection->connect();
if ($result = $MySQLConnection->getQuery('SELECT * FROM users JOIN countries ON userCountry = iso3166 WHERE userID = ' . $_GET["userID"] . ';')) {
while ($row = mysqli_fetch_assoc($result)) {
echo '
<div class="col-md-2">
<div class="panel panel-default">
<div class="panel-heading">' . $row["userLogin"] . '</div>
<div class="panel-body">
<div class="media">
<div class="media-left">
<a href="img/avatar/' . $row["userAvatar"] . '">
<img class="media-object" src="img/avatar/' . $row["userAvatar"] . '" />
</a>
</div>
</div>
<p><b>First Name: </b>' . $row["userFirstName"] . '</p>
<p><b>Last Name: </b>' . $row["userLastName"] . '</p>
</div>
</div>
</div>
';
}
}
}
示例3: buildPage
function buildPage()
{
global $mysql;
$MySQLConnection = new Mysql($mysql['host'], $mysql['port'], $mysql['user'], $mysql['password'], $mysql['database']);
$MySQLConnection->connect();
if ($result = $MySQLConnection->getQuery('SELECT messageID, messageRecipient, messageSender, messageTime, messageSubject, messageBody, userLogin, userID FROM messages JOIN users ON messageSender = userID WHERE messageRecipient = ' . $_SESSION["userID"] . ' LIMIT 0,25;')) {
echo '
<div class="col-md-2">
';
while ($row = mysqli_fetch_object($result)) {
$messageJSON = (string) json_encode($row);
echo '
<div class="list-group">
<a href="#" onclick="displayMessage(\'' . $row->messageID . '\');"" class="list-group-item">
<p class="list-group-item-text">' . $row->messageTime . ' - ' . $row->userLogin . '</p>
<h4 class="list-group-item-heading">' . $row->messageSubject . '</h4>
</a>
</div>
';
}
echo '</div>';
} else {
echo '<script type="text/javascript">', 'printError(\'Error while getting your messages!\')', '</script>';
}
}
示例4: printCountrySelect
function printCountrySelect()
{
global $mysql;
$MySQLConnection = new Mysql($mysql['host'], $mysql['port'], $mysql['user'], $mysql['password'], $mysql['database']);
$MySQLConnection->connect();
$result = $MySQLConnection->getQuery('SELECT * FROM countries;');
echo '<select id="userCountry" name="userCountry"><option value="">---NO COUNTRY SELECTED---</option>';
while ($row = mysqli_fetch_assoc($result)) {
echo '<option value="' . $row["iso3166"] . '">' . $row["countryName"] . '</option>';
}
echo '</select>';
}
示例5: stdClass
<?php
$JSONerror = new stdClass();
include_once 'mysql.class.php';
include_once 'include/conf.php';
if (isset($_POST)) {
if (isset($_POST['userLogin']) && isset($_POST['userPassword']) && isset($_POST['userEmail']) && $_POST['userPassword'] == $_POST['userPasswordRepeat']) {
$userData = $_POST;
$userData["userPassword"] = password_hash((string) $userData['userPassword'], PASSWORD_DEFAULT);
$MySQLConnection = new Mysql($mysql['host'], $mysql['port'], $mysql['user'], $mysql['password'], $mysql['database']);
$MySQLConnection->connect();
if ($MySQLConnection->getQuery('INSERT INTO users (userLogin, userPassword, userEmail, userFirstName, userLastName, userGender, userBirthDay, userValid, userCountry) VALUES ("' . $userData["userLogin"] . '","' . $userData["userPassword"] . '","' . $userData["userEmail"] . '","' . $userData["userFirstName"] . '","' . $userData["userLastName"] . '","' . $userData["userGender"] . '","' . $userData["userBirthDay"] . '",0,"' . $userData["userCountry"] . '");')) {
$JSONerror->state = 0;
$JSONerror->message = 'Success!';
print_r(json_encode($JSONerror));
} else {
$JSONerror->state = 1;
$JSONerror->message = 'MySQL Error!';
print_r(json_encode($JSONerror));
}
} else {
$JSONerror->state = 1;
$JSONerror->message = 'Some Fields contain invalid Data!';
print_r(json_encode($JSONerror));
}
} else {
$JSONerror->state = 1;
$JSONerror->message = 'General Error!';
print_r(json_encode($JSONerror));
}
示例6: stdClass
<?php
$JSONerror = new stdClass();
include_once 'mysql.class.php';
include_once 'include/conf.php';
include_once 'include/session.php';
if (isset($_POST)) {
if (isset($_POST["matchID"]) && isset($_POST["ScoreHome"]) && isset($_POST["ScoreForeign"])) {
global $mysql;
$MySQLConnection = new Mysql($mysql['host'], $mysql['port'], $mysql['user'], $mysql['password'], $mysql['database']);
$MySQLConnection->connect();
$result = $MySQLConnection->getQuery('SELECT count(*) FROM tippchampion.tips WHERE tipUser = ' . $_SESSION['userID'] . ' AND tipMatch = ' . $_POST['matchID'] . ';');
$update = mysqli_fetch_assoc($result);
if ($update['count(*)']) {
$MySQLConnection->getQuery('UPDATE tips SET tipUser = ' . $_SESSION['userID'] . ', tipScoreHome = ' . $_POST['ScoreHome'] . ', tipScoreForeign = ' . $_POST['ScoreForeign'] . ' WHERE tipMatch = ' . $_POST['matchID'] . ';');
} else {
$MySQLConnection->getQuery('INSERT INTO tips (tipUser, tipMatch, tipScoreHome, tipScoreForeign) VALUES (' . $_SESSION['userID'] . ',' . $_POST['matchID'] . ',' . $_POST['ScoreHome'] . ',' . $_POST['ScoreForeign'] . ');');
}
}
} else {
$JSONerror->state = 1;
$JSONerror->message = 'General Error!';
print_r(json_encode($JSONerror));
}
?>