[PHP] Execute PHP

Results 1 to 2 of 2
  1. #1
    Grand Master RastaLulz is offline
    Grand MasterRank
    Dec 2007 Join Date
    EarthLocation
    3,326Posts

    [PHP] Execute PHP

    Hey, I don't really know how to word this, but I'll try my best.

    I was wondering if I could execute PHP from a non PHP page, or MySQL database.

    Example 1:
    index.php
    PHP Code:
    <?php
    $hello 
    "Hey,";
    include(
    "text.html");
    ?>
    text.html
    PHP Code:
    {$helloI'm RastaLulz! 


    Result
    (example 1):
    PHP Code:
    HeyI'm RastaLulz! 
    Example 2:
    index.php
    PHP Code:
    <?php
    include("config.php");
    $name "RastaLulz";
    $id $_GET['id'];
    $query mysql_query("SELECT * FROM pages WHERE `id` = '$id'");
    $array mysql_fetch_array($query);
    $text $array['text'];
    echo 
    $text;
    ?>
    MySQL - text
    PHP Code:
    Heymy name is {$name}! 
    Result:
    PHP Code:
    Heymy name is RastaLulz
    If anyone could help me with this, it'd help a lot (if it makes any sense)!


  2. #2
    Grand Master FragFrog is offline
    Grand MasterRank
    Aug 2004 Join Date
    The NetherlandsLocation
    5,629Posts

    Re: [PHP] Execute PHP

    The template engine Smarty is designed to do exactly that :)



Advertisement