Jay2391 Posted November 9, 2006 Share Posted November 9, 2006 ??? ??? ??? ??? ???Here what is up guys ...I have this listings right ...address, city, pic and so on ...I created an array so i can see 4 per page and is great but the info alings verticaly and my lovely brother in law wants the information to be horizontal and aling vertical like a table...anywaysin the first i ca see 4 listings but they do not aligned horizontal in the second work i did ...it alignes horizontal but I only get the last listing of the 4 .... can some one give me an idea how to solve this stupid issue of mine ...thanks[color=blue][font=Verdana]Origonal Code i can see 4 records perpage but they are not alingned horizontal...[/font][/color][code] <TD height="11" align="center" valign="top"><div align="left"><span class="style1"> <?php$row = array();$PicPart1 = "http://www.legacyrealtypros.com/ListPic/";$PicPart3 = "/Tum1.JPG";$user = "root";$pass = "12345";$dbh=mysql_connect ("localhost", $user, $pass) or die ('I cannot connect to the database because: ' . mysql_error());$rs = mysql_select_db ("jreina88_lrphomes");if(!isset($_GET['page'])) $page = 1; else $page = $_GET['page'];$max_results = 4;$from = (($page * $max_results) - $max_results);$sql = mysql_query("SELECT * FROM listings LIMIT $from, $max_results");While ($row = mysql_fetch_array($sql)){ $ListingID = $row['ListingID']; $Address = $row['Address']; $City = $row['City'] ; $State = $row['State'] ; $ZipCode = $row['ZipCode']; $SchoolDist = $row['SchoolDist']; $Price = $row['Price']; $Rooms = $row['Rooms']; $Bathrooms = $row['Bathrooms']; $Sq_ft = $row['Sq_ft']; $Agent = $row['Agent']; $PicPart2 = $ListingID; $PicFinal = $PicPart1 . $PicPart2 . $PicPart3; $Display = "<img src=\"$PicFinal\"<br> "; echo "<a href=\"lrplist.php?ListingID=$ListingID\">$Display</a><br><br>"; echo ("Address: $Address<br>City: $City , $State<br> School District: $SchoolDist<br>"); echo ("Price: $Price<br> Rooms: $Rooms Bathrooms: $Bathrooms<br> Sqr FT: $Sq_ft"); echo ("<br> Agent: $Agent<br><br><br>"); }$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM Listings"), 0);$total_pages = ceil($total_results / $max_results);echo "<center>Select a Page<br />";if($page > 1){ $prev = ($page - 1); echo "<a href= \"" . $_SERVER['PHP_SELF'] . "?page=$prev\">Previous</a>";}for($i = 1; $i <= $total_pages; $i++){ if(($page) == $i){ echo "| $i "; } else { echo "| <a href= \"".$_SERVER['PHP_SELF']."?page=$i\">$i</a> "; }}if($page < $total_pages){ $next = $page + 1; echo "| <a href= \"". $_SERVER['PHP_SELF'] . "?page=$next\">Next</a>";} else echo '|'; ?> </span></div></TD> </TR>[/code][color=red][font=Verdana]This is what I did to aling Horizontal and vertical but all i get is one record per page instead of 4....[/font][/color][code]<?php$row = array();$PicPart1 = "http://localhost/legacy/ListPic/";$PicPart3 = "/Tum1.JPG";$user = "root";$pass = "12345";$dbh=mysql_connect ("localhost", $user, $pass) or die ('I cannot connect to the database because: ' . mysql_error());$rs = mysql_select_db ("jreina88_lrphomes");if(!isset($_GET['page'])) $page = 1; else $page = $_GET['page'];$max_results = 4;$from = (($page * $max_results) - $max_results);$sql = mysql_query("SELECT * FROM listings LIMIT $from, $max_results");While ($row = mysql_fetch_array($sql)){ $ListingID = $row['ListingID']; $Address = $row['Address']; $City = $row['City'] ; $State = $row['State'] ; $ZipCode = $row['ZipCode']; $SchoolDist = $row['SchoolDist']; $Price = $row['Price']; $Rooms = $row['Rooms']; $Bathrooms = $row['Bathrooms']; $Sq_ft = $row['Sq_ft']; $Agent = $row['Agent']; $PicPart2 = $ListingID; $PicFinal = $PicPart1 . $PicPart2 . $PicPart3; $Display = "<img src=\"$PicFinal\"<br> "; }?> </span> </div></TD> </TR> <TR> <TD width="121" height="11" align="center" valign="top"><div align="center"><?php echo ("<a href=\"lrplist.php?ListingID=$ListingID\">$Display</a><br><br>");?></div></TD> <TD width="206" align="center" valign="top"><div align="center"><?php echo ("$Address <br>");?></div></TD> <TD width="75" align="center" valign="top"><div align="center"><?php echo ("$City <br>");?></div></TD> <TD width="40" align="center" valign="top"><div align="center"><?php echo ("$State <br>");?></div></TD> <TD width="72" align="center" valign="top"><div align="center"><?php echo ("$Price <br>");?></div></TD> <TD width="75" align="center" valign="top"><div align="center"><?php echo ("$Sq_ft <br>");?></div></TD> <TD width="73" align="center" valign="top"><div align="center"><?php echo ("$Rooms/$Bathrooms <br>");?></div></TD> <TD width="99" align="center" valign="top"><div align="center"><?php echo ("$Agent <br>");?></div></TD> </TR> <TR> <TD height="21" colspan="8" align="center" valign="top"><div align="left"><?php$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM Listings"), 0);$total_pages = ceil($total_results / $max_results);echo "<center>Select a Page<br />";if($page > 1){ $prev = ($page - 1); echo "<a href= \"" . $_SERVER['PHP_SELF'] . "?page=$prev\">Previous</a>";}for($i = 1; $i <= $total_pages; $i++){ if(($page) == $i){ echo "| $i "; } else { echo "| <a href= \"".$_SERVER['PHP_SELF']."?page=$i\">$i</a> "; }}if($page < $total_pages){ $next = $page + 1; echo "| <a href= \"". $_SERVER['PHP_SELF'] . "?page=$next\">Next</a>";} else echo '|'; ?>[/code]MOD EDIT: Code tags added - please use them Quote Link to comment https://forums.phpfreaks.com/topic/26732-aligment-dilema/ Share on other sites More sharing options...
Psycho Posted November 9, 2006 Share Posted November 9, 2006 You need to enclose your code within CODE tags, otherwise some of it will be processed by the forum - for instance your break tags are not showing up in the forum. Anyway, you have bigger problems than alignment. There are a lot of errors in your code. For example you are not putting a closing bracket on your image tag ">".Anyway, you can achieve what you want with just a simple change in your original code. Int he image tag add the property [/b]align="left"[/b]Then remove all line breaks between the image and the address.Finally, after the address have the first break include the property clear="all"Something like this:[code]<?phpWhile ($row = mysql_fetch_array($sql)){ $ListingID = $row['ListingID']; $Address = $row['Address']; $City = $row['City'] ; $State = $row['State'] ; $ZipCode = $row['ZipCode']; $SchoolDist = $row['SchoolDist']; $Price = $row['Price']; $Rooms = $row['Rooms']; $Bathrooms = $row['Bathrooms']; $Sq_ft = $row['Sq_ft']; $Agent = $row['Agent']; $PicPart2 = $ListingID; $PicFinal = $PicPart1 . $PicPart2 . $PicPart3; $Display = "<img src=\"$PicFinal\">"; echo "<a href=\"lrplist.php?ListingID=$ListingID\">$Display</a>"; echo ("Address: $Address<br>City: $City , $State<br>School District: $SchoolDist<br>"); echo ("Price: $Price<br> Rooms: $Rooms, Bathrooms: $Bathrooms<br>Sqr FT: $Sq_ft"); echo (" Agent: $Agent<br clear=\"all\"><br><br>"); }?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/26732-aligment-dilema/#findComment-122287 Share on other sites More sharing options...
Jay2391 Posted November 13, 2006 Author Share Posted November 13, 2006 Ii read your post an I kow I can do it that way ...but the subjects neet to align vertical like this...A b cName Adress stateName Adress statedo you have any other ideas!!! Quote Link to comment https://forums.phpfreaks.com/topic/26732-aligment-dilema/#findComment-123921 Share on other sites More sharing options...
Jay2391 Posted November 13, 2006 Author Share Posted November 13, 2006 Just as a note like in my preavius post ....the adress fiels is going to have x amount of characters and name is going to have x amount and that is going to change .... but they should always start in thesame linegoing down and aligned to the left...I hope that explain better what I am trying to say.... Quote Link to comment https://forums.phpfreaks.com/topic/26732-aligment-dilema/#findComment-123935 Share on other sites More sharing options...
Barand Posted November 13, 2006 Share Posted November 13, 2006 Doesthis help?[code]<?phpinclude 'db.php';define ("NUMCOLS",3);$res = mysql_query("SELECT col1, col2 FROM mytable");$count = 0;echo "<TABLE border=1>";while (list($col1, $col2) = mysql_fetch_row($res)) { if ($count % NUMCOLS == 0) echo "<TR>\n"; # new row echo "<TD>$col1<br>$col2</TD>\n"; $count++; if ($count % NUMCOLS == 0) echo "</TR>\n"; # end row}# end row if not already endedif ($count % NUMCOLS != 0) { while ($count++ % NUMCOLS) echo "<td> </td>"; echo "</TR>\n";}echo "</TABLE>";?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/26732-aligment-dilema/#findComment-124031 Share on other sites More sharing options...
Jay2391 Posted November 13, 2006 Author Share Posted November 13, 2006 I didn't understand how your code works or put it o my code ... but anyways here is what i have find out so far ... now all I need is for everything but the picture to aling to the top instead os the bottom....here is the code and alittle example.... echo "<pre>"; printf ("%-15s%-35s%-14s%-10s%-13s%-17s\n", "<br><a href=\"lrplist.php?ListingID=$ListingID\">$Display</a> ", "$Address - $City", "$Price ","$Rooms/$Bathrooms ", "$Sq_ft ", "$Agent"); echo "</pre>"; This is how it comes out right now...."Imagine the lines is a picture"_____________________________________________ address infor numbers ectI need it to show like this ......._________ __________________ address infor numbers ect__________________ Quote Link to comment https://forums.phpfreaks.com/topic/26732-aligment-dilema/#findComment-124101 Share on other sites More sharing options...
Psycho Posted November 13, 2006 Share Posted November 13, 2006 In the image add the attribute align="top". This will make the text start at the top of the image. Then you need to add a line break between each line of text. Quote Link to comment https://forums.phpfreaks.com/topic/26732-aligment-dilema/#findComment-124131 Share on other sites More sharing options...
Jay2391 Posted November 17, 2006 Author Share Posted November 17, 2006 okay where do i put that atribute Quote Link to comment https://forums.phpfreaks.com/topic/26732-aligment-dilema/#findComment-126187 Share on other sites More sharing options...
Psycho Posted November 17, 2006 Share Posted November 17, 2006 In the image TAG.<img src="file.jpg" align="top"> Quote Link to comment https://forums.phpfreaks.com/topic/26732-aligment-dilema/#findComment-126204 Share on other sites More sharing options...
Jay2391 Posted November 17, 2006 Author Share Posted November 17, 2006 does not work, i get error unespected '<' Quote Link to comment https://forums.phpfreaks.com/topic/26732-aligment-dilema/#findComment-126266 Share on other sites More sharing options...
Psycho Posted November 17, 2006 Share Posted November 17, 2006 Then you are not doing it correctly. All I am talking about is to add the [b]align="top"[/b] attribute to the image tags. You were creating your image tags incorrectly before, make sure they are properly formatted. Quote Link to comment https://forums.phpfreaks.com/topic/26732-aligment-dilema/#findComment-126334 Share on other sites More sharing options...
Jay2391 Posted November 21, 2006 Author Share Posted November 21, 2006 This is the table where the picture and data gets display....<TD height="11" align="center" [color=red]valign="top"><[/[/color]font]div align="left"><span class="style1">and as you can see is top ... that is my issue I have an array that display everything on that table cell ....I try separating the tables with colums but then I only get one listing ....check my first post and you will see how i explain the issueStill is Not working .... any new ideas Quote Link to comment https://forums.phpfreaks.com/topic/26732-aligment-dilema/#findComment-128118 Share on other sites More sharing options...
Psycho Posted November 21, 2006 Share Posted November 21, 2006 You need to reread what I said. I said to put the align attribute in the IMAGE tag not the TD tag. Quote Link to comment https://forums.phpfreaks.com/topic/26732-aligment-dilema/#findComment-128147 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.