RE: [PHP] How to insert a variable into a PHP template.
| From: | Steve Jackson | Date: | Mon, 07 Jul 2003 13:16:40 +0000 |
| Subject: | RE: [PHP] How to insert a variable into a PHP template. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-154188@lists.php.net to get a copy of this message | ||
mysql_insert_id();
How would I call that in my query? Because I tried that and I get
resource ID=2
Also putting it into a string and writing it to a file, sounds good to
me, that's what I was thinking but how do you do it? Can it just be
written as:
$string ="all my code including ";''=}{[] etc";
And then calling the string with fwrite? Or am I going to run into
serious problems?
Steve Jackson
Web Development and Marketing Manager
Viola Systems Ltd.
http://www.violasystems.com
stephen.jackson@violasystems.com
Mobile +358 50 343 5159
> -----Original Message-----
> From: Andrew McCombe [mailto:andrew@euperia.com]
> Sent: 7. heinäkuuta 2003 16:05
> To: php-general@lists.php.net; Steve Jackson
> Subject: Re: [PHP] How to insert a variable into a PHP template.
>
>
>
> ----- Original Message -----
> From: "Steve Jackson" <stephen.jackson@violasystems.com>
> To: "PHP General" <php-general@lists.php.net>
> 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.
>
>
> mysql_insert_id();
>
>
>
> > 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.
>
> Regards
> Andrew
>
>