Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualDareDeveloper

Posted 06 July 2013 - 03:12 AM

 

First here is the code:

...
            echo '<tr>
                    <td>'.$tablerows[0].'</td>
                    <td>'.$structurerows['Field'].'</td>
                    <td>'.$structurerows['Type'].'</td>
                    <td>'.$row[$tablerows['Field']].'</td>
                </tr>';
...

The issue I am having is I am not displaying any of the values from the table, all other information is displaying fine, anyone have any ideas.

 

Could it be that I cannot use a variable to locate an array point?

 

 

Any help is greatly appreciated

 

BASICFreak

 

 

Shouldn't it be:

<td>'.$row[$structurerows['Field']].'</td>

?

 

$tablerows just holds the Table names if I understand the code correctly!?


#1DareDeveloper

Posted 06 July 2013 - 03:09 AM

 

First here is the code:

<?php
require './includes/config.ini.php';
?>
<html>
    <head>
        <title>Database Structure</title>
    </head>
    <body bgcolor="#FFFFFF" text="#000000">
        <center><h1><?PHP echo $database; ?></h1>
            <table border="1" cellspacing="0" width="820">
                <tr>
                    <td width="175">Table</td>
                    <td width="175">Field</td>
                    <td width="175">Field Type</td>
                    <td width="290">Value</td>
                </tr>
        
<?PHP
mysql_connect($server, $username, $password) or die(mysql_error());
mysql_select_db($database) or die(mysql_error());


$tableresults = mysql_query("SHOW TABLES");
while ( $tablerows = mysql_fetch_array($tableresults) )
{
    $structureresults = mysql_query("DESCRIBE ".$tablerows[0]);
    while ( $structurerows = mysql_fetch_array($structureresults) )
    {
        $result = mysql_query("SELECT * FROM ".$tablerows[0]);
        while ( $row = mysql_fetch_array($result) )
        {
            echo '<tr>
                    <td>'.$tablerows[0].'</td>
                    <td>'.$structurerows['Field'].'</td>
                    <td>'.$structurerows['Type'].'</td>
                    <td>'.$row[$tablerows['Field']].'</td>
                </tr>';
        }
    }
}
?>
            </table>
        </center>
    </body>
</html>

The issue I am having is I am not displaying any of the values from the table, all other information is displaying fine, anyone have any ideas.

 

Could it be that I cannot use a variable to locate an array point?

 

 

Any help is greatly appreciated

 

BASICFreak

 

 

Shouldn't it be:

<td>'.$row[$structurerows['Field']].'</td>

?

 

$tablerows just holds the Table names if I understand the code correctly!?


PARTNERS