Definately along the right lines, thanks. I am getting a Invalid argument supplied for foreach() error. Also I dont think the sql statement is picking up the increment in the counter. Any ideas?
<?php
require("func_connect.php");
connect ("localhost","tantrum");
session_start();
$count = "1";
$max = "30";
$sql = "SELECT * FROM company, products WHERE company.cid=$count AND products.cid=$count";
$result = mysql_query($sql) or die("Could not execute query.");
echo "<h1>$name</h1>";
while ($data = mysql_fetch_array($result) && $count < $max) {
do {
// turn all fields in the db into variables (w/ same name as the db field)
foreach ( $data as $key => $val ) {
$$key = $val;
}
echo "<a href=\"view_product.php?id=$id\">$title</a><br>
<a href=\"update_product.php?id=$id\">Update product info</a> :
<a href=\"delete_product.php?id=$id\">Delete product</a><br><br>";
} while ($data = mysql_fetch_array($result));
$count++;
}
mysql_free_result($result);
?>
thanks once again!