1.用mysqli方式:
//创建数据库之类的
$db=@mysqli_connect('localhost', 'root', 'root','数据库名') or @mysqli_connect('localhost', 'root', '123456','数据库名');
$sql="INSERT INTO weibo (content, time, acc, ref) VALUES('{$content}', {$time}, 0, 0)";
if(mysqli_query($db,$sql)){
echo "1111"; die;
}else{
echo "Error: " . $sql . "" . mysqli_error($db);die; //测试发送sql问题排查问题
}
2.PDO 连接方式
$dsn ="mysql:host=119.23.229.126;dbname=test数据库;charset=utf8";
$pdo =new PDO($dsn,'root','root');
$sql="select member_name,member_truename,member_mobile,member_email,member_passwd,member_paypwd,member_sex,available_predeposit,freeze_predeposit,white_points,red_points,member_status,member_agent_status,inviter_id from club_member";
//$result=$pdo->exec($sql);
$mm=$pdo->query($sql);
$result =$mm->fetchAll();