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/>'; $nodata = 1; $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); $totalLimitRs3 = mysql_num_rows($rs3); if ($totalLimitRs3 > 0) { $nodata = 0; if ($table == 'production' || $table == 'job' || $table == 'autoparts' || $table == 'technic') { $searchResult = mysql_query($sql_search ." limit ". $totalLimitRs3); //echo $sql_search ." limit 5" .'<br/>'; if ($table == 'production') { $tableTitle = 'Работа'; } if ($table == 'job') { $tableTitle = 'Вакансии'; } if ($table == 'autoparts') { $tableTitle = 'Автозапчасти'; } if ($table == 'technic') { $tableTitle = 'Техника'; } echo $tableTitle .' ['. $totalLimitRs3 .']<br/>'; $newsData = array(); while ($dataSearch = mysql_fetch_array($searchResult, MYSQL_ASSOC)) { $newsData[] = $dataSearch; } foreach ($newsData as $oneNews) : if (isset($oneNews["title"])) echo $oneNews["title"] .'<br/>'; if (isset($oneNews["loading"])) echo $oneNews["loading"] .'<br/>'; endforeach; } /*} else { ?> <div class="col-md-4"></div> <div class="col-md-4"> <div class="destination"> <div class="intro ftco-animate"> <div class="text p-3"> Нет записей! </div> </div> </div> </div> <? //exit(); */ } } if ($nodata == 1) { ?> <div class="col-md-4"></div> <div class="col-md-4"> <div class="destination"> <div class="intro ftco-animate"> <div class="text p-3"> Нет записей! </div> </div> </div> </div> <? //exit(); }
Show:  
Copy Clear