码迷,mamicode.com
首页 > Web开发 > 详细

php标签项目记录

时间:2016-04-26 18:59:09      阅读:123      评论:0      收藏:0      [点我收藏+]

标签:

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();
?>

  

php标签项目记录

标签:

原文地址:http://www.cnblogs.com/wz0107/p/5435867.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!