PHPʵÀý£ºÓÃPHP¼òµ¥ÊµÏÖ¶àÌõ¼þ²éѯ
ÔÚÎÒÃǵÄÍøÕ¾Éè¼Æ¹ý³ÌÖУ¬¾³£»áÓõ½¶àÌõ¼þ²éѯ£¬±¾ÎĵÄÔ´ÂëÊÇÒ»¸ö¶þÊÖ·¿ÎݲéѯµÄÀý×Ó¡£ÔÚ±¾ÀýÖУ¬ÎÒÃÇҪʵÏÖÄܹ»Í¨¹ýµØÀíλÖã¬ÎïÒµÀàÐÍ£¬·¿Îݼ۸ñ£¬·¿ÎÝÃæ»ý¼°ÐÅÏ¢·¢²¼ÈÕÆڵȶà¸öÌõ¼þ²éѯµ½¿Í»§ËùÐèµÄ×ÊÁÏ¡£
²éѯÎļþ£¨search.php£©
Ò»¡¢Éú³É²éѯÓï¾ä£º
ÒÔÏÂΪÒýÓõÄÄÚÈÝ£º
<?
$conn=mysql_connect("localhost","root","");
$db=mysql_select_db("lingyun");
$query="select * from message where tradetype='".$tradetype."'"; //½»Ò×ÀàÐÍ£¬Èç³ö×⣬³öÊÛ
$SQL=$SQL . "wuye='" . $wuye . "'";
if($housetype!="²»ÏÞ"){
$query.=" && housetype='".$housetype."'"; //·¿ÎÝÀàÐÍ£¬Èç¶þÊÒÒ»Ìü£¬ÈýÊÒ¶þÌü
}
if($degree!="²»ÏÞ"){
$query.=" && degree='".$degree."'"; //оɳ̶È
}
if($wuye!="²»ÏÞ"){
$query.=" && wuye='".$wuye."'"; //ÎïÒµÀàÐÍ Èçס·¿£¬ÉÌÆÌ
}
if($price2!=""){
switch($price1){
case "´óÓÚ":
$query.=" && price>'".$price2."'"; //¼Û¸ñ
break;
case "µÈÓÚ":
$query.=" && price='".$price2."'";
break;
case "СÓÚ":
$query.=" && price<'".$price2."'";
break;
}
}
if($area2!=""){
switch($area1){
case "´óÓÚ":
$query.=" && area>'".$area2."'"; //Ãæ»ý
break;
case "µÈÓÚ":
$query.=" && area='".$area2."'";
break;
case "СÓÚ":
$query.=" && area<'".$area2."'";
break;
}
}
switch($pubdate){ //·¢²¼ÈÕÆÚ
case "±¾ÐÇÆÚÄÚ":
$query.=" && TO_DAYS(NOW()) - TO_DAYS(date)<=7";
break;
case "Ò»¸öÔÂÄÚ":
$query.=" && TO_DAYS(NOW()) - TO_DAYS(date)<=30";
break;
case "Èý¸öÔÂÄÚ":
$query.=" && TO_DAYS(NOW()) - TO_DAYS(date)<=91";
break;
case "Áù¸öÔÂÄÚ":
$query.=" && TO_DAYS(NOW()) - TO_DAYS(date)<=183";
break;
}
if($address!=""){
$query.=" && address like '%$address%'"; //µØÖ·
}
if(!$page){
$page=1;
}
?>
¶þ¡¢Êä³ö²éѯ½á¹û£º
ÒÔÏÂΪÒýÓõÄÄÚÈÝ£º
<?php
if ($page){
$page_size=20;
$result=mysql_query($query);
#$message_count=mysql_result($result,0,"total");
$message_count=10;
$page_
Ïà¹ØÎĵµ£º
1.PHPÀúÊ·
a.1995ÄêÓÉLerdorf´´½¨£¬µ±Ê±ËûÊÇΪÁË´´½¨Ò»¸ö·ÃÎʼÆËãÆ÷
b.1997Äê11Ô·¢ÐÐPHP 2.0£¬³ÆΪPHP-FI£¨¸öÈËÖ÷Ò³-±íµ¥½âÊÍÆ÷£©
c.1998Äê6Ô·¢ÐÐPHP3.0£¬Ãû³ÆÓÉPersonal Home Page ±ä³É HyperText Preprocessor(³¬Îı¾Ô¤´¦ÀíÆ÷)
d.2000Äê5ÔÂPHP4·¢²¼
e.PHP5·¢²¼
2.php4,php5ÌØÐÔ
3 ......
¡¾PHPϵÁн̡̳¿ÊǸù¾ÝÏÖÓС¶PHP Manual¡·½øÐÐÊÕ¼¯ºÍÕûÀíËùµÃ£¬ËùÓдúÂ붼ÒѾ²âÊÔͨ¹ý¡£ÔÚתÔعý³ÌÖУ¬Çë×¢Ã÷³ö´¦¡£
Ò»¡¢Ô¤±¸ÖªÊ¶£ºPHP»·¾³µÄ´î½¨
»·¾³µÄ´î½¨ÔÚÇ°ÃæÒѾ¸ø³öÁËÏêϸµÄ˵Ã÷£¬ÍøַΪ£ºhttp://blog.csdn.net/rocket5725/archive/2009/12/28/5090489.aspx¡£
¶þ¡¢µÚÒ»¸öPHPÒ³Ãæ
ÔÚWEB·þÎñÆ÷¸ùĿ¼ÏÂD:\Progra ......
Output Control º¯Êý¿ÉÒÔÈÃÄã×ÔÓÉ¿ØÖƽű¾ÖÐÊý¾ÝµÄÊä³ö¡£Ëü·Ç³£µØÓÐÓã¬ÌرðÊǶÔÓÚ£ºµ±ÄãÏëÔÚÊý¾ÝÒѾÊä³öºó£¬ÔÙÊä³öÎļþÍ·µÄÇé¿ö¡£Êä³ö¿ØÖƺ¯Êý²»¶ÔʹÓà header() »ò setcookie(), ·¢Ë͵ÄÎļþÍ·ÐÅÏ¢²úÉúÓ°Ïì,Ö»¶ÔÄÇЩÀàËÆÓÚ echo() ºÍ PHP ´úÂëµÄÊý¾Ý¿éÓÐ×÷Óá£
ÎÒÃÇÏȾÙÒ»¸ö¼òµ¥µÄÀý×Ó£¬Èôó¼Ò¶ÔOutput ControlÓÐÒ»¸ö´ ......
PHP³ÌÐòÔ±×îÒ×·¸10ÖÖ´íÎó
PHPÊǸöΰ´óµÄweb¿ª·¢ÓïÑÔ£¬Áé»îµÄÓïÑÔ£¬µ«ÊÇ¿´µ½php³ÌÐòÔ±Öܶø¸´Ê¼µÄ·¸µÄһЩ´íÎó¡£ÎÒ×öÁËÏÂÃæÕâ¸öÁÐ±í£¬ÁгöÁËPHP³ÌÐòÔ±¾³£·¸µÄ10ÖдíÎ󣬴ó¶àÊýºÍ°²È«Ïà¹Ø¡£¿´¿´Äã·¸Á˼¸ÖÖ
1.²»×ªÒâhtml entities
Ò»¸ö»ù±¾µÄ³£Ê¶£ºËùÓв»¿ÉÐÅÈεÄÊäÈ루ÌرðÊÇÓû§´ÓformÖÐÌá½ ......