Location: PHPKode > scripts > phpMyAccess > phpmyaccess-1.5.3/phpmyaccess/mysqltest.php

// this little test program will let you know what your database looks like, kinda.
// your dbaccess.php file must be filled and pesent.
echo "<html><body>";
include 'dbaccess.php';

// database connection
$dbl = mysql_connect($opt['hn'],$opt['un'],$opt['pw'])
  or die ('<h1>Could not connect to MySQL</h1>'."\n");
if (!isset($opt['db'])) { die ("<h1>No Database defined</h1>\n</body>\n</html>\n"); }
if (!isset($opt['tb'])) { die ("<h1>No Table defined</h1>\n</body>\n</html>\n"); }

$fds = mysql_list_fields($opt['db'], $opt['tb'], $dbl);
$num_fds = mysql_num_fields($fds);
for ($k=0 ; $k<$num_fds; $k++) {
   $name = mysql_field_name($fds,$k);
   $type = mysql_field_type($fds,$k);
   $flags = mysql_field_flags($fds,$k);
   $length = mysql_field_len($fds,$k);
   echo "$name  $type  $length  $flags<br/>\n";

echo "</body></html>";
Return current item: phpMyAccess