• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 168
  • Last Modified:

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
0
Jiggens
Asked:
Jiggens
  • 3
  • 2
1 Solution
 
PhatzerCommented:
Not quite sure I understand your question fully.
0
 
frinCommented:
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.
0
 
JiggensAuthor Commented:
Frin,

I don't exactly know what $[xyz] is because i dont have that data in my DB show i put it there?
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
JiggensAuthor Commented:
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
0
 
frinCommented:
Oh then just use like this:

$specificID = '5';
if($row[0] == $specificID) {
                                    print "<td width='135'><strong>Building</strong></td>";
}
else {
                                    print "<td width='135'><strong>Model</strong></td>";
}
                              print "<td>" . $row[1] . "</td></tr>";
0
 
JiggensAuthor Commented:
that still didnt work
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now