Jump to content


Photo

help, very easy stuff


  • Please log in to reply
13 replies to this topic

#1 REOL

REOL
  • Members
  • PipPip
  • Member
  • 19 posts

Posted 17 August 2006 - 01:52 PM

This form finds property availabilities from a database and displays it.

currently it outputs the *TOP TABLE(property)* and *BOTTOM TABLE (spaces available in the property)*  together on each result. but i only want display the *BOTTOM TABLE* multiple times for each space.

hope i can get some quicck help on this.



<!--results -->
<?php
if( $_GET['district_id'] && $_GET['district_id'][0] != 'all' )
{
	$district_id = $_GET['district_id'];
	$minRentSq = $_GET['minimum_rent'];
	$maxRentSq = $_GET['maximum_rent'];
	$minSq = $_GET['minimum_space'];
	$officeBool = $_GET['isRetail'];
	$preBuiltBool = $_GET['isPrebuilt'];
	$sort_field = $_GET['sort_field'];
	$spaces = getSpacesByDistrict( $district_id, $minRentSq, $maxRentSq, $minSq, $officeBool, $preBuiltBool, $sort_field);
echo "<pre>";
print_r( $spaces );
echo "</pre>";
}
else if( $_GET['property_id'] && $_GET['property_id'][0] != 'all' )
{
	$property_id = $_GET['property_id'];
	$minRentSq = $_GET['minimum_rent'];
	$maxRentSq = $_GET['maximum_rent'];
	$minSq = $_GET['minimum_space'];
	$officeBool = $_GET['isRetail'];
	$preBuiltBool = $_GET['isPrebuilt'];
	$sort_field = $_GET['sort_field'];
	$spaces = getSpacesByProperty( $property_id, $minRentSq, $maxRentSq, $minSq, $officeBool, $preBuiltBool, $sort_field);
echo "<pre>";
print_r( $spaces );
echo "</pre>";
}

?>

<br><br><img src="images/headers/hd_leasing_availableSR.gif" width="523" height="15"><br><br>
<table>
<tr>
<td valign="middle"><input type="image" border="0" alt="Print Results" src="images/misc/printResults.gif"></td>
<td><img src="images/null.gif" width="12"></td>
<td valign="middle">	
<span class="foundtext"><?php= count($spaces) ?> leases available at 
<?php= $space['address'] ?></span><br><a class="small" href="#top">Refine Search</a></td>
</tr>
</table>

