本文整理汇总了PHP中Connection::link方法的典型用法代码示例。如果您正苦于以下问题:PHP Connection::link方法的具体用法?PHP Connection::link怎么用?PHP Connection::link使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Connection
的用法示例。
在下文中一共展示了Connection::link方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUserByLogin
public function getUserByLogin($login)
{
$con = new Connection();
$link = $con->link();
$result = $link->query("select * from ejbsm_user where login = '{$login}'") or die(mysqli_error($link));
$row = mysqli_fetch_object($result);
return $row;
}
示例2: getTimeMonitors
public function getTimeMonitors()
{
$con = new Connection();
$link = $con->link();
$result = $link->query("select * from ejbsm_time_monitors WHERE id = 1") or die(mysqli_error($link));
$row = mysqli_fetch_object($result);
return $row;
}
示例3: getListVisit
public function getListVisit($parameter)
{
$listVisit = new ArrayObject();
$con = new Connection();
$link = $con->link();
$sql = "select * from ejbsm_visit";
if ($parameter) {
$sql .= " ORDER BY {$parameter} DESC";
} else {
$sql .= " ORDER BY id DESC";
}
$result = $link->query($sql) or die(mysqli_error($link));
while ($visit = mysqli_fetch_object($result)) {
$listVisit->append($visit);
}
return $listVisit;
}
示例4: Connection
<?php
namespace PluSQL;
\Murphy\Test::add(function ($runner) {
\Murphy\Fixture::load(dirname(__FILE__) . '/../on_clause.class.php.murphy/fixture.php')->execute();
$conn = new Connection('localhost', 'plusql', 'plusql', 'plusql');
$conn->connect();
$query = new Query('SELECT * FROM strong_guy', $conn->link());
if ($query->strong_guy instanceof QueryIterator) {
$runner->pass();
} else {
$runner->fail('Did not get a QueryIterator for a table we should have been able to');
}
try {
$query->non_existant;
$runner->fail('Why was I able to try and get a non-existant member variable that isn\'t a valid table or field?');
} catch (TableInspectorException $exc) {
$runner->pass();
}
$row = $query->nextRow();
if (count($row)) {
$runner->fail('You called nextRow() on a query from which you\'d already extracted a QueryIterator - you should only be able to call rowAtIndex');
}
$row = $query->rowAtIndex(0);
if ($row['strong_name'] == 'Strongy Strongo') {
$runner->pass();
} else {
$runner->fail('The row returned from your query did not contain the right data');
}
$query = new Query('SELECT * FROM strong_guy', $conn->link());
示例5: use
namespace PluSQL;
\Murphy\Test::add(function ($runner) {
$conn = NULL;
\Murphy\Fixture::load(dirname(__FILE__) . '/../on_clause.class.php.murphy/fixture.php')->execute();
\Murphy\Fixture::load(dirname(__FILE__) . '/../query_iterator.class.php.murphy/fixture.php')->execute(function ($aliases) use(&$conn) {
$aliases = $aliases['plusql'];
$host = $aliases[0];
$username = $aliases[1];
$password = $aliases[2];
$dbname = $aliases[3];
$conn = new Connection($host, $username, $password, $dbname);
$conn->connect();
});
$worker = new TableInspectorWorker('strong_guy', $conn->link());
$expected = 'bd3251f7c5acccb2b73fd83be63c7ea2';
ob_start();
print_r($worker->allFields());
$actual = md5(trim(ob_get_clean()));
if ($actual == $expected) {
$runner->pass();
} else {
$runner->fail('Did not get the correct field data from TableInspectorWorker');
}
$worker = new TableInspectorWorker('strong_guy', $conn->link());
$expected = '1b656c3c43833bf1ac9cf5620643522f';
ob_start();
print_r($worker->primaryKeys());
$actual = md5(trim(ob_get_clean()));
if ($actual == $expected) {
示例6: htmlspecialchars
<?php
/**
* Created by PhpStorm.
* User: willian.manucello
* Date: 10/21/2015
* Time: 3:24 PM
*/
// get the q parameter from URL
$q = htmlspecialchars($_REQUEST["q"]);
if ($q !== "") {
require_once '../../../core/service/Connection.php';
require_once '../../../core/model/Visit.php';
require_once '../../../core/dao/VisitDao.php';
$con = new Connection();
$link = $con->link();
$sql = "select * from ejbsm_visit WHERE date = '{$q}'";
$result = $link->query($sql);
if ($result->num_rows > 0) {
while ($visit = mysqli_fetch_object($result)) {
echo "<div style='color: red'>";
echo "Visita as {$visit->hour} com duração de {$visit->duration}<br>";
}
} else {
echo "<div style='color: green'>";
echo "Sem visitas neste dia.";
}
echo "</div>";
}