Re: How do I insert PHP script into existing script? Php script within script?
| From: | Carmel Entertainment) | Date: | Wed, 09 Apr 2003 20:09:40 +0000 |
| Subject: | Re: How do I insert PHP script into existing script? Php script within script? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-143185@lists.php.net to get a copy of this message | ||
Duh! Already did. Is that how you treat all novices here?
Again here is my problem.
Lets say I enter <?php echo $_SERVER["HTTP_USER_AGENT"]; ?> in that HTML that is
residing in that database record, once I pull up that page I get nothing in the
area of that "user agent" PHP script. Is there anything I can do so that script
within a script would work or not. If yes, could tell me how, if now, than just
say "no, you novice, you can't do that".
Quoting Chris Hayes <chayes@antenna.nl>:
> Read a manual and the first chapter will explain it to you in a much better
> and complete way than i could type here for you.
> Find manuals on www.php.net, or just like anywhere, ask Google for a php
> tutorial.
>
>
> At 21:46 9-4-2003, you wrote:
> >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();
> >?>
> >
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>