国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > PHP > 正文

簡單的數據庫搜索功能

2024-05-04 23:02:06
字體:
來源:轉載
供稿:網友
中國最大的web開發資源網站及技術社區,

 

<?

//// 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
?>

 

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 彭山县| 西丰县| 定西市| 达日县| 广昌县| 汝阳县| 德安县| 香格里拉县| 湛江市| 鄄城县| 青海省| 长海县| 龙海市| 上杭县| 永嘉县| 穆棱市| 鄂尔多斯市| 滨州市| 普兰店市| 高雄市| 淮南市| 临桂县| 伊川县| 陇川县| 西乡县| 瑞昌市| 宁乡县| 鸡泽县| 遂昌县| 武川县| 昂仁县| 仁化县| 新蔡县| 漳州市| 柏乡县| 长乐市| 江都市| 东宁县| 苏尼特右旗| 施甸县| 洪湖市|