87dave87 Posted February 14, 2007 Share Posted February 14, 2007 $query1 = mysql_query('show tables'); $search_query = "select emulator, version, os, platform, details from "$query1" where emulator LIKE '%".mysql_real_escape_string($_POST["emusearch"])."%' OR platform LIKE '%".mysql_real_escape_string($_POST["emusearch"])."%' order by platform asc, emulator asc"; Im trying to show all tables in 'query1': - Parse error: syntax error, unexpected T_VARIABLE in /home/irrm3a/public_html/search.php on line 5 Quote Link to comment Share on other sites More sharing options...
r-it Posted February 14, 2007 Share Posted February 14, 2007 you are not giving enough information, but from what i have gathered so far is your search query string. $search_query = "select emulator, version, os, platform, details from '$query1' where emulator LIKE %'".mysql_real_escape_string($_POST["emusearch"])."'% OR platform LIKE %'".mysql_real_escape_string($_POST["emusearch"])."'% order by platform asc, emulator asc"; and show tables should be something like this if its a variable mysql_query($show_tables); Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted February 14, 2007 Share Posted February 14, 2007 why have you taken the % signs out of the single quotes? He go that bit correct!!!! the problem is here from '$query1' ... switch that to ' from `$query1` ' or just ' from $query1 ' Quote Link to comment Share on other sites More sharing options...
87dave87 Posted February 14, 2007 Author Share Posted February 14, 2007 toonmariner ive tried to do that, then i get this error: - Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/irrm3a/public_html/search.php on line 15 This is the full code: - <? include($_SERVER['DOCUMENT_ROOT'] . '/includes/head.php'); include($_SERVER['DOCUMENT_ROOT'] . '/includes/dbconnect.php'); $query1 = mysql_query('show tables'); $search_query = "select emulator, version, os, platform, details from '$query1' where emulator LIKE '%".mysql_real_escape_string($_POST["emusearch"])."%' OR platform LIKE '%".mysql_real_escape_string($_POST["emusearch"])."%' order by platform asc, emulator asc"; if (empty($_POST['emusearch'])) { echo "<meta http-equiv='refresh' content='0; URL=/noresults.php'>"; exit(); } else { $search = mysql_query($search_query); $num_rows = mysql_num_rows($search); if($num_rows < 1) { echo "<meta http-equiv='refresh' content='0; URL=/noresults.php'>"; exit(); } } ?> Quote Link to comment Share on other sites More sharing options...
r-it Posted February 14, 2007 Share Posted February 14, 2007 $query1 = mysql_query('show tables'); Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted February 14, 2007 Share Posted February 14, 2007 sorry was looking in the second query string... The ' from $query1 ' will fail because $query1 is a result resource - you must have a string in there (that is a table name), show tables will return a list of all the tables so you have to pick which one you want and set $qruery1 to that value. Quote Link to comment Share on other sites More sharing options...
87dave87 Posted February 14, 2007 Author Share Posted February 14, 2007 I want all the tables in the database... as I want to search every table for specific information, how can I do that? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.