PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
daan
Forum Commoner
Posts: 25 Joined: Wed Nov 16, 2005 10:32 am
Post
by daan » Wed Nov 16, 2005 2:00 pm
~pickle: Please use PHP tags when posting code Posting code in the forums
at the top i have this
Code: Select all
if(!empty($_GET[search_state]))
{
$query[] = "re2_listings.image = '$_GET[image]' ";
}
if(!empty($_GET[search_country]))
{
$query[] = "re2_listings.country = '$_GET[search_country]' ";
}
if(!empty($_GET[search_state]))
{
$query[] = "re2_listings.state = '$_GET[search_state]' ";
}
if(!empty($_GET[search_city]))
{
$query[] = "re2_listings.city = '$_GET[search_city]' ";
}
and a little further
Code: Select all
$ListingTable .= "\n\t<td width=15>";
if(!empty($a1[image]))
{
$im_array = explode("|", $a1[image]);
$FirstImage = "<img src=\"re_images/$im_array[0]\" width=100 height=100>";
}
$ListingTable .= "</td>\n\t";
$ListingTable .= "<td width=305>$a1[address], $a1[state], $a1[city] $sub</td>\n\t";
$ListingTable .= "<td width=80>$a1[rooms] sk, $a1[bathrooms] ba";
$MyPrice = number_format($a1[Price], 2, ".", ",");
$ListingTable .= "</td>\n\t<td align=center width=100><b>€$MyPrice</td>\n";
$ListingTable .= "</tr>\n";
this page makes a list of addresses according to the search specification, and i want to add a picture of the address to be displayed at each address , but i can't find how to call the image of each address
Last edited by
daan on Mon Nov 21, 2005 5:12 pm, edited 1 time in total.
pickle
Briney Mod
Posts: 6445 Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:
Post
by pickle » Wed Nov 16, 2005 2:07 pm
What exactly isn't working? What have you tried? Could you explain the situation a little more?
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
pickle
Briney Mod
Posts: 6445 Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:
Post
by pickle » Wed Nov 16, 2005 4:41 pm
Ok, where's the logic that loops through and creates that table?
Wherever you've got the code that determines whether to output the camera or not, include some more code that goes and gets the picture off the address and outputs that.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
daan
Forum Commoner
Posts: 25 Joined: Wed Nov 16, 2005 10:32 am
Post
by daan » Thu Nov 17, 2005 5:37 pm
pickle, is it allright if i mail you the complete php file?
i then will explain my problem in the mail
greetz
(Belgium newbie
)
pickle
Briney Mod
Posts: 6445 Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:
Post
by pickle » Thu Nov 17, 2005 6:01 pm
Just post it up here. Don't worry about how large the file is. As long as you accurately describe the file, it should be fine. Plus, it may help out users who have similar issues.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
daan
Forum Commoner
Posts: 25 Joined: Wed Nov 16, 2005 10:32 am
Post
by daan » Thu Nov 17, 2005 6:51 pm
currently my layout is:
and i would like it to change to something like
my current script is:
Code: Select all
<?
require_once("conn.php");
require_once("includes.php");
if(empty($_GET[id]))
{
header("location:index.php");
exit();
}
$q1 = "select * from re2_agents, re2_listings where re2_listings.ListingID = '$_GET[id]' and re2_listings.AgentID = re2_agents.AgentID ";
$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[RealEstates]);
array_unique($CookieArray);
$rev = count($CookieArray);
if(!in_array($_GET[id], $CookieArray))
{
$NewValue = $_COOKIE[RealEstates]."|".$_GET[id];
setcookie ("Winterverhuur", $NewValue);
$ch = '1';
}
}
else
{
setcookie ("Winterverhuur", $_GET[id]);
}
if($rev == '0' || empty($rev))
{
$HomeCount = 1;
}
else
{
if(isset($ch))
{
$HomeCount = $rev + 1;
}
else
{
$HomeCount = $rev;
}
}
$HomeViews = $HomeCount." leden hebben dit bezocht.";
}
//////////////////////////////////////////////////////
////////////////// Home View Counter End
//////////////////////////////////////////////////////
if(empty($i) || $i == '1')
{
$Image1 = "bg_info2.gif";
$desc = nl2br($a1[ShortDesc]);
$desc2 = 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><font size=3 face=verdana color=black><b>$a1[city], $a1[state], $a1[country]</b></font><br><font size=2 face=verdana color=black>$a1[address]</font></td>\n\t<td width=\"40%\" valign=top align=center><font size=2 face=verdana><B>Prijs: €$MyPrice</td>\n</tr>\n\n<tr>\n\t<td valign=top><br><b>Zoekertje nummer: $a1[ListingID]</b><br><br><b>Korte omschrijving: </b>$desc<br><br><b>Gedetailleerde omschrijving: </b>$desc2<br><br><font size=2 face=verdana color=black><b>$a1[rooms] br, $a1[bathrooms] ba, $a1[garage] gr</font><br><br>Omgeving:</b> $a1[neighbourhood]<br><br><b>$a1[SquareMeters] vierkante meter bewoonbare oppervlakte<br>Grootte van het eigendom: $a1[LotSize] vierkante meter<br>Maximaal aantal personen: $a1[HomeAge]<br>";
if($a1[fireplace] == 'y')
{
$ShowInfo .= "mindervalide toegankelijk<br>\n";
}
if($a1[NearSchool] == 'y')
{
$ShowInfo .= "nabij kust<br>\n";
}
if($a1[NearTransit] == 'y')
{
$ShowInfo .= "zwembad<br>\n";
}
if($a1[NearPark] == 'y')
{
$ShowInfo .= "ligbad<br>\n";
}
if($a1[OceanView] == 'y')
{
$ShowInfo .= "televisie<br>\n";
}
if($a1[LakeView] == 'y')
{
$ShowInfo .= "kindvriendelijk<br>\n";
}
if($a1[MountainView] == 'y')
{
$ShowInfo .= "roken toegestaan<br>\n";
}
if($a1[OceanWaterfront] == 'y')
{
$ShowInfo .= "huisdieren toegestaan<br>\n";
}
if($a1[LakeWaterfront] == 'y')
{
$ShowInfo .= "wasmachine<br>\n";
}
if($a1[RiverWaterfront] == 'y')
{
$ShowInfo .= "vaatwasser<br>\n";
}
if(!empty($a1[image]))
{
$im_array = explode("|", $a1[image]);
$FirstImage = "<img src=\"re_images/$im_array[0]\" width=100 height=100>";
}
if($a1[AccountType] == '2')
{
if(!empty($a1[cellular]))
{
$int[] = "GSM: $a1[cellular]";
}
if(!empty($a1[pager]))
{
$int[] = "Fax: $a1[pager]";
}
if(!empty($int))
{
$int2 = implode("<br>", $int);
$int2 = "<br>".$int2;
}
}
$ShowInfo .= "</td>\n\t<td align=center valign=top><a class=RedLink href=\"info.php?id=$a1[ListingID]&i=2\">$FirstImage</a><br><br><a class=RedLink href=\"info.php?id=$a1[ListingID]&i=2\">$FirstImage</a><br><br>Voor meer informatie,<br><b> $a1[FirstName] $a1[LastName]<br>tel: $a1[phone]$int2</b><br>of klik <a class=RedLink href=\"email.php?AgentID=$a1[AgentID]&ListingID=$a1[ListingID]\">hier</a> om te emailen.<br><br>";
if($a1[AccountType] == '1')
{
$ShowInfo .= "<a class=BlueLink href=\"search.php?AgentID=$a1[AgentID]\" title=\"Meer advertenties van deze gebruiker\">Meer advertenties van deze gebruiker</a><br><br><center>";
}
else
{
$ShowInfo .= "<a class=BlueLink href=\"search.php?AgentID=$a1[AgentID]\" title=\"Meer advertenties van $a1[FirstName] $a1[LastName]\">Meer advertenties van<br> $a1[FirstName] $a1[LastName]</a><br><br><center>";
}
if($a1[AccountType] == '1')
{
if(!empty($a1[logo]))
{
$ShowInfo .= "<a href=\"resume.php?id=$a1[AgentID]\" title=\"Lees de gebruiker's resume!\"><img src=\"re_images/$a1[logo]\" border=0></a>";
}
else
{
$ShowInfo .= "<a class=BlackLink href=\"resume.php?id=$a1[AgentID]\" title=\"Lees de gebruiker's resume!\">$a1[FirstName] $a1[LastName] Resume</a>";
}
}
$ShowInfo .= "</center></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]\">wijzig</a> | <a class=RedLink href=\"delete.php?id=$a1[ListingID]\">verwijder</a></td>\n</tr>\n\n";
}
$ShowInfo .= "\n</table>";
}
else
{
$Image1 = "bg_info.gif";
}
if($i == '2')
{
$Image2 = "bg_photos2.gif";
if(!empty($a1[image]))
{
$MyImages = explode("|", $a1[image]);
$ShowInfo .= "<table valign=top align=center width=\"500\" height=50>\n<tr>\n\t<td align=center valign=top width=\"500\" height=50>";
while(list(,$v) = each($MyImages))
{
$ShowInfo .= "<a href=\"info.php?id=$_GET[id]&i=$_GET[i]&f=$v\"><img src=\"re_images/$v\" width=50 height=50 border=0></a> \n\n\t";
}
$ShowInfo .= "</table><hr size=1 width=\"95%\" color=#336699><br>";
if(!empty($f))
{
$ShowInfo .= "<center><img src=\"re_images/$f\"></center><br>";
}
else
{
$ShowInfo .= "<center><img src=\"re_images/$MyImages[0]\"></center><br>";
}
}
else
{
$ShowInfo .= "<br><center><img src=\"no_image.gif\"></center>";
}
}
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]&country=$a1[country]&zoom=5\"><img src=\"myimages/bg_directions.gif\" 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 re2_listings set visits = visits + '1' where ListingID = '$_GET[id]' ";
mysql_query($q1) or die(mysql_error());
?>
is there anyone willing to help me
THANX !!!
(belgian newbie
)
JasonTC
Forum Commoner
Posts: 92 Joined: Wed Nov 02, 2005 11:05 am
Location: Grand Rapids, MI
Post
by JasonTC » Thu Nov 17, 2005 7:08 pm
If it's just a layout issue, it seems like it should be pretty easy to fix. It looks like the information is pretty much the same in both layouts and all you want to change is the look of your page. Is that right or is the problem something else? You're going to have to be more specific about what the problem is.
Jason
daan
Forum Commoner
Posts: 25 Joined: Wed Nov 16, 2005 10:32 am
Post
by daan » Thu Nov 17, 2005 7:33 pm
it is mostly a layout problem, if anyone could change my layout to the one i suggested, i would already be very satified
daan
Forum Commoner
Posts: 25 Joined: Wed Nov 16, 2005 10:32 am
Post
by daan » Sat Nov 19, 2005 3:04 am
nobody that can help me change my laout?
(Belgian newbie)
JasonTC
Forum Commoner
Posts: 92 Joined: Wed Nov 02, 2005 11:05 am
Location: Grand Rapids, MI
Post
by JasonTC » Sun Nov 20, 2005 1:59 pm
I don't know how familiar you are with HTML, but I would just look at the source code of the page with the desired layout and replace their information with your information.
daan
Forum Commoner
Posts: 25 Joined: Wed Nov 16, 2005 10:32 am
Post
by daan » Mon Nov 21, 2005 5:15 pm
my current layout is
Code: Select all
$ShowInfo = "<table border=0 align=center width=\"100%\">\n\t<tr>\n\t
<td width=\"60%\" valign=top><font size=3 face=verdana color=black>
<b>$a1[city], $a1[state], $a1[country]</b></font><br>
<font size=2 face=verdana color=black>$a1[address]</font></td>\n\t
<td width=\"40%\" valign=top align=center><font size=2 face=verdana>
<B>Prijs: € $MyPrice</td>\n</tr>\n\n<tr>\n\t<td valign=top><br>
<b>Zoekertje nummer: $a1[ListingID]</b><br><br>
<b>Korte omschrijving: </b>$desc<br><br>
<b>Gedetailleerde omschrijving: </b>$desc2<br><br>
<font size=2 face=verdana color=black><b>Maximaal aantal personen: $a1[HomeAge]<br>
Aantal slaapkamers: $a1[rooms] <br>
Aantal badkamers: $a1[bathrooms] <br>
Aantal garages: $a1[garage]<br>
Bewoonbare opp.: $a1[SquareMeters] m<sup>2</sup><br>
Opp. domein: $a1[LotSize] m<sup>2</sup><br>
</font><br><br>Omgeving:</b> $a1[neighbourhood]<br> ";
but i would like to create different background table for $dec and $desc2 and so like in the image example above
thanx
daan
Forum Commoner
Posts: 25 Joined: Wed Nov 16, 2005 10:32 am
Post
by daan » Tue Nov 22, 2005 6:25 am
i've looked at other sites, and they do it with <div> , but i don't succeed in doing it
Maugrim_The_Reaper
DevNet Master
Posts: 2704 Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland
Post
by Maugrim_The_Reaper » Tue Nov 22, 2005 9:38 am
This is a layout question - you should probably post a formatted (indented, readable) copy of the HTML source as it looks when output to a browser. The HTML above has no spacing, indents and is mixed into the PHP variables....
JasonTC
Forum Commoner
Posts: 92 Joined: Wed Nov 02, 2005 11:05 am
Location: Grand Rapids, MI
Post
by JasonTC » Wed Nov 23, 2005 12:51 pm
I would suggest you find an HTML tutorial online (go to google.com and type "+html +tutorial") and familiarize yourself with tables. Write some small HTML pages by hand and get to know the code. Here's a really simple example:
Code: Select all
<table>
<tr><td>test1</td></tr>
<tr><td>test2</td></tr>
</table>
After you've done that, write a small page with a table written by a PHP script. Maybe something like
Code: Select all
<?php
$cell1 = "test1";
$cell2 = "test2";
echo "<table>";
echo "<tr><td>$cell1</td></tr>";
echo "<tr><td>$cell2</td></tr>";
echo "</table>";
?>
Once you're really familiar with HTML code and how to generate it with PHP scripts, it will be much easier to look through someone else's code and figure out how it works. Because it looks like that's what you want to do - someone else has a page with a look you want to replicate.