Thank you so much for your expertise and time. I am very willing to learn though a bit overwhelmed. Here is an example (chopped down and now messy) of what my html looks like and what I am attempting to feed the data into. There are a number of items named 'pattern' and I am trying to generate a php page for each one. I have previously been manually entering 'pattern' then saving as 'pattern.php'. With a limited understanding of php/mysql I have attempted to use the script you wrote but it is ending up with blank pages and no data as coded below.
<!--my original code-->
<?php
$cxn=mysqli_connect ("localhost","xxxx","yyyy");
mysqli_select_db($cxn, "zzzz");
$query="Select pattern, folder, name, url, name1
from database where pattern=
'abcdefg'";
$result=mysqli_query($cxn, $query);
$row=mysqli_fetch_assoc($result);
extract($row);
?>
<!-- new and improved code-->
<?php
$cxn = mysqli_connect ("localhost", "xxxx", "yyyy");
mysquli_select_db($cxn, "zzzz");
$query = "SELECT pattern, folder, name, url, name1 FROM database";
if ($result = mysqli_query($cxn, $query)) {
if (mysqli_num_rows($result)) {
while ($row = mysqli_fetch_assoc($result)) {
ob_start();
foreach (range('folder','name1') as $pos) {
echo $row[$pos];
extract($row);<!--I added this and got the very last 'pattern' in the database to display a page-->
}
file_put_contents($row['pattern'] . '.php', ob_get_contents());
ob_end_clean();
}
}
}
?>
<html>
<head>
<title><?php echo $pattern; ?> ?></title>
<meta name="description" content="<?php echo $pattern; ?>/>
<meta name="keywords" content="<?php echo $pattern; ?> " />
<style type="text/css">
</style>
</head>
<body>
<table width="900" border="0" align="center" cellpadding="1" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td bgcolor="#FFFFFF" valign="top">
<table cellspacing="0" cellpadding="0" border="0" width="800">
<tr>
<td>
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr bgcolor="#000033">
<td width="14" nowrap="nowrap" valign="middle"></td>
<td height="24" nowrap="nowrap" colspan="12"><a href="http://www.<?php echo $url ?>.com" class="c3"></a>
<div class="c6"><span class="c4"><?php echo $name; ?> .com</span>...<span class="c5"><strong><?php echo $name1; ?></strong></span></div>
</td>
<td nowrap="nowrap" valign="middle"><span class="c5"><strong> <?php $today = date("F j, Y");PRINT "$today"; ?></strong></span></td>
</tr>
</table>
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td height="1" nowrap="nowrap" bgcolor="#FFFFFF" colspan="10" width="100%"></td>
</tr>
<tr>
<td height="7" nowrap="nowrap" bgcolor="#990000" colspan="10" width="100%"></td>
</tr>
</table>
<table cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" align="center" class="c9" width="100%">
<tr>
<td width="100%" valign="top"><table cellspacing="0" cellpadding="0" border="0" align="center" width="100%" >
<tr>
<td height="14" valign="top" bgcolor="#FFFFFF"><span class="c2">
<a href="http://www.<?php echo $url; ?>.com">
<strong><?php echo $name; ?> Home</strong></a>
<span class="c7"><strong>>></strong></span>
<a href="http://www.<?php echo $url; ?>.com/<?php echo $name1; ?>.php">
<strong>Name 1</strong>
<span class="c7"><strong>>></strong></span>
<strong>Designs <?php echo $name1; ?> </strong></a>
<span class="c7"><strong>>></strong></span>
<span class="c12"><strong><?php echo $pattern; ?></strong></span> </span></td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="5" bgcolor="#FFFFFF">
<tr>
<td align="center">
<img src="http://www.dataprocess.com/name1/<?php echo $folder; ?>/<?php echo $pattern; ?>.jpg" border="0" />
</td>
</tr>
<tr>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<tr>
<td colspan="3" bgcolor="#FFFFFF">
<div class="c6">
<hr width="90%" />
<span class="c11"><?php echo $url; ?>.com Copyright 2005-<?php $today = date("Y");PRINT "$today"; ?> All Rights Reserved </span></div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>