so i have a page called addpages with the following
mysql_query("INSERT INTO pages
(name, title, description, keywords, content, updated) VALUES('$name', '$title', '$description', '$keywords', '$content', '$updated' ) ")
or die(mysql_error());
// Get Last ID
$lastid = mysql_insert_id();
// Start Create php page file
$filename = "$name.php";
$template = file_get_contents("templates/default.php");
$filehandle = fopen($filename, 'w') or die("can't open file");
$add = fopen($filename, 'a') or die("can't open file");
$stringData = "data goes here...";
fwrite($filehandle, $template);
fwrite($add, $stringData);
fclose($filehandle);
// End Create php page file
when the above script has been posted a .php file will be created with the contents of templates/default.php in it, the following is the template:
<?php
include 'core/config.php';
include 'core/opendb.php';
$query = "SELECT name, title, description, keywords, content, updated ". "FROM pages ". "WHERE id = ''";
$result = mysql_query($query) or die('Error : ' . mysql_error());
list($name, $title, $description, $keywords, $content) = mysql_fetch_array($result, MYSQL_NUM);
include 'core/closedb.php';
?>
is there any way to get the $lasid from the first code into the template once its creates the page pls ?