find.php
资源名称:minierp.rar [点击查看]
上传用户:yantgcom
上传日期:2013-07-19
资源大小:478k
文件大小:2k
源码类别:
MySQL数据库
开发平台:
PHP
- <?php
- include ("../inc/db.php");
- include ("../inc/phpmkrfn.php");
- include ('../inc/xtpl.php');
- $t_find=$_GET['x_find'];
- if (empty($t_ORDER)){$t_ORDER="JHMID";}
- $xtpl=new XTemplate ("listview.html");
- $conn = phpmkr_db_connect(HOST, USER, PASS, DB, PORT);
- $sSql ="select * from accounts where ".BasicSearchSQL($t_find);
- $rs = phpmkr_query($sSql,$conn) or die("Failed to execute query: " . phpmkr_error() . '<br>SQL: ' . $sSql);
- while ($row = mysql_fetch_array($rs, MYSQL_ASSOC)) {
- $xtpl->assign("DATA",$row); /* assign array data */
- $xtpl->parse("main.table.row"); /* parse a row */
- }
- $xtpl->parse("main.table"); /* parse the table */
- $xtpl->parse("main");
- $xtpl->out("main");
- function BasicSearchSQL($Keyword)
- {
- $sKeyword = (!get_magic_quotes_gpc()) ? addslashes($Keyword) : $Keyword;
- $BasicSearchSQL = "";
- $BasicSearchSQL.= "`ID` LIKE '%" . $sKeyword . "%' OR ";
- $BasicSearchSQL.= "`ACC01` LIKE '%" . $sKeyword . "%' OR ";
- $BasicSearchSQL.= "`ACC02` LIKE '%" . $sKeyword . "%' OR ";
- $BasicSearchSQL.= "`ACC03` LIKE '%" . $sKeyword . "%' OR ";
- $BasicSearchSQL.= "`ACC03A` LIKE '%" . $sKeyword . "%' OR ";
- $BasicSearchSQL.= "`ACC04` LIKE '%" . $sKeyword . "%' OR ";
- $BasicSearchSQL.= "`ACC04A` LIKE '%" . $sKeyword . "%' OR ";
- $BasicSearchSQL.= "`ACC05` LIKE '%" . $sKeyword . "%' OR ";
- $BasicSearchSQL.= "`ACC08A` LIKE '%" . $sKeyword . "%' OR ";
- $BasicSearchSQL.= "`ACC08` LIKE '%" . $sKeyword . "%' OR ";
- $BasicSearchSQL.= "`ACC09` LIKE '%" . $sKeyword . "%' OR ";
- $BasicSearchSQL.= "`ACC10` LIKE '%" . $sKeyword . "%' OR ";
- $BasicSearchSQL.= "`ACC11` LIKE '%" . $sKeyword . "%' OR ";
- $BasicSearchSQL.= "`ACC12` LIKE '%" . $sKeyword . "%' OR ";
- if (substr($BasicSearchSQL, -4) == " OR ") { $BasicSearchSQL = substr($BasicSearchSQL, 0, strlen($BasicSearchSQL)-4); }
- return $BasicSearchSQL;
- }
- ?>