本文整理汇总了PHP中Connector::GetConnection方法的典型用法代码示例。如果您正苦于以下问题:PHP Connector::GetConnection方法的具体用法?PHP Connector::GetConnection怎么用?PHP Connector::GetConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Connector
的用法示例。
在下文中一共展示了Connector::GetConnection方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetUserInformation
function GetUserInformation($payload)
{
$connector = new Connector();
$payload = json_decode($payload);
$sql = "";
$sql .= " SELECT";
$sql .= " \t members_info.email";
$sql .= " \t , members_info.lastname";
$sql .= " \t , members_info.firstname";
$sql .= " \t , members_info.middlename";
$sql .= " \t , members_info.contactno";
$sql .= " \t , members_info.status";
$sql .= " \t , members_address.houseno";
$sql .= " \t , members_address.companyname";
$sql .= " \t , members_address.barangay";
$sql .= " \t , members_address.city";
$sql .= " \t , members_address.district";
$sql .= " FROM members_info";
$sql .= " INNER JOIN members_address ON";
$sql .= " \tmembers_info.email = members_address.email";
$sql .= " WHERE";
$sql .= "\tmembers_info.email \t\t\t= '" . $payload->email . "'";
$sql .= "\tAND members_info.password \t= '" . md5($payload->password) . "'";
$mysqliQuery = mysqli_query($connector->GetConnection(), $sql);
if ($mysqliQuery) {
echo json_encode(mysqli_fetch_array($mysqliQuery));
} else {
echo 'error';
}
}
示例2: GetServiceableAreaList
public function GetServiceableAreaList()
{
$connector = new Connector();
$sqlCities = "SELECT cityname FROM cities";
$mysqliQueryCities = mysqli_query($connector->GetConnection(), $sqlCities);
$results = array();
while ($row_city = mysqli_fetch_array($mysqliQueryCities)) {
$city = new City();
$city->cityName = $row_city['cityname'];
$sqlDistricts = "";
$sqlDistricts .= " SELECT districtname, class";
$sqlDistricts .= " FROM district WHERE cityname='" . $city->cityName . "'";
$mysqliQueryDistricts = mysqli_query($connector->GetConnection(), $sqlDistricts);
while ($row_district = mysqli_fetch_array($mysqliQueryDistricts)) {
$district = new District();
$district->districtName = $row_district['districtname'];
$district->class = $row_district['class'];
array_push($city->districts, $district);
}
array_push($results, $city);
}
return json_encode($results);
}
示例3: GetShippingPrices
public function GetShippingPrices()
{
$connector = new Connector();
$sql = " SELECT";
$sql .= "\tdistancefrom";
$sql .= " \t, distanceto";
$sql .= "\t, price";
$sql .= " FROM shipping_prices";
$mysqliQuery = mysqli_query($connector->GetConnection(), $sql);
$output = array();
while ($row = mysqli_fetch_array($mysqliQuery, MYSQLI_ASSOC)) {
array_push($output, $row);
}
return json_encode($output);
}
示例4: AddBook
function AddBook($payload)
{
$book = new Book();
$connector = new Connector();
$conn = $connector->GetConnection();
$payload = json_decode($payload);
$book->sender->SetName($payload->sender->name);
$book->sender->SetHouseNo($payload->sender->houseNo);
$book->sender->SetCompanyName($payload->sender->companyName);
$book->sender->SetBarangay($payload->sender->barangay);
$book->sender->SetCity($payload->sender->city);
$book->sender->SetDistrict($payload->sender->district);
$book->sender->SetContactNo($payload->sender->contactNo);
$book->receiver->SetName($payload->receiver->name);
$book->receiver->SetHouseNo($payload->receiver->houseNo);
$book->receiver->SetCompanyName($payload->receiver->companyName);
$book->receiver->SetBarangay($payload->receiver->barangay);
$book->receiver->SetCity($payload->receiver->city);
$book->receiver->SetDistrict($payload->receiver->district);
$book->receiver->SetContactNo($payload->receiver->contactNo);
$book->SetServiceLevel($payload->serviceLevel);
$book->SetSize($payload->size);
$book->SetHeight($payload->height);
$book->SetLength($payload->length);
$book->SetWidth($payload->width);
$book->SetWeight($payload->weight);
$book->SetChargeableWeight($payload->chargeableWeight);
$book->SetDimension($payload->dimension);
$book->SetInsurance($payload->insurance);
$book->SetDeclaredValue($payload->declaredValue);
$book->SetPaymentMethod($payload->paymentMethod);
$payload->cod->bankName = isset($payload->cod->bankName) ? $payload->cod->bankName : "";
$payload->cod->accountName = isset($payload->cod->accountName) ? $payload->cod->accountName : "";
$payload->cod->accountNo = isset($payload->cod->accountNo) ? $payload->cod->accountNo : "";
$payload->cod->amount = isset($payload->cod->amount) ? $payload->cod->amount : 0;
$book->cod->SetBankName($payload->cod->bankName);
$book->cod->SetAccountName($payload->cod->accountName);
$book->cod->SetAccountNo($payload->cod->accountNo);
$book->cod->SetAmount($payload->cod->amount);
$book->SetAmountDue($payload->amountDue);
if ($book->SaveBooking()[1]) {
echo json_encode($book->SaveBooking());
} else {
echo json_encode($book->SaveBooking());
}
}
示例5: GenerateNewPassword
public function GenerateNewPassword()
{
$connector = new Connector();
$newPassword = $this->GeneratePassword();
$sql = "";
$sql .= " UPDATE members_info";
$sql .= "\tSET password = '" . md5($newPassword) . "'";
$sql .= " WHERE";
$sql .= " \temail = '" . $this->currentEmail . "'";
$mysqliQuery = mysqli_query($connector->GetConnection(), $sql);
if ($mysqliQuery) {
$mailer = new Mailer();
$mailer->SetRecepient($this->currentEmail);
$mailer->EmailNewPassword($newPassword);
$mailer->SendMail();
return true;
} else {
return false;
}
}
示例6: SaveBooking
public function SaveBooking()
{
date_default_timezone_set("Asia/Manila");
$connector = new Connector();
$date = date('D');
$hours = date('H:i:s');
$dateToday = date('g:m:s A');
$dateTime = date('Y-m-d');
$randomNumber = mt_rand(0, 99999);
$randomNumber = str_pad($randomNumber, 5, '0', STR_PAD_LEFT);
$day = date('d');
$month = date('m');
$referenceNo = date('Y') . $randomNumber . $month . $day;
$collectOnDelivery = 'NIA';
$cod = 'No';
$this->serviceLevel = str_replace(" Delivery", "", $this->serviceLevel);
if ($this->serviceLevel == 'Same Day Delivery w/ Collect On Delivery' || $this->serviceLevel == 'Next Day Delivery w/ Collect On Delivery') {
$collectOnDelivery = 'Delivery';
$cod = 'Yes';
$this->serviceLevel = str_replace(" w/ Collect On Delivery", "", $this->serviceLevel);
}
$sql = "";
$sql .= " INSERT INTO booking_details";
$sql .= " VALUES";
$sql .= " (";
$sql .= " \t \t'" . $referenceNo . "'";
$sql .= " \t , \t'" . $this->serviceLevel . "'";
$sql .= " \t , \t'" . $this->size . "'";
$sql .= " \t , \t'" . $collectOnDelivery . "'";
$sql .= " \t , \t'" . $cod . "'";
$sql .= " \t , \t'" . $this->declaredValue . "'";
$sql .= " \t , \t''";
$sql .= " \t , \t" . $this->weight;
$sql .= " \t , \t" . $this->height;
$sql .= " \t , \t" . $this->length;
$sql .= " \t , \t" . $this->width;
$sql .= " \t , \t" . $this->amountDue;
$sql .= " \t , ''";
$sql .= " \t , ''";
$sql .= " \t , ''";
$sql .= " \t , ''";
$sql .= " \t , ''";
$sql .= " \t , ''";
$sql .= " \t , ''";
$sql .= " \t , '" . $this->sender->GetEmail() . "'";
$sql .= " \t , '" . $this->sender->GetName() . "'";
$sql .= " \t , '" . $this->receiver->GetName() . "'";
$sql .= " \t , '" . $dateTime . "'";
$sql .= " \t , '" . $this->receiver->GetHouseNo() . "'";
$sql .= " \t , '" . $this->receiver->GetCompanyName() . "'";
$sql .= " \t , '" . $this->receiver->GetBarangay() . "'";
$sql .= " \t , '" . $this->receiver->GetCity() . "'";
$sql .= " \t , '" . $this->receiver->GetDistrict() . "'";
$sql .= " \t , '" . $this->receiver->GetContactNo() . "'";
$sql .= " \t , 'Submitted'";
$sql .= " \t , '" . $this->suggestion . "'";
$sql .= " \t , '" . $dateToday . "'";
$sql .= " \t , '" . $this->sender->GetName() . "'";
$sql .= " \t , '" . $this->sender->GetHouseNo() . "'";
$sql .= " \t , '" . $this->sender->GetCompanyName() . "'";
$sql .= " \t , '" . $this->sender->GetBarangay() . "'";
$sql .= " \t , '" . $this->sender->GetCity() . "'";
$sql .= " \t , '" . $this->sender->GetDistrict() . "'";
$sql .= " \t , '" . $this->sender->GetContactNo() . "'";
$sql .= " \t , '" . $this->cod->GetBankName() . "'";
$sql .= " \t , '" . $this->cod->GetAccountName() . "'";
$sql .= " \t , '" . $this->cod->GetAccountNo() . "'";
$sql .= " \t , '" . $this->cod->GetAmount() . "'";
$sql .= " \t , ''";
$sql .= " \t , ''";
$sql .= " \t , ''";
$sql .= " \t , ''";
$sql .= " \t , ''";
$sql .= " )";
$mysqliQuery = mysqli_query($connector->GetConnection(), $sql);
if ($mysqliQuery) {
return array($referenceNo, true);
} else {
return array($referenceNo, false);
}
}
示例7: UpdatePersonalInfo
public function UpdatePersonalInfo()
{
$connector = new Connector();
$sql = "";
$sql .= " SELECT COUNT( email ) AS Counter FROM members_info";
$sql .= " WHERE";
$sql .= " \temail = '" . $this->currentEmail . "'";
$sql .= "\tAND password = '" . md5($this->currentPassword) . "'";
$mysqliQuery = mysqli_query($connector->GetConnection(), $sql);
$counter = mysqli_fetch_array($mysqliQuery)["Counter"];
if ($counter == '1') {
$sql = "";
$sql .= " UPDATE members_info";
$sql .= " SET";
$sql .= "\tfirstname \t\t= '" . $this->firstName . "'";
$sql .= "\t, middlename \t= '" . $this->middleName . "'";
$sql .= " \t, lastname \t\t= '" . $this->lastName . "'";
$sql .= " WHERE";
$sql .= "\temail = '" . $this->currentEmail . "'";
$mysqliQuery = mysqli_query($connector->GetConnection(), $sql);
if ($mysqliQuery) {
return true;
} else {
return false;
}
} else {
return false;
}
}
示例8: ValidateEmail
public function ValidateEmail($value)
{
$connector = new Connector();
$sql = "";
$sql .= " SELECT COUNT( email ) AS Counter FROM members_info";
$sql .= " WHERE email='" . $value . "'";
$mysqliQuery = mysqli_query($connector->GetConnection(), $sql);
if ($mysqliQuery) {
if (mysqli_fetch_array($mysqliQuery)['Counter'] == 0) {
return false;
} else {
return true;
}
}
return false;
}