当前位置: 首页>>代码示例>>PHP>>正文


PHP dbconnection::getConnection方法代码示例

本文整理汇总了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';
}
开发者ID:aaronoh,项目名称:myFormValidation,代码行数:31,代码来源:editGarage.php


注:本文中的dbconnection::getConnection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。