Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- table ada dibawah tolong dibuat dahulu
- */
- //======KONEKSI... pake mysqli (tolong ganti isinya sesuai kebutuhan)
- $mysqli = new mysqli("localhost", "root", "", "test");
- /* check connection */
- if (mysqli_connect_errno()) {
- printf("Connect failed: %s\n", mysqli_connect_error());
- exit();
- }
- printf("Host information: %s\n", $mysqli->host_info);
- $sql="insert into test(code) values ('".time()."')";
- $r=$mysqli->query($sql);
- if(!$r)
- {
- echo "error :".$mysqli->error;
- }else{
- echo "OK";
- }
- /* close connection */
- $mysqli->close();
- /*
- CREATE TABLE IF NOT EXISTS `test` (
- `code` int(11) NOT NULL,
- `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
- ) ENGINE=MyISAM
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement