help - templating?
| From: | Jaxon | Date: | Fri, 19 Jan 2001 14:16:07 +0000 |
| Subject: | help - templating? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-35624@lists.php.net to get a copy of this message | ||
I think the code below is pretty simple...
Can anyone suggest ANY way to do the bit in my last comment block???
thanks in advance!
Jaxon
<?
//set some variables or include, etc.
$id=1;
$usr="user";
$pass="pass";
$database="database";
$sql="select * from table where id = $id";
//identify connection handle
$link_id = mysql_connect($database);
//test for connection handle
if (!$link_id)
{
die(sql_error());
}
else {
mysql_select_db($database, $link_id)
}
//return result set to php
$result = mysql_query($sql, $user, $pass);
//create array consisting of result set and field names
//eg $page_array[first] contain value of field 'first' for $id
$page_array = mysql_fetch_array($result);
//where field names e.g.{main_content} are found in an html layout file,
replace with result set elements
//TEMPLATE GOES HERE ?
//spit out resultant page to browser
?>