我希望能够在自动对焦上进行输入,但是当我这样说时:
<input type="text" autofocus="focus">
Run Code Online (Sandbox Code Playgroud)
它不起作用?
为什么是这样?
请在我的网站上查看这个模拟搜索:
链接已过期
搜索没有返回任何结果,也没有显示错误消息,为什么会这样?
我已经取出了我的人员信息,即.主机/用户名/密码
HTML:
<h2>Search</h2>
<form name="search" method="post" action="<?=$PHP_SELF?>">
Seach for: <input type="text" name="find" /> in
<Select NAME="field">
<Option VALUE="fname">First Name</option>
<Option VALUE="lname">Last Name</option>
<Option VALUE="info">Profile</option>
</Select>
<input type="hidden" name="searching" value="yes" />
<input type="submit" name="search" value="Search" />
</form>
Run Code Online (Sandbox Code Playgroud)
PHP:
<?php
//This is only displayed if they have submitted the form
if ($searching =="yes")
{
echo "<h2>Results</h2><p>";
//If they did not enter a search term we give them an error
if ($find == "")
{
echo "<p>You forgot to enter …Run Code Online (Sandbox Code Playgroud) 我一直得到相同的mysql错误代码,但我不知道如何纠正它.
错误:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /websites/123reg/LinuxPackage22/we/ez/y_/weezy.co.uk/public_html/search.php on line 29
Run Code Online (Sandbox Code Playgroud)
我在下面的代码中标出了第29行.
这是什么意思?
谢谢
<?php
// Change the fields below as per the requirements
$db_host="";
$db_username="";
$db_password="";
$db_name="";
$db_tb_name="data";
$db_tb_atr_name="name";
$db_tb_atr_name="email";
$db_tb_atr_name="location";
//Now we are going to write a script that will do search task
// leave the below fields as it is except while loop, which will display results on screen
mysql_connect("$db_host","$db_username","$db_password");
mysql_select_db("$db_name");
$query=mysql_real_escape_string($_GET['query']);
$query_for_result=mysql_query("
SELECT name, email, location
FROM data WHERE …Run Code Online (Sandbox Code Playgroud)