Created
March 1, 2012 16:52
-
-
Save lightyoruichi/1951341 to your computer and use it in GitHub Desktop.
Show all tables in a comma separated form
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$con = mysql_connect("127.0.0.1","yourmom","pass"); // host, user, pass | |
mysql_select_db("fbfriend"); // db name | |
// Get the search variable from URL | |
$searchstring = "test" ; // or $_POST['term'] if you're using a search form | |
//get all the tables from the database test | |
$q = "show tables"; | |
$r = mysql_query($q); | |
$searchresult = array(); | |
// fetch table in array and output comma separated version | |
$a =''; | |
while ($row = mysql_fetch_array($r)) { | |
$a.= $row['0'].','; | |
} | |
$table = substr($a,0,-1); | |
echo $table; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment