Link to home
Create AccountLog in
Avatar of Jiggens
Jiggens

asked on

PHP coding

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?

$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/community.php?ID=43

I have multiple communities and i need to be able to have this one display Building instead of Model
Avatar of Phatzer
Phatzer
Flag of United Kingdom of Great Britain and Northern Ireland image

Not quite sure I understand your question fully.
From the code you pasted it's hard to guess what's Building and what Model...using mysql_fetch_assoc would be better.

You will need to change this:
                                    print "<td width='135'><strong>Model</strong></td>";
                              print "<td>" . $row[1] . "</td></tr>";

into:
$specificID = '5';
if($row[0] == $specificID) {
                                    print "<td width='135'><strong>Building</strong></td>";
                              print "<td>" . $row[xyz] . "</td></tr>";
}
else {
                                    print "<td width='135'><strong>Model</strong></td>";
                              print "<td>" . $row[1] . "</td></tr>";
}

Where xyz is appropriate column number that contains Building info, and $specificID is the ID of which you want to print Building info.
Avatar of Jiggens
Jiggens

ASKER

Frin,

I don't exactly know what $[xyz] is because i dont have that data in my DB show i put it there?
Avatar of Jiggens

ASKER

all i want to do is change the tags the info will be the same as the Model i just want to change the TAG to read Building and not Model
ASKER CERTIFIED SOLUTION
Avatar of frin
frin
Flag of Slovenia image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of Jiggens

ASKER

that still didnt work