PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php $sql = "SHOW TABLES FROM ". $mysql['base']; $result = mysql_query($sql); if(mysql_num_rows($result) > 0){ while ($row = mysql_fetch_row($result)) { $table = $row[0]; //echo $table .'<br/>'; $sql_search = "select * from `".$table."` where "; $sql_search_fields = Array(); $sql2 = "SHOW COLUMNS FROM ".$table; $rs2 = mysql_query($sql2); if(mysql_num_rows($rs2) > 0){ while($r2 = mysql_fetch_array($rs2)){ $colum = $r2[0]; $sql_search_fields[] = "`". $colum ."` like('%".$psearch."%')"; //echo $colum .'<br/>'; } } $sql_search .= implode(" OR ", $sql_search_fields); $rs3 = mysql_query($sql_search); if (mysql_num_rows($rs3) > 0) { if ($table == 'production' || $table == 'job' || $table == 'autoparts' || $table == 'technic') { $searchResult = mysql_query("SELECT * FROM `". $table ."` ORDER BY `id` DESC LIMIT ". mysql_num_rows($rs3)); echo $table .' ['. mysql_num_rows($rs3) .']<br/>'; while ($dataSearch = mysql_fetch_assoc($searchResult)) { echo $colum .'-'. $dataSearch['id'] .'<br/>'; } } } } }
Show:  
Copy Clear