I'd like to try to use an output template. If I have this code:


include 'admin/config.php'; // database variables

$db = mysql_connect( $db_host, $db_user, $db_pass ); # or die "Could not make connection to database server\n";

mysql_select_db($db_name);

$result = mysql_query("SELECT * FROM cb_urls");
$count = mysql_num_rows($result) or die( mysql_error() );;


This html template file:

main.html

How do I print the output using the template. Replace {COUNT} with the output?

    Possibly a number of ways you could do this.

    One would be to read the HTML file into PHP with fread() or file(), use str_replace to replace {COUNT} with your $variable, and then echo the file to the browser...

      Write a Reply...