本文整理汇总了PHP中connection::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP connection::delete方法的具体用法?PHP connection::delete怎么用?PHP connection::delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类connection
的用法示例。
在下文中一共展示了connection::delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDeleteUser
public function testDeleteUser()
{
$conn = new connection();
$result = $conn->delete('users', '6');
// echo $result;
$this->assertEquals(true, $result);
}
示例2: connection
/**
* Exemplos de uso para class connection
* @author Antonio Santos
* @version 0.1
*/
$db = new connection();
/**
* Exemplo de insert
*/
$fields_insert = array('field1' => 'first inserted field', 'field2' => 'second inserted field', 'field3' => 'third inserted field');
$result = $db->insert('table_name', $fields_insert, 'id');
/**
* Exemplo de select
*/
$result = $db->select('table_name', array('*'), array('id' => 1));
/**
* Exemplo de update
*/
$fields_update = array('field1' => 'first updated field', 'field2' => 'second updated field', 'field3' => 'third updated field');
$conditions = array('user' => 'tester');
$result = $db->update('table_name', $fields_update, $conditions, 'id');
/**
* Exemplo de delete
*/
$conditions = array('id' => 1);
$result = $db->delete('table_name', $conditions);
/**
* Exemplo de outras queries
*/
$result = $db->results_object('SELECT e.first_name, e.last_name, u.user_type, u.username FROM table_name AS e INNER JOIN second_table_name AS u ON e.id = u.employee_id');
示例3: connection
<?php
include_once 'connection.php';
$con = new connection();
$table = "users";
if (isset($_GET['id'])) {
$id = $_GET['id'];
$result = $con->delete($table, $id);
if ($result) {
header('Location: ' . 'index.php');
}
}