Jump to content

[SOLVED] Variable not printing


jmr3460

Recommended Posts

I just don't see what I am doing wrong. I am not getting any errors. My html is printing, my variables are not. Can someone tell me why?

<?php
ini_set ("display_errors", "1");
error_reporting(E_ALL);
$host = "localhost";
$user = "user";
$password = "password";
$db = "groupinfo";
$sql = "SELECT g.groupid,g.groupname,g.address,g.city,g.state
			FROM contact AS g
			INNER JOIN banner AS b USING ( groupid )
			WHERE b.banner = '1'";
mysql_connect($host, $user, $password) or die(mysql_error());
mysql_select_db($db);
$result = mysql_query($sql) or die(mysql_error());
while ($row = mysql_fetch_array($result));{
//I think these variables are not defined correctly
$group = $row['groupname'];
$address = $row['address'];
$city = $row['city'];
$state = $row['state'];
$group_info = "<tr><td>$group</td><td>$address</td><td>$city</td><td>$state</td></tr>";

	echo "<table>";
//the echo below produces prints"<tr><td></td><td></td><td></td><td></td></tr>"
//none of the variables print
	echo $group_info;
	echo "</table>";
	echo $group;
}
?>

Can someone point out the obvious?

Link to comment
https://forums.phpfreaks.com/topic/165302-solved-variable-not-printing/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.