- To: Peter Rundle <prundle@xxxxxxxxxxxxxx>
- Subject: Re: [SLUG] help with MySQL database to web
- From: Rocci <rocci@xxxxxxxxxxxxxxxxxxx>
- Date: Fri, 06 Aug 2004 13:23:30 +1000
- Cc: Slug <slug@xxxxxxxxxxx>
- Organization: Rock Networks
- User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040113
Peter Rundle wrote:
G'day Rocci,
I thought I'd throw in my own beginners version of a PHP/mySQL prog.
As you state that your a php beginner I thought that you may not be
aware that php can be interspersed within html. Your example could
have been written thus;
<HTML><HEAD><TITLE>House Database</TITLE></HEAD>
<BODY><H1 align=center>Listing of houses</H1>
<HR>
<!-- more content, i.e html that's "fixed" -->
<?php
$user = "username_with_access_to_the_DB/Table";
$pass = "users_password";
// more php
...
?>
<HR>
<?php
printf("Some php variable from above equals:$result\n");
?>
</BODY></HTML>
I'm not claiming this to be any more "right" than the way you've
written it but you might find this a very useful feature of php. (I've
heard that there is a perl interpreter that allows perl to be
"embedded" within html now too).
HTH
P.
Yes I was aware of this.
My choice of method was largely due to my php inexperience.
I see now though that in some circumstances it may be more appropriate
to use an html file with embedded PHP.
Thanks for bringing that to my attention Peter.
Rocci.