Howdy,
Have done a search here and not even sure I should post it here instead of at a Perl/CGI forum but here goes....
I have embedded the following php in a .htm template.
<?php
include ("db_access.inc");
$result = mysql_query ("SELECT COUNT(*) FROM store")
or exit ();
if ($row = mysql_fetch_array ($result))
echo "Currently contains " . $row[0] . " images";
mysql_free_result ($result);
?>
db_access.inc
<?php
@mysql_pconnect ("localhost", "db_user", "password")
or exit ();
mysql_select_db ("db_name")
or exit ();
?>
I have also uploaded .htaccess with the following
AddType application/x-httpd-php .shtml .html .htm
I have even tried adding .cgi to .htaccess without success.. you can tell how much I know...
Server is running PHP 4.3.2 /Apache 1.3.28 /linux/MySQL 3.23.56
The idea is to get the php to access database, count the # of rows and dynamically display the following text and total - Currrently contains 607 images
BTW, this .htm template is called by a cgi script which also loads other dynamic info from the same database.
Problem:
I cannot get the page to display the text and count total when loaded via index.cgi.
Error
Total " . $row[0] . " images currently online."; mysql_free_result ($result); ?>
The text and count figure gets parsed/processed and displays fine when I access the .htm template by itself via browser. Changing my template extension to .php didn't help either?
Does php have to be coded differently when it's embedded in a .htm template called by a cgi script?
TIA,
-omar