die('bad...bad, so bad query: ' . $link->error); } return $result; } public function table($name) { return $this->table = $name; } public function column($name) { return $this->column = $name; } public function insert($table, $column, $value) { $q = "INSERT INTO {$table} ( {$column} ) VALUES (' {$value} ')"; $this->query($q); echo 'Done'; } public function select($table, $column) { $q = "SELECT {$column} FROM {$table}"; $this->query($q); echo 'Done'; } } $use = new client(); $table = $use->table('user'); $column = $use->column('name'); $value = 'hamza'; $use->insert($table, $column, $value);
function newClient() { $results = array(); $results['pageTitle'] = "Nuovo cliente"; $results['formAction'] = "newClient"; if (isset($_POST['saveChanges'])) { $client = new client(); $client->storeFormValues($_POST); $client->insert(); header("Location: admin.php?action=listClients&status=changesSaved"); } elseif (isset($_POST['cancel'])) { // User has cancelled their edits: return to the article list header("Location: admin.php"); } else { // User has not posted the article edit form yet: display the form $results['client'] = new client(); require TEMPLATE_PATH . "/admin/editClient.php"; } }