Hallo,
Ich habe in einer Konstante
DB_NAME definiert wie meine Datenbank heisst, nämlich
testdb.
Wie kann ich nun auf den Inhalt der Konstanten zugreifen bei folgenden Argumenten:
Code Zeile 6: <p align=\"center\">$row->Tables_in_
testdb</p>
Code Zeile 17: $result = mysql_query("SHOW COLUMNS FROM $row->Tables_in_
testdb");
Ich hab schon alles Mögliche ausprobiert aber nichts will funktionieren!
z.B.: $row->Tables_in_".DB_NAME."
Der gesamte Code sieht so aus:
PHP-Code:
$tables = mysql_query("SHOW TABLES FROM ".DB_NAME."", $SQLconn);
while($row = mysql_fetch_object($tables))
{
echo("<div align=\"center\">
<p align=\"center\">$row->Tables_in_testdb</p>
<table width=\"800\" style=\"border-collapse: collapse\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\">
<tr bgcolor=\"#8B93A3\">
<td width=\"100\"> Feld</td>
<td width=\"100\"> Typ</td>
<td width=\"100\"> Null</td>
<td width=\"100\">Indizes</td>
<td width=\"100\">Standard</td>
<td width=\"100\">Extra</td>
</tr>");
$result = mysql_query("SHOW COLUMNS FROM $row->Tables_in_testdb");
while($row = mysql_fetch_object($result))
{
if(ereg(('set|enum'), $row->Type)){
eval(ereg_replace('set|enum', '$'.$row->Field.' = array', $row->Type).';');
}
echo("<tr>
<td width=\"100\">$row->Field</td>
<td width=\"100\">$row->Type</td>
<td width=\"100\">$row->Null</td>
<td width=\"100\">$row->Key</td>
<td width=\"100\">$row->Default</td>
<td width=\"100\">$row->Extra</td>
</tr>");
}
mysql_free_result($result);
echo("</table>
</div>");
}
mysql_free_result($tables);
Vielen Dank im Voraus!