Hi, is there a way to search the entire database instead of just one table? I'm using this code to search things in my database but it only works for one table. if ($_GET["action"] == "start") { $searchString = addslashes($_POST['search']); if(!empty($searchString)) { $result = mysql_query("SELECT * FROM posts WHERE content LIKE '%$searchString%'"); while($row = mysql_fetch_array($result)) { $memberId = $row['id']; $post = $row['content']; $postDate = $row['date']; print "$memberId posted this \"$post\" on $postDate <br /><br />"; } } else { echo 'Sorry nothing was found.'; } } else { echo ' <form method="post" action="?action=start" /> <input type="text" name="search" size=40 /> <input type="Submit" name="Submit" value="Search" /> </form>'; } PHP: Thank you in advance
SELECT table_name FROM information_schema.tables WHERE table_schema = 'databasename' Executing that query will give you a list of tables in the database, which you can then use to query each table.
Why on earth would you do that? It's gonna chew up so much resources on the server. I'd just have the information split up and sorted to smaller tables in the first place.