May 7, 201214 yr I am using php to show the tables in my database as part of a project. I will probably have more than one question, but for now i would like help on why my php to show the results of "show tables" isn't working. It says Resource id #3Resource id #3Resource id #3Resource id #3 on the page. Please and thank you. Here's the php <?php /* //Shows tables in plastronics. $query = "show tables"; //Execute it, or return the error message if there's a problem. $result = mysql_query($query) or die(mysql_error()); */ $sql = "show tables"; $result = mysql_query($sql); while($tables = mysql_fetch_assoc($result)) echo $result; ?> Edited May 7, 201214 yr by wolf125
May 12, 201214 yr I always thought the syntax was "SHOW TABLES FROM `database_name`;" Anyway, you just keep echoing the resource, you need to do something like... $result = mysql_query($sql); while($table = mysql_fetch_row($result)) { echo $table[0]; }
Create an account or sign in to comment