Zitat:
Zitat von wwwwww
weiß zufällig jemand, ob man mit while, if , for usw auch direkt in variablen schreiben kann und wie sowas ungefähr aussehen würde.
|
Ja klar kann man das.
Zitat:
ich mein ungefähr und natürlich theoretisch so:
PHP-Code:
$ergebnis=while(dsatz=mysql_fetch_assoc($res)){
echo"<td>".$dsatz['name']."</td>"
usw.
};
{
|
Da das syntaktisch falsch ist, beginnt jetzt das große Rätselraten, was Du möchtest.
Eventuell suchst Du das:
PHP-Code:
define('NL', "\n");
$sql = 'SELECT feld1, feld2, feld3 FROM tabelle WHERE dies = das';
$res = mysql_query($sql) OR die(mysql_error());
$text = '<table>' . NL;
while($dsatz = mysql_fetch_assoc($res))
{
$text .= '<tr>' . NL;
foreach ($dsatz AS $name => $wert)
{
$text .= '<td>' . $name . '</td>' . '<td>' . $wert . '</td>' . NL;
}
$text .= '</tr>' . NL;
}
$text .= '</table>' . NL;
# irgend was
echo $text;
# was anderes