本文整理汇总了PHP中dbconnection::getConnection方法的典型用法代码示例。如果您正苦于以下问题:PHP dbconnection::getConnection方法的具体用法?PHP dbconnection::getConnection怎么用?PHP dbconnection::getConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dbconnection
的用法示例。
在下文中一共展示了dbconnection::getConnection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: start_session
start_session();
//if user is not logged in redirect them to the log in form
if (!is_logged_in()) {
header("Location: login_form.php");
}
//validate the data entered using the validate function in the validateGarage.php file
validate($formdata, $errors);
//if the validation is passed (errors array empty) set each variable to the valuye of the coresponding variable in the formdata array
if (empty($errors)) {
$id = $_POST['id'];
$name = $formdata['name'];
$managername = $formdata['managername'];
$address = $formdata['address'];
$email = $formdata['email'];
$phone = $formdata['phone'];
$openinghours = $formdata['openinghours'];
$openingdate = $formdata['openingdate'];
//make a new garage object with the data above
$garage = new Garage($id, $name, $address, $email, $phone, $openingdate, $openinghours, $managername);
//initialize db connection
$dbconnection = dbconnection::getConnection();
//connect to the bus table through garageTableGateway using the connection above
$gateway = new garageTableGateway($dbconnection);
//execute the update function in the garagetablegateway using the object created above
$id = $gateway->update($garage);
//when completed redirect user to viewall
header('Location: viewallgarages.php');
} else {
//if an error occurs redisplay the edit form
require 'editGarageForm.php';
}