Jump to content

Notice: Undefined variable:


zavin

Recommended Posts

Why is cars in the following code an undefined variable?

$result = mysql_query("SELECT * FROM `carlot`");
$howmanyitems = 0;
while($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
if ($line['buyable'] == 1){
	$cars .= "<td width='25%' align='center'><img src='". $line['image']."' width='100' height='100' style='border: 1px solid #333333'><br>
	". car_popup($line['name'], $line['id']) ."<br>$". $line['cost'] ."<br><a href='carlot.php?buy=".$line['id']."'>[buy]</a></td>";
	$howmanyitems = $howmanyitems + 1;
	if ($howmanyitems == 3){
		$cars.= "</tr><tr>";
		$howmanyitems = 0;
	}
}
}

Link to comment
https://forums.phpfreaks.com/topic/200262-notice-undefined-variable/
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.