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


PHP connection::create方法代码示例

本文整理汇总了PHP中connection::create方法的典型用法代码示例。如果您正苦于以下问题:PHP connection::create方法的具体用法?PHP connection::create怎么用?PHP connection::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在connection的用法示例。


在下文中一共展示了connection::create方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testCreateUser

 public function testCreateUser()
 {
     $params = array('table' => 'my_record', 'first_name' => 'fname', 'last_name' => 'lname', 'address' => 'address', 'phone' => 'phone');
     $conn = new connection();
     $result = $conn->create('users', 'fname', 'lname', 'address', 'phone');
     $this->assertEquals(true, $result);
 }
开发者ID:amirsaga,项目名称:hleday2,代码行数:7,代码来源:AppTest.php

示例2: NOW

        ///////////////////////create trigger to products////////////***************
        $query = "DELIMITER //\n\t\t\tCREATE TRIGGER changes BEFORE INSERT ON\n\t\t\tProducts FOR EACH ROW BEGIN\n\t\t\t\t\tUPDATE changes\n\t\t\tSET changeDate = NOW() where tableName='Products'\n\t\t\tEND //\n\t\t\tDELIMITER ;";
        mysqli_query(connection::$obj, $query);
        ///////////////////////create trigger to category////////////***************
        $query = "DELIMITER //\n\t\t\tCREATE TRIGGER changes BEFORE INSERT ON\n\t\t\tCategory FOR EACH ROW BEGIN\n\t\t\t\t\t\tUPDATE changes\n\t\t\tSET changeDate = NOW() where tableName='Category'\n\t\t\tEND //\n\t\t\tDELIMITER ;";
        mysqli_query(connection::$obj, $query);
        ///////////////////////create trigger to Room////////////***************
        $query = "DELIMITER //\n\t\t\tCREATE TRIGGER changes BEFORE INSERT ON\n\t\t\tRoom FOR EACH ROW BEGIN\n\t\t\t\t\t\tUPDATE changes\n\t\t\tSET changeDate = NOW() where tableName='Room'\n\t\t\tEND //\n\t\t\tDELIMITER ;";
        mysqli_query(connection::$obj, $query);
        //////////////////////create trigger to Orders////////////***************
        $query = "DELIMITER //\n\t\t\tCREATE TRIGGER changes BEFORE INSERT ON\n\t\t\tOrders FOR EACH ROW BEGIN\n\t\t\t\t\t\tUPDATE changes\n\t\t\tSET changeDate = NOW() where tableName='Orders'\n\t\t\tEND //\n\t\t\tDELIMITER ;";
        mysqli_query(connection::$obj, $query);
        /////////////////add relationship between tables
        $sq = "alter table Users add foreign key (rid) references Room (rid);";
        connection::$obj->query($sq);
        $sq = "alter table Products add foreign key (cid) references Category (cid);";
        connection::$obj->query($sq);
        $sq = "alter table Orders add foreign key (uid) references Users (uid);";
        connection::$obj->query($sq);
        $sq = "alter table Orders add foreign key (rid) references Room (rid);";
        connection::$obj->query($sq);
        $sq = "alter table orderProducts add foreign key (oid)  references Orders (oid);";
        connection::$obj->query($sq);
        $sq = "alter table orderProducts add foreign key (pid)  references Products (pid);";
        connection::$obj->query($sq);
        $sq = "alter table orderProducts add primary key (oid,pid);";
        connection::$obj->query($sq);
    }
}
connection::create();
开发者ID:smagdy,项目名称:PHPproject,代码行数:30,代码来源:connection.php

示例3: connection

<?php

include_once 'connection.php';
$con = new connection();
$table = "users";
if (isset($_POST['submit'])) {
    $fname = $_POST['first_name'];
    $lname = $_POST['last_name'];
    $address = $_POST['address'];
    $phone = $_POST['phone'];
    $res = $con->create($table, $fname, $lname, $address, $phone);
    if ($res) {
        header('Location: ' . 'index.php');
    }
}
?>
<html>
<head>
	<title>CRUD</title>

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
</head>
<body>	
<div class="container">
    <div class="row">
	<label for="Edit user">Create User:</label>
    <form method="post">
     <table align="center" class="table table-bordered">
    <tr>
    	<td>First Name:</td>
    	<td><input type="text" name="first_name" placeholder="First Name" required/></td>
开发者ID:amirsaga,项目名称:hleday2,代码行数:31,代码来源:create.php


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