<?php
foreach ($spaces as $space) {
?>
<!-- **************************TOP TABLE************************* -->
<table border="0" width="500" cellpadding="2" cellspacing="1">
<tr>
<td colspan="2"><span class="leaseTitle"><?= $space['address'] ?></span></td>
</tr>
<tr>
<td valign="top" align="right" class="leaseInfo">District:</td>
<td class="leaseText" valign="top"><?php= $space['name'] ?></td>
</tr>
<tr>
<td valign="top" class="leaseInfo" align="right">Contacts:</td>
<td class="leaseText" valign="top"><a class="hplink" href="mailto:howard.tenenbaum@slgreen.com">Howard J. Tenenbaum</a>, 212-216-1685 (SL Green Leasing, LLC)<br><a class="hplink" href="mailto:gary.rosen@slgreen.com">Gary M. Rosen</a>, 212-216-1687 (SL Green Leasing, LLC)<br></td>
</tr>
</table>

<br />
<a href="property.php?id=<?php= $space['id'] ?>"><input class="button" type="button" value="Detailed Property Information" onClick="document.location.href='property.php?id=<?php= $id ?>';"></a>

<br /><br /><br />
<!-- **************************   END TOP TABLE  ************************* -->

<!-- **************************BOTTOM TABLE************************* -->
<table width="500" cellpadding="1" cellspacing="1" border="0">
<tr align="center" bgcolor="#666666">
<td class="smtypeWt">Floor<br><img src="images/gresources/x.gif" alt="SL Green" width="65" height="1" border="0"><br></td>
<td class="smtypeWt">Suite<br><img src="images/gresources/x.gif" alt="SL Green" width="60" height="1" border="0"><br></td>
<td class="smtypeWt">Square<br>Feet<br><img src="images/gresources/x.gif" alt="SL Green" width="50" height="1" border="0"><br></td>
<td class="smtypeWt">Available<br><img src="images/gresources/x.gif" alt="SL Green" width="60" height="1" border="0"><br></td>
<td class="smtypeWt">Rent/SF<br><img src="images/gresources/x.gif" alt="SL Green" width="60" height="1" border="0"><br></td>
<td class="smtypeWt">Term<br><img src="images/gresources/x.gif" alt="SL Green" width="45" height="1" border="0"><br></td>
<td class="smtypeWt">Direct/<br>Sublet<br><img src="images/gresources/x.gif" alt="SL Green" width="60" height="1" border="0"><br></td>
<td class="smtypeWt">Retail/<br>Office<br><img src="images/gresources/x.gif" alt="SL Green" width="50" height="1" border="0"><br></td>
<td class="smtypeWt">Prebuilt<br><img src="images/gresources/x.gif" alt="SL Green" width="50" height="1" border="0"><br></td>
</tr>
<?php $bgcolor = ($bgcolor == "#99CCFF") ? "#ccccFF" : "#99CCFF"; ?>
<tr bgcolor="<?php= $bgcolor ?>">
<td align="right" class="smtype" valign="top"><?php= $space['floor']  ?></td>
<td class="smtype" valign="top"><?php= $space['suite'] ?></td>
<td align="right" class="smtype" valign="top"><?php= $space['sqfeet'] ?></td>
<td align="center" class="smtype" valign="top"><?php= $space['availability'] ?>
<img src="/images/null.gif" width="1" height="1"></td>
<td align="right" class="smtype" valign="top"><?php= $space['rentsqfeet'] ?></td>
<td align="right" class="smtype" valign="top"><?php= $space['term'] ?><img src="/images/null.gif" width="1" height="1"></td>
<td align="center" class="smtype" valign="top"><?php= $space['issublet'] ?></td>
<td align="center" class="smtype" valign="top"><?php= $space['isretail'] ?></td>
<td align="center" class="smtype" valign="top"><?php= $space['isprebuilt'] ?></td>
</tr>
<tr bgcolor="<?= $bgcolor ?>"><td align="left" class="smtype" valign="Top" colspan="9">
<?php= $space['notes'] ?></td>
</tr>
<tr bgcolor="<?php= $bgcolor ?>"><td colspan="9" class="smtype"><a class="hplink" href="#" onClick="window.open('floorplan.php?spaceid=$space_id','spacewin','toolbar=no,status=no,directories=no,scrollbars=yes');">Floorplans</a></td>
</tr>
<tr align="center">
<td class="smtype" colspan="9"><img src="images/gresources/x.gif" width="1" height="4" border="0"></td>
</tr>
<?php }  ?>

</table>
<!-- **************************END BOTTOM TABLE************************* -->


#2 REOL

REOL
  • Members
  • PipPip
  • Member
  • 19 posts

Posted 17 August 2006 - 02:41 PM

up

#3 GingerRobot

GingerRobot
  • Staff Alumni
  • Advanced Member
  • 4,086 posts
  • LocationUK

Posted 17 August 2006 - 02:43 PM

I for one havn't really got a clue what you are asking, perhaps it is just me. Also, enclose your code in full php tags(<?php ?>) So we can see it with syntax highlighting. Makes it a lot easier on the eye.

#4 Jenk

Jenk
  • Members
  • PipPipPip
  • Advanced Member
  • 778 posts

Posted 17 August 2006 - 03:09 PM

Just remove the top table?!

#5 REOL

REOL
  • Members
  • PipPip
  • Member
  • 19 posts

Posted 17 August 2006 - 03:13 PM

