Page 1 of 1

The car images are not being shown......

Posted: Fri Nov 09, 2007 4:56 pm
by mkkay
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi,
I have a site for showing car pictures, howver i recently moved servers and now i have a major problem when someone clicks on the photos link the page just seems to refresh it doesnt show the images of the chosen vehicle. I believe the problem lies in the part of the code melow "$Images" because thats the part that acquires the images from a folder on the server.

Code: Select all

<?
require_once("conn.php");
require_once("includes.php");

if(empty($_GET[id]))
{
	header("location:index.php");
	exit();
}

$q1 = "select * from cars_agents, cars_listings, cars_vehicle where cars_listings.ListingID = '$_GET[id]' and cars_listings.AgentID = cars_agents.AgentID and cars_listings.VehicleMake = cars_vehicle.VehicleID";
$r1 = mysql_query($q1) or die(mysql_error());
$a1 = mysql_fetch_array($r1);

//////////////////////////////////////////////////////
//////////////////	Home View Counter Start
//////////////////////////////////////////////////////

if($a1[AgentID] != $_SESSION[AgentID])
{
	if(!empty($_COOKIE[RealEstates]))
	{
		$CookieArray = explode("|", $_COOKIE[cars]);
		array_unique($CookieArray);

		$rev = count($CookieArray);

		if(!in_array($_GET[id], $CookieArray))
		{
			$NewValue = $_COOKIE[cars]."|".$_GET[id];
			setcookie ("cars", $NewValue);

			$ch = '1';
		}
	}
	else
	{
		setcookie ("cars", $_GET[id]);
	}




	if($rev == '0' || empty($rev))
	{
		$HomeCount = 1;
	}
	else
	{
		if(isset($ch))
		{
			$HomeCount = $rev + 1;
		}
		else
		{
			$HomeCount = $rev;
		}
	}

	$HomeViews = $HomeCount." offers viewed this visit.";
}

//////////////////////////////////////////////////////
//////////////////	Home View Counter End
//////////////////////////////////////////////////////

if(empty($i) || $i == '1')
{
	$Image1 = "bg_info2.gif";

	$desc = nl2br($a1[DetailedDesc]);

	$MyPrice = number_format($a1[Price], 2, ".", ",");

	$ShowInfo = "<table border=0 align=center width=\"100%\">\n\t<tr>\n\t<td width=\"60%\" valign=top align=left><font size=2 face=verdana color=black><b>$a1[VehicleName] $a1[VehicleModel]</b><br><b>Year:</b> $a1[VehicleYear]<br><b>Mileage:</b> $a1[mileage] Kilometres<br><b>Color:</b> $a1[VehicleColor]<br><b>Location:</b> $a1[address], $a1[city],<br>$a1[state], $a1[country]<br><b>Seller:</b> $a1[FirstName] $a1[LastName]</font></td>\n\t<td width=\"40%\" valign=top align=center><font size=2 face=verdana><B>Price:</b> $aset[Currencya]$MyPrice</td>\n</tr>\n\n<tr>\n\t<td valign=top align=left><br><b>Offer ID:</b> $a1[ListingID]<br><br>$desc<br>";

	if(!empty($a1[image]))
	{
		$im_array = explode("|", $a1[image]);

		$FirstImage = "<center><a href=\"cars_images/$im_array[0]\" target=_blank><img src=\"cars_images/$im_array[0]\" width=125 height=125 border=1><br>Enlarge</a></center>";
	}

	$ShowInfo .= "</td>\n\t<td align=center valign=top>$FirstImage<br><br>For more information call<br><b> $a1[FirstName] $a1[LastName]<br>$a1[phone]</b><br>or click <a class=RedLink href=\"email.php?AgentID=$a1[AgentID]&ListingID=$a1[ListingID]\">here</a> to email.<br><br><a class=BlackLink href=\"search.php?AgentID=$a1[AgentID]\" title=\"More offers by $a1[FirstName] $a1[LastName]\">More Offers by This Agent</a><br>";
	
	if(!empty($a1[logo]))
	{
		$ShowInfo .= "<a href=\"resume.php?id=$a1[AgentID]\" title=\"$a1[FistName] $a1[LastName]'s profile\"><img src=\"cars_images/$a1[logo]\" border=0></a>";
	}
	else
	{
		$ShowInfo .= "<a class=BlackLink href=\"resume.php?id=$a1[AgentID]\" title=\"$a1[FistName] $a1[LastName]'s profile\">$a1[FirstName] $a1[LastName]'s Profile</a>";
	}

	$ShowInfo .= "</td>\n</tr>";
	
	if($a1[AgentID] == $_SESSION[AgentID])
	{
		$ShowInfo .= "<tr>\n\t<td colspan=3 align=center><a class=RedLink href=\"edit.php?id=$a1[ListingID]\">edit</a> | <a class=RedLink href=\"delete.php?id=$a1[ListingID]\">delete</a></td>\n</tr>\n\n";
	}
	
	$ShowInfo .= "\n</table>";

}
else
{
	$Image1 = "bg_info.gif";
}

if($i == '2')
{
	[color=red]$Image2 = "bg_photos2.gif";

	if(!empty($a1[image]))
	{
	[color=green]	$MyImages = explode("|", $a1[image]);

		$ShowInfo .= "<table valign=top align=center width=\"100%\" height=50>\n<tr>\n\t<td align=center valign=top width=\"100%\" height=50>";
		
		while(list(,$v) = each($MyImages))
		{
			$ShowInfo .= "<a href=\"info.php?id=$_GET[id]&i=$_GET[i]&f=$v\"><img src=\"cars_images/$v\" width=50 height=50 border=0></a>&nbsp;&nbsp;&nbsp;\n\n\t";
		}

		$ShowInfo .= "</table><hr size=1 width=\"95%\" color=#336699><br>";


		if(!empty($f))
		{
			$ShowInfo .= "<center><img src=\"cars_images/$f\"></center><br>";
		}
		else
		{
			$ShowInfo .= "<center><img src=\"cars_images/$MyImages[0]\"></center><br>";
		}

	}
	else
	{
		$ShowInfo .= "<br><center><img src=\"no_image.gif\"></center>";
	}[/color]
[/color]
}
else
{
	$Image2 = "bg_photos.gif";
}


$MyAddress = str_replace(" ", "+", $a1[address]);
$MyAddress = str_replace(",", "", $MyAddress);

$Image3 = "<a target=_blank  href=\"http://www.mapquest.com/maps/map.adp?city=$a1[city]&state=$a1[state]&address=$MyAddress&country=$a1[country]&zoom=5\"><img src=\"myimages/bg_directions.gif\" width=150 height=20 border=0></a>";

//$Image3 = "<img src=\"myimages/no_directions.gif\">";

$ListingID = $a1[ListingID];

require_once("templates/HeaderTemplate.php");
require_once("templates/InfoTemplate.php");	
require_once("templates/FooterTemplate.php");

//update the stats
$q1 = "update cars_listings set visits = visits + '1' where ListingID = '$_GET[id]' ";
mysql_query($q1) or die(mysql_error());

?>

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]