Hi, im trying to make a small MySQL manager in php, i've managed to list tables and everything but i can't seem to get the columns / fields right, i mean i can list them. but if i try to list the value in the same while loop it all turns to crap could anyone help me please?
this is what i've got so far:
Code:
$table = $_GET['t'];
$mpass = $_SESSION['mpass'];
$muser = $_SESSION['muser'];
$mhost = $_SESSION['mhost'];
$mport = $_SESSION['mport'];
$mdb = $_SESSION['mdb'];
$m = mysql_connect($mhost, $muser, $mpass);
if($mport == 3306){
$con = mysql_connect($mhost, $muser, $mpass);
}
else{
$con = mysql_connect($mhost.":".$mport, $muser, $mpass);
}
mysql_select_db($mdb, $m);
echo "<center><b><font color=\"#0F9B6F\">MySQL Manager<br>Columns Of ".$mdb." </font></b></center><br>";
$fds = mysql_query("SHOW FIELDS FROM ".$table);
//$chmongurl = 1;
$cls = mysql_query("SELECT * FROM ".$table);//." WHERE id = ".$chmongurl
echo '<center><table border="1">';
$sup = 0;
while (($fields = mysql_fetch_row($fds)) && ($columns = mysql_fetch_row($cls))){
//if ($columns = mysql_fetch_row($cls)){
if(!$columns[$sup]){$xXcXx = "Empty";} else {$xXcXx = $columns[$sup];}
echo '<tr><td><center><b><font color="#68ad52"> '.$fields[0].' </font></b></center></td><td><center><b><font color="#98da26"> '.$columns[$sup].' </font></b></center></td></tr>';
//}
$sup++;
}
echo '</tr>';
echo '</table></center>';
kind of unserious programming, but its only for my self for now anyways :P
And the big problem, it takes the value from the one in the row below and that, it takes the right column but just the row under :/ every value moves down a row :s
Sry if my english sucks xD
--Edit, this is how it looks like right now: (this is a screenshot of the tables, not the columns since its not working anyways..)