Tag Switching

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

Post Reply
jiggens
Forum Commoner
Posts: 37
Joined: Sun Jul 08, 2007 4:49 pm

Tag Switching

Post by jiggens »

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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Descriptive Subjects

Post by feyd »

Please update the subject of this thread.
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:2. Use descriptive subjects when you start a new thread. Vague titles such as "Help!", "Why?" are misleading and keep you from receiving an answer to your question.
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 »

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

Reworked

Post by jiggens »

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 »

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.
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

What about it is "not working?"
baileylo
Forum Newbie
Posts: 13
Joined: Sun Sep 30, 2007 12:48 am

Post by baileylo »

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 »

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?
Post Reply