DB table script that needs help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am putting together this script that I am hoping will build a 
search query table for a project I am working. I am figuring the 
syntax and commands as I go, and I have run across a little snafoo, 
can someone help me debug this, I am getting an error on line 46 in 
foreach statement. If anyone could help that would be huge!

Thanks everyone!

01  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-
transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml";>
05  <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-
1" />
<title>Lesson Plan Finder</title>
</head>
10 <body>
<p><img src="images/Header.png" width="660" height="150" /></p>

<form	method="post" 
		action="index.php">
		Enter your search term
15		<input type="text"
				name = "keyword"
				value ="Enter Search Term"/>
		<input type = "submit"
				value = "Search"/>
20 </form>

<?
// creating the database connection
$DBconn = mysql_connect("archammer", "DBuser", "password");
mysql_select_db("tessmerproject", $DBconn);
25
// create the query
$sql = "SELECT * FROM tbl_unit_plan where name like '%d%'";
$results = mysql_query($sql, $DBconn);

30	print "<table border = 1
			width = 100%>";

//get field names
	print "<tr>\n";
35
while ($field = mysql_fetch_field($results)){
	print " <th>$field->name</th>";
} //end while statement
	print "<tr>";
40
// get rows as associative array
while ($row = mysql_fetch_assoc($results)){
	print "<tr>/n";
}
45 //view the fields
	foreach ($row as $col => $val){ //<- ERROR HERE
		print " <td>$val</td>\n";
}
	print "</table>\n";
50 ?>
</body>
</html>







PHP Data object relational mapping generator
http://www.metastorage.net/ 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-objects/

<*> To unsubscribe from this group, send an email to:
    php-objects-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux