Voting

: nine plus zero?
(Example: nine)

The Note You're Voting On

mmulej at gmail dot com
4 years ago
There has been no examples with prepared statements yet.

```php
$u_name = "John Doe";
$u_email = "[email protected]";

$stmt = $connection->prepare(
"INSERT INTO users (name, email) VALUES (?, ?)"
);
$stmt->bind_param('ss', $u_name, $u_email);
$stmt->execute();

echo $stmt->insert_id;
```

For UPDATE you simply change query string and binding parameters accordingly, the rest stays the same.

Of course the table needs to have AUTOINCREMENT PRIMARY KEY.

<< Back to user notes page

To Top