i wanted to use the whereAdd funtion i believe?

as well as fetch() ? ?

so basically, there are multiple $spaces for each $property_id, i want to show the top table once, which outputs the $property_id ONCE, and show each $space according to the property_id

so the output would be like:

property_id (1)
space
space
space
space

property_id (2)
space
space
space


AND NOT
property_id (1)
space
property_id (1)
space
property_id (2)
space
property_id (2)
space


#6 REOL

REOL
  • Members
  • PipPip
  • Member
  • 19 posts

Posted 17 August 2006 - 03:54 PM

anyone?


#7 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 17 August 2006 - 03:57 PM

i wanted to use the whereAdd funtion i believe?

as well as fetch() ? ?


What are you talking about? Could you please be a bit more descriptive in your problem... and stop bumping your thread!

#8 REOL

REOL
  • Members
  • PipPip
  • Member
  • 19 posts

Posted 17 August 2006 - 04:09 PM

testpage is here:

http://reol.com/slgreen/test.php

just choose a property or district and search. youll see the print_r and results below it.. and from there youll know what im talking about.

thanks for your time.
-ps

#9 REOL

REOL
  • Members
  • PipPip
  • Member
  • 19 posts

Posted 17 August 2006 - 06:30 PM

last time im uppin this ! please any assistance?

-ps

#10 HeyRay2

HeyRay2
  • Members
  • PipPipPip
  • Advanced Member
  • 223 posts

Posted 17 August 2006 - 07:43 PM

Just before your foreach() loop the prints the spaces, set a variable to track the current property id.

Then after each loop prints a space row, check if the property ID of the next space is the same as the row before it.

If the property ID is the same, just print another space row. If the property ID changes, then update the variable that tracks the current property ID, and print out that property information and it's associated spaces.

Good luck!  ;)


#11 REOL

REOL
  • Members
  • PipPip
  • Member
  • 19 posts

Posted 18 August 2006 - 02:13 PM

ive tried several ways, but its not working :/ is there another way? or someone help me out here?

thanks

#12 HeyRay2

HeyRay2
  • Members
  • PipPipPip
  • Advanced Member
  • 223 posts

Posted 18 August 2006 - 03:12 PM

Change your foreach() loop to a for() loop so you can track what loop iteration
you are on, and only print the top table on the first iteration.

You'll notice that with this method you'll access each item in the $spaces array using $spaces[$i] instead of $space:

