|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
基础这个东西,有人问学php需要任何基础不?
<?
//// filename = search.php3
<form method="post" action="result.php3">
<select name="metode" size="1">
<option value="row_name1">metode1</option>
<option value="row_name2">metode2</option>
</select>
<input type="text" name="search" size="25">
<input type="submit" value="Begin Searching!!">
</form>
?>
//// filename = result.php3
<?
$hostname = "127.0.0.1"; // Usually localhost.
$username = "username_for_mysql"; // If you have no username, leave this space empty.
$password = "your_password"; // The same applies here.
$usertable = "table_name"; // This is the table you made.
$dbName = "database_name"; // This is the main database you connect to.
MYSQL_CONNECT($hostname, $username, $password) OR DIE("Unable to connect to database");
@mysql_select_db( "$dbName") or die( "Unable to select database");
?>
<?
//error message (not found message)
$XX = "No Record Found";
$query = mysql_query("SELECT * FROM $usertable WHERE $metode LIKE '%$search%' LIMIT 0, 30 ");
while ($row = mysql_fetch_array($query))
{
$variable1=$row["row_name1"];
$variable2=$row["row_name2"];
$variable3=$row["row_name3"];
print ("this is for $variable1, and this print the variable2 end so on...");
}
//below this is the function for no record!!
if (!$variable1)
{
print ("$XX");
}
//end
?>
学会了生成静态网页,现在你应该接触一下XML了,恩,XML也了解了,那么AJAX你也得接触接触吧?AJAX完了....然后... |
|