ugurpc;10952509 wrote:do i need to make many echo's like above everytime.?
Well, since you didn't include any line breaks, you could technically reduce all of that code down to 1 echo statement:
echo "<table cellpadding=2 cellspacing=2 width=100%><tr> </tr><tr><th bgcolor=#FFCC00 width=250px>id</th><td bgcolor=#FEE9A9>" . $row[0] . "</td></tr><tr><tr><tr><th bgcolor=#FFCC00>pass</th><td bgcolor=#FEE9A9>" . $row[2] . "</td></tr><tr><th bgcolor=#FFCC00>maxdownload</th><td bgcolor=#FEE9A9>" . $row[3] ."</td></tr><tr><th bgcolor=#FFCC00>remarks</th><td bgcolor=#FEE9A9>" . $row[4] . "</td></tr>";
though that doesn't look very pretty.
You could also escape out of PHP mode for the HTML, e.g.
<?php
if($foo) { ?>
<p>This is some HTML</p>
<p>This is a variable: <?php echo $var; ?>!</p>
<?php
}
?>
though I still think that looks like a soupy mess of HTML and PHP mixed together.
You can also just use a single echo statement and include the line breaks, e.g.
echo "This is a long echo statement.
You can include variables ($var) since the string is delimited by double quotes.
This is the end of the long echo statement.";
Other than that, I'm not sure what you're asking. Is there a magic loop_through_database_and_output_the_data_using_HTML_tables() function built into PHP to simplify your code? No. Even if there were, I sure hope it wouldn't output invalid HTML markup as you have used! :p