<?php
for($i=0;$i < count($spaces);$i++){
	if( $i == 0 ){
		// Print the top table, because we are on the first iteration
?>
<!-- **************************TOP TABLE************************* -->
<table border="0" width="500" cellpadding="2" cellspacing="1">
<tr>
<td colspan="2"><span class="leaseTitle"><?= $spaces[$i]['address'] ?></span></td>
</tr>
<tr>
<td valign="top" align="right" class="leaseInfo">District:</td>
<td class="leaseText" valign="top"><?php= $spaces[$i]['name'] ?></td>
</tr>
<tr>
<td valign="top" class="leaseInfo" align="right">Contacts:</td>
<td class="leaseText" valign="top"><a class="hplink" href="mailto:howard.tenenbaum@slgreen.com">Howard J. Tenenbaum</a>, 212-216-1685 (SL Green Leasing, LLC)<br><a class="hplink" href="mailto:gary.rosen@slgreen.com">Gary M. Rosen</a>, 212-216-1687 (SL Green Leasing, LLC)<br></td>
</tr>
</table>

<br />
<a href="property.php?id=<?php= $spaces[$i]['id'] ?>"><input class="button" type="button" value="Detailed Property Information" onClick="document.location.href='property.php?id=<?php= $spaces[$i]['id']  ?>';"></a>

<br /><br /><br />
<!-- **************************   END TOP TABLE  ************************* -->

<?php
	}
	// Print the bottom table

<!-- **************************BOTTOM TABLE************************* -->
<table width="500" cellpadding="1" cellspacing="1" border="0">
<tr align="center" bgcolor="#666666">
<td class="smtypeWt">Floor<br><img src="images/gresources/x.gif" alt="SL Green" width="65" height="1" border="0"><br></td>
<td class="smtypeWt">Suite<br><img src="images/gresources/x.gif" alt="SL Green" width="60" height="1" border="0"><br></td>
<td class="smtypeWt">Square<br>Feet<br><img src="images/gresources/x.gif" alt="SL Green" width="50" height="1" border="0"><br></td>
<td class="smtypeWt">Available<br><img src="images/gresources/x.gif" alt="SL Green" width="60" height="1" border="0"><br></td>
<td class="smtypeWt">Rent/SF<br><img src="images/gresources/x.gif" alt="SL Green" width="60" height="1" border="0"><br></td>
<td class="smtypeWt">Term<br><img src="images/gresources/x.gif" alt="SL Green" width="45" height="1" border="0"><br></td>
<td class="smtypeWt">Direct/<br>Sublet<br><img src="images/gresources/x.gif" alt="SL Green" width="60" height="1" border="0"><br></td>
<td class="smtypeWt">Retail/<br>Office<br><img src="images/gresources/x.gif" alt="SL Green" width="50" height="1" border="0"><br></td>
<td class="smtypeWt">Prebuilt<br><img src="images/gresources/x.gif" alt="SL Green" width="50" height="1" border="0"><br></td>
</tr>
<?php $bgcolor = ($bgcolor == "#99CCFF") ? "#ccccFF" : "#99CCFF"; ?>
<tr bgcolor="<?php= $bgcolor ?>">
<td align="right" class="smtype" valign="top"><?php= $spaces[$i]['floor']  ?></td>
<td class="smtype" valign="top"><?php= $spaces[$i]['suite'] ?></td>
<td align="right" class="smtype" valign="top"><?php= $spaces[$i]['sqfeet'] ?></td>
<td align="center" class="smtype" valign="top"><?php= $spaces[$i]['availability'] ?>
<img src="/images/null.gif" width="1" height="1"></td>
<td align="right" class="smtype" valign="top"><?php= $spaces[$i]['rentsqfeet'] ?></td>
<td align="right" class="smtype" valign="top"><?php= $spaces[$i]['term'] ?><img src="/images/null.gif" width="1" height="1"></td>
<td align="center" class="smtype" valign="top"><?php= $spaces[$i]['issublet'] ?></td>
<td align="center" class="smtype" valign="top"><?php= $spaces[$i]['isretail'] ?></td>
<td align="center" class="smtype" valign="top"><?php= $spaces[$i]['isprebuilt'] ?></td>
</tr>
<tr bgcolor="<?= $bgcolor ?>"><td align="left" class="smtype" valign="Top" colspan="9">
<?php= $spaces[$i]['notes'] ?></td>
</tr>
<tr bgcolor="<?php= $bgcolor ?>"><td colspan="9" class="smtype"><a class="hplink" href="#" onClick="window.open('floorplan.php?spaceid=$spaces[$i]['id']','spacewin','toolbar=no,status=no,directories=no,scrollbars=yes');">Floorplans</a></td>
</tr>
<tr align="center">
<td class="smtype" colspan="9"><img src="images/gresources/x.gif" width="1" height="4" border="0"></td>
</tr>
<?php
}
// Done printing bottom table
?>

</table>
<!-- **************************END BOTTOM TABLE************************* -->



Hope this helps!  ;)

#13 REOL

REOL
  • Members
  • PipPip
  • Member
  • 19 posts

Posted 18 August 2006 - 03:25 PM

tried to put it in but something doesnt seem to work.

ill keep crackin at it and i think you got me in the right direction.

thanks for all help!
-ps

#14 HeyRay2

HeyRay2
  • Members
  • PipPipPip
  • Advanced Member
  • 223 posts

Posted 18 August 2006 - 04:32 PM

What is not working?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users