本文整理汇总了PHP中DatabaseConnection::Rows方法的典型用法代码示例。如果您正苦于以下问题:PHP DatabaseConnection::Rows方法的具体用法?PHP DatabaseConnection::Rows怎么用?PHP DatabaseConnection::Rows使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DatabaseConnection
的用法示例。
在下文中一共展示了DatabaseConnection::Rows方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateStats
function updateStats($objectName, $objectId, $type)
{
$db = new DatabaseConnection();
$stats = new Stats();
$query = "SELECT statsid FROM stats WHERE objectname='{$objectName}' AND objectid='{$objectId}'";
$results = $db->Query($query);
if ($db->Rows() > 0) {
//exsiting
$data = mysql_fetch_row($results);
$stats = $stats->Get((int) $data[0]);
} else {
//new record
$stats->objectname = $objectName;
$stats->objectid = $objectId;
}
$stats->{$type} = $stats->{$type} + 1;
$stats->Save();
}
示例2: OnlineUser
if (($result = validate($telephone, "phonenumber", 45)) !== true) {
$errorText .= "<LI>Your telephone number is {$result}";
}
if ($fax != "" && ($result = validate($fax, "phonenumber", 45)) !== true) {
$errorText .= "<LI>Your fax number is {$result}";
}
}
if (($result = validate($password, "password", 45, 6)) !== true) {
$errorText .= "<LI>Your password is {$result}";
}
if ($_POST["readTerms"] != "on") {
$errorText .= "<LI>Please read the terms and then tick the box to proceed";
}
if ($errorText == "") {
$query = $db->Query("SELECT * FROM onlineuser WHERE email='" . $db->Escape($email) . "' LIMIT 1");
if ($db->Rows() > 0) {
$errorText .= "<LI>The email address you have entered is taken";
} else {
$user = new OnlineUser($email, $first_name, $last_name, $password, $address1, $address2, $address3, $postcode, $telephone, $fax, '', 'temp');
if (isSuperUser(false) && $status != "") {
$user->user_status = $status;
}
$userId = $user->Save();
$user = $user->Get($userId);
$created = strtotime($user->dt_created);
$mail = new Emailer();
$mail->setTo($email);
$mail->setFrom($configuration["fromEmail"]);
$mail->setSubject("Fastfoodjobsuk Registration");
$url = "http://www.fastfoodjobsuk.co.uk/register_activate.php?email={$email}&code={$created}";
$mail->bodyAdd("Dear {$first_name} {$last_name}");
示例3: Spotlight
<?php
require "common_all.php";
$id = (int) $_GET["id"];
$member = new Spotlight();
$member = $member->Get($id);
if ($member->spotlightId == 0) {
// pull latest out of db
$db = new DatabaseConnection();
$result = $db->Query("SELECT spotlightid FROM spotlight ORDER BY dt_created DESC LIMIT 1");
if ($db->Rows() == 1) {
$qr = mysql_fetch_row($result);
$member = $member->Get($qr[0]);
} else {
header("Location: index.php");
exit;
}
}
require "top_wide.php";
?>
<link rel=stylesheet href="css/platinum.css" type="text/css">
<img src="logos/<?php
echo $member->logo;
?>
" width="<?php
echo $platinumImageWidth;
?>
" height="<?php
echo $platinumImageHeight;
?>
" class="topimageleft">
示例4: Save
/**
* Saves the object to the database
* @return integer $userId
*/
function Save()
{
$Database = new DatabaseConnection();
$this->pog_query = "select userid from `user` where `userid`='" . $this->userId . "' LIMIT 1";
$Database->Query($this->pog_query);
if ($Database->Rows() > 0) {
$this->pog_query = "update `user` set \r\n\t\t\t`username`='" . $Database->Escape($this->username) . "', \r\n\t\t\t`password`='" . $Database->Escape($this->password) . "', \r\n\t\t\t`firstname`='" . $Database->Escape($this->firstname) . "', \r\n\t\t\t`lastname`='" . $Database->Escape($this->lastname) . "', \r\n\t\t\t`question`='" . $Database->Escape($this->question) . "', \r\n\t\t\t`answer`='" . $Database->Escape($this->answer) . "', \r\n\t\t\t`groupid`='" . $this->groupId . "', \r\n\t\t\t`lastlogin`='" . $Database->Escape($this->lastlogin) . "', \r\n\t\t\t`disabled`='" . $Database->Escape($this->disabled) . "' where `userid`='" . $this->userId . "'";
} else {
$this->pog_query = "insert into `user` (`username`, `password`, `firstname`, `lastname`, `question`, `answer`, `groupid`, `lastlogin`, `disabled` ) values (\r\n\t\t\t'" . $Database->Escape($this->username) . "', \r\n\t\t\t'" . $Database->Escape($this->password) . "', \r\n\t\t\t'" . $Database->Escape($this->firstname) . "', \r\n\t\t\t'" . $Database->Escape($this->lastname) . "', \r\n\t\t\t'" . $Database->Escape($this->question) . "', \r\n\t\t\t'" . $Database->Escape($this->answer) . "', \r\n\t\t\t'" . $this->groupId . "', \r\n\t\t\t'" . $Database->Escape($this->lastlogin) . "', \r\n\t\t\t'" . $Database->Escape($this->disabled) . "' )";
}
$Database->InsertOrUpdate($this->pog_query);
if ($this->userId == "") {
$this->userId = $Database->GetCurrentId();
}
return $this->userId;
}
示例5: generateJobLink
function generateJobLink($user)
{
global $truncateText;
$db = new DatabaseConnection();
$result = $db->Query("SELECT * FROM job where onlineuser_onlineuserid={$user->onlineuserId} ORDER BY dt_created DESC");
$rows = $db->Rows();
$alt = false;
$rowclass = "";
if ($rows > 0 || isSuperUser(false)) {
echo "<br/>";
echo "<span class='adminrowheader'>Job Admin</span>";
echo " - <a href='job_post.php' class='newslarge'>create new</a>";
echo "<div class=\"spacer\"></div>";
echo "<table class=\"table\">";
if ($rows == 0) {
if (isSuperUser(false)) {
echo "<tr><td>";
echo "currently have no entries";
echo "</td></tr>";
}
} else {
echo "<TR><TD>Position</td><TD>Description</td><TD>Salary</td><TD>Location</td><TD>Company</td><TD>Created</td><TD>Expires</td><TD>Status</td><TD><!-- Functions --></td></tr>";
for ($i = 0; $i < $rows; $i++) {
$row = mysql_fetch_assoc($result);
if ($alt) {
$rowclass = "row_even";
} else {
$rowclass = "row_odd";
}
$alt = !$alt;
echo "<tr>";
echo "<td class=\"{$rowclass}\">" . $row["position"] . "</td>";
echo "<td class=\"{$rowclass}\">" . substr($row["profile"], 0, $truncateText) . "...</td>";
echo "<td class=\"{$rowclass}\">" . $row["bonus"] . "</td>";
echo "<td class=\"{$rowclass}\">" . $row["location"] . "</td>";
echo "<td class=\"{$rowclass}\">" . $row["company"] . "</td>";
echo "<td class=\"{$rowclass}\">" . FormatDateTime($row["dt_created"], 7) . "</td>";
echo "<td class=\"{$rowclass}\">" . FormatDateTime($row["dt_expire"], 7) . "</td>";
$jobid = $row["jobid"];
if ($row["job_status"] != "temp" && $row["dt_expire"] <= date("Y-m-d")) {
echo "<td class=\"{$rowclass}\">Expired</td><td class=\"{$rowclass}\"><ul>";
echo "<li><a href=\"renew.php?type=Job&id=" . $jobid . "\">Renew</a></li>";
} else {
switch ($row["job_status"]) {
case "temp":
echo "<td class=\"{$rowclass}\">Temporary</td><td class=\"{$rowclass}\"><ul>";
echo "<li><a href='activate.php?type=Job&id={$jobid}'>Activate</a></li>";
break;
case "active":
echo "<td class=\"{$rowclass}\">Active</td><td class=\"{$rowclass}\"><ul>";
if (isSuperUser(false)) {
echo "<li><a href='deactivate.php?type=Job&id={$jobid}'>Pause</a></li>";
}
break;
case "disabled":
echo "<td class=\"{$rowclass}\">Paused</td><td class=\"{$rowclass}\"><ul>";
if (isSuperUser(false)) {
echo "<li><a href='activate.php?type=Job&id={$jobid}'>Continue</a></li>";
}
}
}
echo "<li><a href='jobedit.php?jobid={$jobid}'>Modify</a></li>";
//echo "<li><a href='jobview.php?jobid=$jobid' target='_blank'>View</a></li>";
if (isSuperUser(false)) {
echo "<li><a href='#' onClick=\"sure('Job','{$jobid}')\">Delete</a></li>";
}
echo "</ul>";
echo "</td>";
echo "</tr>";
}
}
echo "</table>";
echo "<br/>";
echo "<br/>";
}
}
示例6: hasSpotlight
function hasSpotlight()
{
$db = new DatabaseConnection();
$result = $db->Query("SELECT spotlightid FROM spotlight WHERE membershipid='" . $this->gold_membershipId . "' AND spotlight_type='gold_membership'");
if ($db->Rows() > 0) {
$id = mysql_fetch_row($result);
return $id[0];
} else {
return false;
}
}
示例7: DatabaseConnection
$emailMessage .= "None of your contact details have been revealed\n";
$emailMessage .= "and it is totally up to you if you wish to make\n";
$emailMessage .= "contact with the interested employer.\n\n";
$emailMessage .= "Regards,\n\n";
$emailMessage .= "The Fast Food Jobs Team\n\n";
$emailMessage .= "Tel: 0845 644 8252\n";
$emailMessage .= "info@fastfoodjobsuk.co.uk";
return $emailMessage;
}
$cvid = (int) $_GET["cvid"];
if ($cvid == "") {
$cvid = (int) $_POST["cvid"];
}
$db = new DatabaseConnection();
$results = $db->Query("SELECT first_name, last_name, email FROM cv WHERE cvid='{$cvid}'");
if ($db->Rows() <= 0) {
// possibly post/get data has been tampered with
// you should always get 1 row back with this query
exit;
}
$data = mysql_fetch_row($results);
$cv_first_name = $data[0];
$cv_last_name = $data[1];
$cv_email = $data[2];
if ((bool) $_POST["submitting"]) {
$jobId = (int) $_POST["jobIds"];
$queryJob = $db->Query("SELECT contact_email FROM job WHERE jobid='{$jobId}'");
if ($db->Rows() <= 0) {
// shouldn't really ever get here
exit;
}
示例8: Save
/**
* Saves the object to the database
* @return integer $platinum_membershipId
*/
function Save()
{
$Database = new DatabaseConnection();
$this->pog_query = "select `spotlightid` from `spotlight` where `spotlightid`='" . $this->spotlightId . "' LIMIT 1";
$Database->Query($this->pog_query);
if ($Database->Rows() > 0) {
$this->pog_query = "update `spotlight` set \n\t\t\t`membershipId`='" . $Database->Escape($this->membershipId) . "', \n\t\t\t`logo`='" . $Database->Escape($this->logo) . "', \n\t\t\t`image1`='" . $Database->Escape($this->image1) . "', \n\t\t\t`image2`='" . $Database->Escape($this->image2) . "', \n\t\t\t`heading`='" . $Database->Escape($this->heading) . "', \n\t\t\t`text`='" . $Database->Escape($this->text) . "', \n\t\t\t`name`='" . $Database->Escape($this->name) . "', \n\t\t\t`address`='" . $Database->Escape($this->address) . "', \n\t\t\t`tel`='" . $Database->Escape($this->tel) . "', \n\t\t\t`fax`='" . $Database->Escape($this->fax) . "', \n\t\t\t`email`='" . $Database->Escape($this->email) . "', \n\t\t\t`link`='" . $Database->Escape($this->link) . "', \n\t\t\t`dt_created`='" . $Database->Escape($this->dt_created) . "', \n\t\t\t`spotlight_type`='" . $this->spotlight_type . "' where `spotlightid`='" . $this->spotlightId . "'";
} else {
$this->pog_query = "insert into `spotlight` (`membershipid`, `logo`, `image1`, `image2`, `heading`, `text`, `name`, `address`, `tel`, `fax`, `email`, `link`, `spotlight_type` ) values (\n\t\t\t'" . $Database->Escape($this->membershipId) . "', \n\t\t\t'" . $Database->Escape($this->logo) . "', \n\t\t\t'" . $Database->Escape($this->image1) . "', \n\t\t\t'" . $Database->Escape($this->image2) . "', \n\t\t\t'" . $Database->Escape($this->heading) . "', \n\t\t\t'" . $Database->Escape($this->text) . "', \n\t\t\t'" . $Database->Escape($this->name) . "', \n\t\t\t'" . $Database->Escape($this->address) . "', \n\t\t\t'" . $Database->Escape($this->tel) . "', \n\t\t\t'" . $Database->Escape($this->fax) . "', \n\t\t\t'" . $Database->Escape($this->email) . "', \n\t\t\t'" . $Database->Escape($this->link) . "', \n\t\t\t'" . $this->spotlight_type . "' )";
}
$Database->InsertOrUpdate($this->pog_query);
if ($this->spotlightId == "") {
$this->spotlightId = $Database->GetCurrentId();
}
return $this->spotlightId;
}
示例9: Save
/**
* Saves the object to the database
* @return integer $customerId
*/
function Save()
{
$Database = new DatabaseConnection();
$this->pog_query = "select customerid from `customer` where `customerid`='" . $this->customerId . "' LIMIT 1";
$Database->Query($this->pog_query);
if ($Database->Rows() > 0) {
$this->pog_query = "update `customer` set \r\n\t\t\t`company`='" . $Database->Escape($this->company) . "', \r\n\t\t\t`firstname`='" . $Database->Escape($this->firstname) . "', \r\n\t\t\t`lastname`='" . $Database->Escape($this->lastname) . "', \r\n\t\t\t`address1`='" . $Database->Escape($this->address1) . "', \r\n\t\t\t`address2`='" . $Database->Escape($this->address2) . "', \r\n\t\t\t`city`='" . $Database->Escape($this->city) . "', \r\n\t\t\t`mobile`='" . $Database->Escape($this->mobile) . "', \r\n\t\t\t`landline`='" . $Database->Escape($this->landline) . "', \r\n\t\t\t`email`='" . $Database->Escape($this->email) . "', \r\n\t\t\t`limit`='" . $Database->Escape($this->limit) . "', \r\n\t\t\t`available`='" . $Database->Escape($this->available) . "', \r\n\t\t\t`deleted`='" . $Database->Escape($this->deleted) . "' where `customerid`='" . $this->customerId . "'";
} else {
$this->pog_query = "insert into `customer` (`company`, `firstname`, `lastname`, `address1`, `address2`, `city`, `mobile`, `landline`, `email`, `limit`, `available`, `deleted` ) values (\r\n\t\t\t'" . $Database->Escape($this->company) . "', \r\n\t\t\t'" . $Database->Escape($this->firstname) . "', \r\n\t\t\t'" . $Database->Escape($this->lastname) . "', \r\n\t\t\t'" . $Database->Escape($this->address1) . "', \r\n\t\t\t'" . $Database->Escape($this->address2) . "', \r\n\t\t\t'" . $Database->Escape($this->city) . "', \r\n\t\t\t'" . $Database->Escape($this->mobile) . "', \r\n\t\t\t'" . $Database->Escape($this->landline) . "', \r\n\t\t\t'" . $Database->Escape($this->email) . "', \r\n\t\t\t'" . $Database->Escape($this->limit) . "', \r\n\t\t\t'" . $Database->Escape($this->available) . "', \r\n\t\t\t'" . $Database->Escape($this->deleted) . "' )";
}
$Database->InsertOrUpdate($this->pog_query);
if ($this->customerId == "") {
$this->customerId = $Database->GetCurrentId();
}
return $this->customerId;
}
示例10:
$where = "";
$where = $firstname != "" ? "first_name like '%" . $db->Escape($firstname) . "%'" : "";
if ($lastname != "") {
if ($where != "") {
$where .= " AND ";
}
$where .= "last_name like '%" . $db->Escape($lastname) . "%'";
}
if ($email != "") {
if ($where != "") {
$where .= " AND ";
}
$where .= "email like '%" . $db->Escape($email) . "%'";
}
$result = $db->Query("SELECT onlineuserId, first_name, last_name, email FROM onlineuser WHERE {$where} AND onlineuserId!='1'");
if (($rows = $db->Rows()) > 0) {
$matches = true;
for ($i = 0; $i < $rows; $i++) {
$resultArray[$i] = mysql_fetch_row($result);
}
}
}
require "top_wide.php";
?>
<style type="text/css" media="screen">
<!--
a { color: #0083cc; font-size: 10px; font-family: Verdana, Arial, Helvetica, SunSans-Regular; text-decoration: none }
a:hover { color: #0083cc; font-size: 10px; font-family: Verdana, Arial, Helvetica, SunSans-Regular; text-decoration: underline }
#wrapper table { width:740px;}
#wrapper td {padding:5px;}
-->
示例11: DatabaseConnection
$db = new DatabaseConnection();
$user = new OnlineUser();
if ((bool) $_POST["submitting"]) {
$id = (int) $_POST["id"];
$user = $user->Get($id);
$tables = array("cv", "franchise", "gold_membership", "job", "platinum_membership", "restaurant", "supplier");
foreach ($tables as $tableName) {
$db->Query("DELETE FROM {$tableName} WHERE onlineuser_onlineuserid='{$id}'");
}
$user->Delete();
$_SESSION["onlineuser"] = $_SESSION["superuser"];
header("Location: delete_user_success.php");
exit;
}
$db->Query("SELECT dt_created FROM cv WHERE onlineuser_onlineuserid='{$id}'");
$cvCount = $db->Rows();
$db->Query("SELECT dt_created FROM franchise WHERE onlineuser_onlineuserid='{$id}'");
$franchiseCount = $db->Rows();
$db->Query("SELECT dt_created FROM gold_membership WHERE onlineuser_onlineuserid='{$id}'");
$goldCount = $db->Rows();
$db->Query("SELECT dt_created FROM job WHERE onlineuser_onlineuserid='{$id}'");
$jobCount = $db->Rows();
$db->Query("SELECT dt_created FROM platinum_membership WHERE onlineuser_onlineuserid='{$id}'");
$platinumCount = $db->Rows();
$db->Query("SELECT dt_created FROM restaurant WHERE onlineuser_onlineuserid='{$id}'");
$restaurantCount = $db->Rows();
$db->Query("SELECT dt_created FROM supplier WHERE onlineuser_onlineuserid='{$id}'");
$supplierCount = $db->Rows();
require "top.php";
?>
示例12: Save
/**
* Saves the object to the database
* @return integer $supplierId
*/
function Save()
{
$Database = new DatabaseConnection();
$this->pog_query = "select supplierid from `supplier` where `supplierid`='" . $this->supplierId . "' LIMIT 1";
$Database->Query($this->pog_query);
if ($Database->Rows() > 0) {
$this->pog_query = "update `supplier` set \r\n\t\t\t`company`='" . $Database->Escape($this->company) . "', \r\n\t\t\t`address1`='" . $Database->Escape($this->address1) . "', \r\n\t\t\t`address2`='" . $Database->Escape($this->address2) . "', \r\n\t\t\t`city`='" . $Database->Escape($this->city) . "', \r\n\t\t\t`phone`='" . $Database->Escape($this->phone) . "', \r\n\t\t\t`contactname`='" . $Database->Escape($this->contactname) . "', \r\n\t\t\t`contactno`='" . $Database->Escape($this->contactno) . "', \r\n\t\t\t`deleted`='" . $Database->Escape($this->deleted) . "' where `supplierid`='" . $this->supplierId . "'";
} else {
$this->pog_query = "insert into `supplier` (`company`, `address1`, `address2`, `city`, `phone`, `contactname`, `contactno`, `deleted` ) values (\r\n\t\t\t'" . $Database->Escape($this->company) . "', \r\n\t\t\t'" . $Database->Escape($this->address1) . "', \r\n\t\t\t'" . $Database->Escape($this->address2) . "', \r\n\t\t\t'" . $Database->Escape($this->city) . "', \r\n\t\t\t'" . $Database->Escape($this->phone) . "', \r\n\t\t\t'" . $Database->Escape($this->contactname) . "', \r\n\t\t\t'" . $Database->Escape($this->contactno) . "', \r\n\t\t\t'" . $Database->Escape($this->deleted) . "' )";
}
$Database->InsertOrUpdate($this->pog_query);
if ($this->supplierId == "") {
$this->supplierId = $Database->GetCurrentId();
}
return $this->supplierId;
}
示例13: Save
/**
* Saves the object to the database
* @return integer $statsId
*/
function Save()
{
$Database = new DatabaseConnection();
$this->pog_query = "select `statsid` from `stats` where `statsid`='" . $this->statsId . "' LIMIT 1";
$Database->Query($this->pog_query);
if ($Database->Rows() > 0) {
$this->pog_query = "update `stats` set \n\t\t\t`objectname`='" . $Database->Escape($this->objectname) . "', \n\t\t\t`objectid`='" . $Database->Escape($this->objectid) . "', \n\t\t\t`impressions`='" . $Database->Escape($this->impressions) . "', \n\t\t\t`clicks`='" . $Database->Escape($this->clicks) . "' where `statsid`='" . $this->statsId . "'";
} else {
$this->pog_query = "insert into `stats` (`objectname`, `objectid`, `impressions`, `clicks`) values (\n\t\t\t'" . $Database->Escape($this->objectname) . "', \n\t\t\t'" . $Database->Escape($this->objectid) . "', \n\t\t\t'" . $Database->Escape($this->impressions) . "', \n\t\t\t'" . $Database->Escape($this->clicks) . "' )";
}
$Database->InsertOrUpdate($this->pog_query);
if ($this->statsId == "") {
$this->statsId = $Database->GetCurrentId();
}
return $this->statsId;
}
示例14: header
echo "<img src=\"logos/" . $platinumImages[$imagePos][1] . "\" width='153' height='104' border='0' class='platinumImages'></a>";
$imagePos++;
} else {
echo "<a href=\"advertise.php\">";
echo "<img src='logos/your_company_here.gif' width='153' height='104' border='0' class='platinumImages'></a>";
}
}
if (isset($_GET["redir"])) {
$_SESSION["redir"] = $_GET["redir"];
header("Location: index.php");
exit;
}
$platinumImages = array(6);
$db = new DatabaseConnection();
$result = $db->Query("SELECT platinum_membershipId,logo\n FROM platinum_membership\n WHERE platinum_membership_status='active'\n AND dt_expire>'" . date("Y-m-d") . "'\n ORDER BY RAND() LIMIT 6");
$rows = $db->Rows();
for ($i = 0; $i < $rows; $i++) {
$qr = mysql_fetch_row($result);
$platinumImages[$i] = $qr;
}
$imagePos = 0;
for ($i = 0; $i < count($platinumImages); $i++) {
updateImpressions("platinum_membership", $platinumImages[$i][0]);
}
$loginEmail = showLoggedInAs();
//default
$button1 = "homebuttonIff_04";
$button2 = "homebuttonIff_05";
$button3 = "homebuttonIff_06";
$button4 = "homebuttonIff_07";
$button5 = "homebuttonIff_08";
示例15: Save
/**
* Saves the object to the database
* @return integer $groupId
*/
function Save($deep = true)
{
$Database = new DatabaseConnection();
$this->pog_query = "select groupid from `group` where `groupid`='" . $this->groupId . "' LIMIT 1";
$Database->Query($this->pog_query);
if ($Database->Rows() > 0) {
$this->pog_query = "update `group` set \r\n\t\t\t`name`='" . $Database->Escape($this->name) . "', \r\n\t\t\t`desc`='" . $Database->Escape($this->desc) . "'where `groupid`='" . $this->groupId . "'";
} else {
$this->pog_query = "insert into `group` (`name`, `desc`) values (\r\n\t\t\t'" . $Database->Escape($this->name) . "', \r\n\t\t\t'" . $Database->Escape($this->desc) . "')";
}
$Database->InsertOrUpdate($this->pog_query);
if ($this->groupId == "") {
$this->groupId = $Database->GetCurrentId();
}
if ($deep) {
$userList = $this->GetUserList();
foreach ($this->_userList as $user) {
$user->Save($deep);
}
}
return $this->groupId;
}