zl程序教程

您现在的位置是:首页 >  数据库

当前栏目

一个用mysql_odbc和php写的serach数据库程序

2023-06-13 09:13:44 时间
<html>  

<head>  
<metahttp-equiv="Content-Type"content="text/html;charset=gb2312">  
<title>查询条件</title>  
<metaname="GENERATOR"content="MicrosoftFrontPage3.0">  
</head>  

<bodybgcolor="#fcf8c2">  

<p>查询条件</p>  

<formaction="searchyh.php"method="post">  
<tableborder="1"width="43%"height="34">  
<tr>  
<tdwidth="100%"height="28">用户名称:<inputtype="text"name="name"size="20"></td>  
<tdwidth="100%"height="28">用户地址:<inputtype="text"name="add"size="20"></td>  
<tdwidth="100%"height="28">用户电话:<inputtype="text"name="tel"size="20"></td>  
</tr>  
</table>  
<p><inputtype="submit"value="提交查询"></p>  
</form>  
</body>  
</html>  

//后台PHP  
<?php  
echo"<bodybgcolor="#fcf8c2">";  
echo"查询结果:";  
echo"
";  
echo"
";  
$conn=odbc_connect("blue","root","");  
$name.="%";  
$add.="%";  
$tel.="%";  
$query="select*";  
$query.="fromjc_yhwhere(namelike"$name"andaddresslike"$add"andtellike"$tel")";  
odbc_result_all(odbc_do($conn,$query),"border=1width=50%");  
odbc_close($conn);  
?>  

///表结构  
CREATETABLEjc_yh(  
idintnotnulldefault0,  
namevarchar(80)notnulldefault"blue",  
cityvarchar(40)notnulldefault"xn",  
telvarchar(14)notnulldefault"00000000000000",  
faxvarchar(14)notnulldefault"00000000000000",  
addressvarchar(60)notnulldefault"xn",  
postvarchar(6)notnulldefault"000000");