LoginSignup
0
0

More than 3 years have passed since last update.

webarenaでubuntu その22

Posted at

概要

webarenaでubuntu18.04やってみた。
mysql5.7やってみた。
crudやってみた。

Create

<?php
    $db = new PDO("mysql:host=localhost;dbname=mydb;", 'arena', 'pass');
    $sql = 'insert into test values(null, "name", 20, now())';
    $res = $db->query($sql);
    if ($res) print "ok\n";
?>

Read

<?php
    $db = new PDO("mysql:host=localhost;dbname=mydb;", 'arena', 'pass');
    $sql = 'select * from test';
    $res = $db->query($sql);
    if ($res) print "ok\n";
?>

Update

<?php
    $db = new PDO("mysql:host=localhost;dbname=mydb;", 'arena', 'pass');
    $sql = 'update test set age=80 where id=1';
    $res = $db->query($sql);
    if ($res) print "ok\n";
?>

Delete

<?php
    $db = new PDO("mysql:host=localhost;dbname=mydb;", 'arena', 'pass');
    $sql = 'delete from test where id=1';
    $res = $db->query($sql);
    if ($res) print "ok\n";
?>

以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0