相关疑难解决方法(0)

为什么不推荐使用PHP的mysql_函数?

在我不久前停止使用这些功能的时候,玩Devil's Advocate,但这个问题是真实的,可能对很多SO用户很重要.

我们都知道mysql_以错误的方式使用函数可能非常危险,它可能会使您的网站容易受到攻击等,但正确使用这些函数可以防止SQL注入,并且实际上比新的PDO函数一点.

考虑到这一切,为什么这些mysql_功能已被弃用?

php mysql mysqli pdo

20
推荐指数
1
解决办法
9476
查看次数

使用php自动完成TextBox

我正在使用PHP进行自动完成,但我收到以下代码的错误,所以请帮助我.

的index.php

这是我的HTML代码

<form method="POST">
    <input type="text" name="txtpname" id="txtpname" size="30" class="form-control" placeholder="Please Enter City or ZIP code">
</form>
Run Code Online (Sandbox Code Playgroud)

这是我的剧本

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script>
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" />

<script type="text/javascript">
    $(document).ready(function(){
        $("#txtpname").autocomplete({
            source:'ajax_autocomplete_party.php',
            minLength:1
        });
    });
</script>
Run Code Online (Sandbox Code Playgroud)

这是我获取数据的ajax文件.ajax_autocomplete_party.php 包括"script/db.php";

$term=$_GET["txtpname"];

 $query=mysql_query("SELECT * FROM party_details where NAME like '%".$term."%' order by NAME");
 $json=array();

while($party=mysql_fetch_array($query))
{
    $json[]=array(
        'value'=> $party["PARTY_ID"],
        'label'=>$party["NAME"]
    );
}

echo json_encode($json);
Run Code Online (Sandbox Code Playgroud)

我的页面重新加载错误时出现错误:autocomplete not defined现在该怎么办

javascript php ajax jquery autocomplete

6
推荐指数
1
解决办法
7942
查看次数

标签 统计

php ×2

ajax ×1

autocomplete ×1

javascript ×1

jquery ×1

mysql ×1

mysqli ×1

pdo ×1