Jump to content

Aligment Dilema


Jay2391

Recommended Posts

??? ??? ??? ??? ???

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...anyways
in 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
Link to comment
Share on other sites

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]<?php
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\">";

            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]
Link to comment
Share on other sites

Ii read your post an I kow I can do it that way ...but the subjects neet to align vertical like this...


A                      b                                  c
Name                  Adress                          state
Name                  Adress                          state

do you have any other ideas!!!
Link to comment
Share on other sites

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....
Link to comment
Share on other sites

Doesthis help?
[code]
<?php
include '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 ended

if ($count % NUMCOLS != 0) {
  while ($count++ % NUMCOLS) echo "<td>&nbsp;</td>";
  echo "</TR>\n";
}
echo "</TABLE>";

?>
[/code]
Link to comment
Share on other sites

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      ect


I need it to show like this .......

_________     
_________
_________      address    infor      numbers      ect
_________
_________



Link to comment
Share on other sites

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 issue


Still is Not working .... any new ideas

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.