----- Original Message ----- 
From: "Steve Jackson" <[EMAIL PROTECTED]>
Sent: Monday, July 07, 2003 1:34 PM
Subject: [PHP] How to insert a variable into a PHP template.

> Hi,
> I want to write a PHP template with a variable number of the last
> recordset in a MySQL DB being the number referenced in the file. This is
> so my file can be saved as a PHP page looking at the right content in a
> database for a content management system. I am stuck on the way to do
> it. The code below is the part I want to change:
> So I need to do two things:
> 1) Select the last record in a database table.


> 2) get PHP to write all the code below on the fly.
> ////////////////////////
>   db_connect();
> // This is the query number which needs to be changed and written every
> time as the last record in the DB
>   $query = "select * from crm_content where PageID='1'";
>   $result = mysql_query($query) or die("Error: Query failure
> with<BR>$query<BR>".mysql_error());
>   while ($array = mysql_fetch_array($result))
>   {
>   $PageTitle = "{$array["Title"]}";
>   $BodyText = "{$array["BodyText"]}";
>   $Picture1 = "{$array["PictureOne"]}";
>   $Picture2 = "{$array["PictureTwo"]}";
>   $CatID = "{$array["CatID"]}";
>   }
> // then write the function to call the page here
> //////////////////////
> Any ideas thoughts or help much appreciated.

Can't help with this bit.  Apart from putting it into a string and then
writing it to a file.


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to