最简单的 mysql 操作手法
lizheming opened this issue · 1 comments
lizheming commented
define(DB_HOST, 'localhost');
define(DB_USER, 'root');
define(DB_PASSWORD, 'root');
define(DB_NAME, 'guestbook');
function sql_query($sqlcon){
$con=mysql_connect(DB_HOST, DB_USER,DB_PASSWORD);
mysql_select_db(DB_NAME);
mysql_query("SET NAMES 'utf8'");
$result = mysql_query($sqlcon);
mysql_close($con);
return $result;
}
sql_query("SELECT * FROM guestbook");
Losses commented
define('DB_HOST', 'localhost');
汝忘记加单引号了