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
jiggens
Forum Commoner
Posts: 37 Joined: Sun Jul 08, 2007 4:49 pm
Post
by jiggens » Fri Sep 28, 2007 11:55 am
PHP Question?
How could i update this file to have a if statement for just a specific siteplan ID to dislpay Building instead of Model?
Code: Select all
$query = "SELECT * from psh_siteplans WHERE communityID = '$ID' ORDER BY orderID";
$result = mysql_query($query);
while ($row = mysql_fetch_row($result)) {
print "<form action=" . $_SERVER['PHP_SELF'] . "?ID=" . $ID . "&siteID=" . $row[0] . " method='POST'>";
print "<table border='0' cellspacing='0' cellpadding='5'><tr>";
$window = "'http://homes.pacificscene.com/popup.php?type=renderings&ID=" . $row[0] . "','popUp','width=775,height=550'";
print "<td width='206' rowspan='8' valign='top'>";
print '<a href="javascript:;"><img border="0" src="http://homes.pacificscene.com/images/browse/renderings/' . $row[0] . '-TH.jpg" onclick="MM_openBrWindow(' . $window . ')" /></a>';
print "</td>";
print "<td width='135'><strong>Model</strong></td>";
print "<td>" . $row[1] . "</td></tr>";
print "<tr><td><strong>Appx Sq. Ft</strong>.</td>";
print "<td>" . $row[2] . "</td></tr>";
print "<tr><td><strong>Stories</strong>.</td>";
print "<td>" . $row[3] . "</td></tr>";
print "<tr><td><strong>Bedrooms</strong>.</td>";
print "<td>" . $row[4] . "</td></tr>";
print "<tr><td><strong>Baths</strong>.</td>";
print "<td>" . $row[5] . "</td></tr>";
print "<tr><td><strong>Garage</strong>.</td>";
print "<td>" . $row[6] . "</td></tr>";
$window = "'http://homes.pacificscene.com/popup.php?type=floorplans&ID=" . $row[0] . "','popUp','width=825,height=625,scrollbars=yes'";
http://homes.pacificscene.com/browse/co ... .php?ID=43
I have multiple communities and i need to be able to have this one display Building instead of Model
Last edited by
jiggens on Fri Sep 28, 2007 2:58 pm, edited 2 times in total.
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Fri Sep 28, 2007 12:02 pm
Please update the subject of this thread.
jiggens wrote: How could i update this file to have a if statement for just a specific siteplan ID to dislpay Building instead of Model?
Code: Select all
if ($something == 'something')
{
// do stuff
}
jiggens
Forum Commoner
Posts: 37 Joined: Sun Jul 08, 2007 4:49 pm
Post
by jiggens » Fri Sep 28, 2007 1:45 pm
could you elaborate a little more, i am still new to php.
jiggens
Forum Commoner
Posts: 37 Joined: Sun Jul 08, 2007 4:49 pm
Post
by jiggens » Fri Sep 28, 2007 2:02 pm
Code: Select all
$specificID = '5';
if($row[0] == $specificID) {
print "<td width='135'><strong>Building</strong></td>";
print "<td>" . $row[1] . "</td></tr>";
}
else {
print "<td width='135'><strong>Model</strong></td>";
print "<td>" . $row[1] . "</td></tr>";
}
I dont know why its not working shouldn't retrieve from the same row, the actual community id is 43 thought?
jiggens
Forum Commoner
Posts: 37 Joined: Sun Jul 08, 2007 4:49 pm
Post
by jiggens » Fri Sep 28, 2007 2:22 pm
All i am really trying to is change the tags not the data in DB i want the same data to exist under the tag Building as it would in Model, except to read Building and not model.
superdezign
DevNet Master
Posts: 4135 Joined: Sat Jan 20, 2007 11:06 pm
Post
by superdezign » Sat Sep 29, 2007 4:29 pm
What about it is "not working?"
baileylo
Forum Newbie
Posts: 13 Joined: Sun Sep 30, 2007 12:48 am
Post
by baileylo » Sun Sep 30, 2007 1:46 am
Code: Select all
$query = "SELECT * from psh_siteplans WHERE communityID = '$ID' ORDER BY orderID";
$result = mysql_query($query);
while ($row = mysql_fetch_row($result)) {
echo "<form action=" . $_SERVER['PHP_SELF'] . "?ID=" . $ID . "&siteID=" . $row[0] . " method='POST'>
<table border='0' cellspacing='0' cellpadding='5'><tr>";
$window = "'http://homes.pacificscene.com/popup.php?type=renderings&ID=" . $row[0] . "','popUp','width=775,height=550'";
echo "<td width='206' rowspan='8' valign='top'>" .
'<a href="javascript:;"><img border="0" src="http://homes.pacificscene.com/images/browse/renderings/' . $row[0] . '-TH.jpg" onclick="MM_openBrWindow(' . $window . ')" /></a>' .
"</td>";
//If Statement here
if($row[0] == 5)
echo "<td width='135'><strong>Model</strong></td>";
else
echo "<td width='135'><strong>Building</strong></td>";
echo "<td>{$row[1] }</td></tr>
<tr>
<td><strong>Appx Sq. Ft</strong>.</td>
<td>{ $row[2] }</td>
</tr>
<tr>
<td><strong>Stories</strong>.</td>
<td>{$row[3] }</td></tr>
<tr>
<td><strong>Bedrooms</strong>.</td>
<td>{$row[4] }</td></tr>
<tr>
<td><strong>Baths</strong>.</td>
<td>{$row[5] }</td></tr>
<tr>
<td><strong>Garage</strong>.</td>
<td>{$row[6] }</td></tr>";
$window = "'http://homes.pacificscene.com/popup.php?type=floorplans&ID=" . $row[0] . "','popUp','width=825,height=625,scrollbars=yes'";
[/syntax]
jiggens
Forum Commoner
Posts: 37 Joined: Sun Jul 08, 2007 4:49 pm
Post
by jiggens » Mon Oct 01, 2007 10:43 am
So i added this if statement to my coding and i changed it to read Building, but i only want to show up for a specific ID. I have multiple IDs for multiple communities so i only want this to change for one of them. I have tried various combinations.
Any other ideas?