본문 바로가기

스크립트/Php 코드 팁

미국 유명한 개발자가 만든 클래스 입니다.



# Using the default constructor...
$db = new MySQL('localhost', 'root', null, 'database');

# Or the connect method.
$db = new MySQL();
$db->connect('localhost', 'root', null, 'database');

# If you want to select a different database, you can:
$db->select_db('new_databaseName');

# Querying the database... Just a random SELECT.
$result = $db->query('SELECT * FROM `the_table`');

# Or maybe one with a variable..?
$result = $db->query("SELECT * FROM `the_table` WHERE colName = '". $db->escape($_GET['someVar']). "'");