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="WOR01";}
- $xtpl=new XTemplate ("listview.html");
- $conn = phpmkr_db_connect(HOST, USER, PASS, DB, PORT);
- $sSql ="select * from accdelt 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.= "`WOR01` LIKE '%" . $sKeyword . "%' OR ";
- $BasicSearchSQL.= "`WOR02` LIKE '%" . $sKeyword . "%' OR ";
- $BasicSearchSQL.= "`WOR03` LIKE '%" . $sKeyword . "%' OR ";
- $BasicSearchSQL.= "`WOR04` LIKE '%" . $sKeyword . "%' OR ";
- $BasicSearchSQL.= "`WOR05` LIKE '%" . $sKeyword . "%' OR ";
- $BasicSearchSQL.= "`WOR06` LIKE '%" . $sKeyword . "%' OR ";
- $BasicSearchSQL.= "`WOR07` LIKE '%" . $sKeyword . "%' OR ";
- $BasicSearchSQL.= "`WOR08` LIKE '%" . $sKeyword . "%' OR ";
- $BasicSearchSQL.= "`WOR09` LIKE '%" . $sKeyword . "%' OR ";
- $BasicSearchSQL.= "`WOR10` LIKE '%" . $sKeyword . "%' OR ";
- if (substr($BasicSearchSQL, -4) == " OR ") { $BasicSearchSQL = substr($BasicSearchSQL, 0, strlen($BasicSearchSQL)-4); }
- return $BasicSearchSQL;
- }
- ?>