REOL Posted August 22, 2006 Share Posted August 22, 2006 i want to have the "<h1>" tags only display once. I am having trouble setting an array for it.can someone help me out?also how do i display a reuslt twice, add a row, then display again?[code]<?phpinclude_once( "format.php" );$city = $_GET['city'];if ($city) :$query = "SELECT * FROM properties WHERE city='$city' ORDER BY propid";$results = pgdbsql( $query, "my_table" );?><?phpforeach ( $results as $result ) {?><h1>Properties in <?php= $result['city'] ?>, <?php= $result['state']?></h1><table cellspacing=2 cellpadding=1 border=0> <tr><td vAlign=top><a href="property_overview.php?propid=<?php= $result['propid'] ?>"><?phpif(file_exists("img_property/{$result['propid']}_thumb.gif")) {?> <img src="img_property/<?php= $result['propid'] ?>_thumb.gif" border=0><?php } else { ?><img src="img_property/prop_na.jpg" border=0><?php } ?></a></td><td class=tiny vAlign=top><span class=tiny_red><?php= $result['name'] ?></span><br /><?php= $result['address'] ?><p><img src="img_property/icon_<?php= $result['type'] ?>.gif" border=0></td> </tr></table><?php}endif;?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/18300-displaying-a-query/ Share on other sites More sharing options...
ToonMariner Posted August 22, 2006 Share Posted August 22, 2006 <?php= $result['X'] ?>to <?php echo $result['X']; ?> Quote Link to comment https://forums.phpfreaks.com/topic/18300-displaying-a-query/#findComment-78604 Share on other sites More sharing options...
REOL Posted August 22, 2006 Author Share Posted August 22, 2006 yes i know i just put it like that so you can see the code properlly!-ps Quote Link to comment https://forums.phpfreaks.com/topic/18300-displaying-a-query/#findComment-78606 Share on other sites More sharing options...
wildteen88 Posted August 22, 2006 Share Posted August 22, 2006 Chnage this:[code]?><?phpforeach ( $results as $result ) {?><h1>Properties in <?php= $result['city'] ?>, <?php= $result['state']?></h1>[/code]To this:[code]echo '<h1>Properties in ' . $results['city'] . ', ' . $results['state'] . '</h1>';foreach ( $results as $result ) {?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/18300-displaying-a-query/#findComment-78615 Share on other sites More sharing options...
REOL Posted August 22, 2006 Author Share Posted August 22, 2006 thanks!it didnt originally work but this worked instead echo '<h1>Properties in ' . $results[0]['city'] . ', ' . $results[0]['state'] . '</h1>';... know how to display two results, then add a row then display the next two results after that?-ps Quote Link to comment https://forums.phpfreaks.com/topic/18300-displaying-a-query/#findComment-78622 Share on other sites More sharing options...
REOL Posted August 22, 2006 Author Share Posted August 22, 2006 anyone know how to display two outputs, then add a row, and then continue with the array/-ps Quote Link to comment https://forums.phpfreaks.com/topic/18300-displaying-a-query/#findComment-78634 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.