Skip to content

Instantly share code, notes, and snippets.

@lightyoruichi
Created March 1, 2012 16:52
Show Gist options
  • Save lightyoruichi/1951341 to your computer and use it in GitHub Desktop.
Save lightyoruichi/1951341 to your computer and use it in GitHub Desktop.
Show all tables in a comma separated form
<?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