Skip to content

Instantly share code, notes, and snippets.

View mochi5o's full-sized avatar
🦕
Having fun coding!

mochizuki-m mochi5o

🦕
Having fun coding!
View GitHub Profile
@mochi5o
mochi5o / grep
Last active March 8, 2020 07:27
Linuxコマンドの練習
[vagrant 05:49:31 ~/work/example ]$ cat example.txt
test.example.net
tfst.example.net
tzst.example.net
tzzst.example.net
www.example.com
www.example.org
netapp.example.com
mail1.example.com
mail3.example.com
@mochi5o
mochi5o / search.php
Last active October 19, 2019 15:05
PHPだけでDBからの検索を実行する
<?php
include('functions.php');
$pdo = connectToDb();
$keyword = $_POST["keyword"];
if (isset($keyword)) {
// echo 'キーワード入力OK';
// 実際にはPOSTデータを直接SQLに入れるこういうやり方はしない(脆弱性の問題。詳しくは課題のコメント参照ください)
$sql = "SELECT * FROM gs_bm_table WHERE name LIKE '%" . $keyword . "%'";
$stmt = $pdo->prepare($sql);