How do I insert PHP script into existing script? Php script within script?
| From: | Carmel Entertainment) | Date: | Wed, 09 Apr 2003 19:46:14 +0000 |
| Subject: | How do I insert PHP script into existing script? Php script within script? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-143171@lists.php.net to get a copy of this message | ||
I use following script for pages to pull up their html. NOTE: yes I am still
stuck in HTML, since I have no time to delve into PHP.
Basicly if you go to page whatever.html and id of that page in the script is 1
it pulls up HTML from the database record. I did it this way so I can just edit
HTML in the database and not need to upload or download files. But now I want to
add extra features to some pages like PHP forms. What do I have to enter in my
HTML so I could insert PHP script in there and not need to redo anything with
the following script here?
<?php
$db = mysql_connect("host", "username", "password");
if( !$db )
{
die("Error connecting to the Server");
exit;
}
$result = mysql_select_db("www", $db);
if( !$result )
{
die("Error selecting Database");
exit;
}
?>
<?php
$query = "SELECT
*
FROM
html
WHERE
html.id='1'";
$result = mysql_query($query,$db);
if( !$result )
{
die("No record");
}
{
$code = mysql_result($result,$row,"code");
echo "$code";
}
mysql_free_result($result);
mysql_close();
?>