标签:
1.链接数据库的报错
http://php.net/manual/zh/mysqli.connect-error.php
2.sql 注入问题
http://stackoverflow.com/questions/60174/how-can-i-prevent-sql-injection-in-php
<?php $mysqli = new mysqli("server", "username", "password", "database_name"); // TODO - Check that connection was successful. $unsafe_variable = $_POST["user-input"]; $stmt = $mysqli->prepare("INSERT INTO table (column) VALUES (?)"); // TODO check that $stmt creation succeeded // "s" means the database expects a string $stmt->bind_param("s", $unsafe_variable); $stmt->execute(); $stmt->close(); $mysqli->close(); ?>
标签:
原文地址:http://www.cnblogs.com/wz0107/p/5435867.html