Jump to content

Tables not aligning within .php


ladysniper

Recommended Posts

I'm having a HORRIBLE time getting my tables to align after a search. Can anyone look at this code and see just what is wrong with it? To get the search results...go to www.azsoma.info/directory.htm and type 86336 in the zip box and you will get the results.php page. It's got to be in the .php coding itself somewhere, but I cannot for the life of me find it. Any help would be GREATLY appreciated!

[code]
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>Directory Search Results</title>
  </head>

<body bgcolor="#000000">
<div align="center">

<table width="800" border="1" cellpadding="0" cellspacing="0" height="100%">
<table width ="800" border="1" cellpadding="0" cellspacing="0" height="15%>

  <tr>
    <td width="4"></td><td valign="top" align="center" height="19%">
     <img border="0" src="images/header3.gif" width="800" height="150"></td></tr></table>

       <table width ="800" border="1" cellpadding="0" cellspacing="0" height="10%">
<tr>
             <td width ="800" height="19" bgcolor="e1d7a4" valign="top" align="center">

<p style="margin-left: 25"><br>
<font face="Rockwell" size="2" color="#990000"> <font color="FF7256">
<a href="/index.htm"><font color="#990000">Home</font></a></font><font color="#990000">    
</font> <font color="FF7256">
<a href="application.htm"><font color="#990000">Member Application</font></a><font color="#990000">    
</font>
<a href="/membership.htm"><font color="#990000">Member Benefits/Products</font></a><font color="#990000">     
</font>
<a href="/directory.htm"><font color="#990000">Member Directory</font></a><font color="#990000">     
</font>
<a href="/news.htm"><font color="#990000">Announcements/News/Links</font></a></font></font></p></td></tr></table>

<table width="800" border="1" cellpadding="0" cellspacing="0" align="center">
<tr>
      <td border="0" valign="top" align="center" colspan="3"><img src="/images/qi-gong2_11.jpg" width="800" height="35" alt=""></td></tr>
       <tr>
          <td valign="top" align="right"> <img src="/images/qi-gong2_12.jpg" width="80" height="41" alt=""></td>
    <td valign="top" align="center"> <img src="/images/qi-gong2_13.jpg" width="599" height="41" alt=""></td>
        <td valign="top" align="center"> <img src="/images/qi-gong2_14.jpg" width="121" height="41" alt=""></td></tr></table>

<table width = "800" border ="1" cellpadding="0" cellspacing="0" align="center" background="images/qi-gong2_16.jpg">
    <form method="post" action="http://azsoma.info/results.php">




          <!--    <table width="800" border="1" cellpadding="1" cellspacing="0" align="center" background="images/qi-gong2_16.jpg" height="100%">          -->
              
<!--         <tr>

<!--          <td width="60" valign="top"><b>id</b></td>  -->
<!--          <td width="20%"><font size="3" color="990000">Full Name</font></td> -->
<!--          <td width="30%"><font size="3" color="990000">Address</font></td> -->
<!--           <td width="10%"><font size="3" color="990000">City</font></td>  -->
<!--           <td width="10%"><font size="3" color="990000">Zip</font></td>  -->
<!--           <td width="10%"><font size="3" color="990000">Phone</font></td>  -->
<!--           <td width="20%"><font size="3" color="990000">Website Address</font></td>  -->
<!--        </tr>  -->

        <tr>





<?php
//print_r($_POST);
//echo "<br>\n";

  $hostname = "db353.perfora.net"; // The Thinkhost DB server.
  $username = "dbo161766556"; // The username you created for this database.
  $password = "f5BAQ6HB"; // The password you created for the username.
  $usertable = "Members"; // The name of the table you made.
  $dbName = "db161766556"; // This is the name of the database you made.

  MYSQL_CONNECT($hostname, $username, $password) OR DIE("DB connection unavailable");
  @mysql_select_db( "$dbName") or die( "Unable to select database");

//error message (not found message)begins
// $XX = "No Record Found, to search again please close this window";

/*+-------------------------------------------------------------------------------------+
  | Query Details Begin:                                                                |
  +-------------------------------------------------------------------------------------+
  | Since I don't know if phpForms has a built in search function and I don't have time |
  | to try to decipher how they are storing/retrieving information from the tables,     |
  | this is the long way around it but it should work.                                  |
  +-------------------------------------------------------------------------------------+
  | May 2006 - AJM    re-edited by RJP                                                  |
  +-------------------------------------------------------------------------------------+*/

/*+-------------------------------------------------------------------------------------+
  | First we get all distinct records that have the matching criteria from the search   |
  | page (directory.htm)                                                                |
  +-------------------------------------------------------------------------------------+
  | Determine which fields they have used: Name, City, Zip - and build the WHERE clause |
  +-------------------------------------------------------------------------------------+*/
  $sql = "SELECT DISTINCT sub_rec_id "
        ."  FROM pf_submissions "
        ." WHERE ";

  if($_POST['Name']>"")
    $sql .= " (sub_fld_name LIKE '%name%' AND sub_fld_value LIKE '%". $_POST['Name']. "%') AND ";

  if($_POST['City']>"")
    $sql .= " (sub_fld_name LIKE '%city%' AND sub_fld_value LIKE '%". $_POST['City']. "%') AND ";

  if($_POST['Zip']>"")
    $sql .= " (sub_fld_name LIKE '%zip%' AND sub_fld_value LIKE '%". $_POST['Zip']. "%') AND ";

  $sql .= " 1=1 "
         ." ORDER BY sub_rec_id ASC";

//echo "sql=".$sql."<br>\n";
  $qry = mysql_query($sql);

/*+-------------------------------------------------------------------------------------+
  | Now, if there are any records, we'll step through getting the name first.           |
  +-------------------------------------------------------------------------------------+*/
  while($row=@mysql_fetch_array($qry))
  {
    $sqlName = "SELECT sub_fld_value "
              ."  FROM pf_submissions "
              ." WHERE sub_rec_id = '" .$row["sub_rec_id"]. "' "
              ."   AND sub_fld_name = 'Full Name'";
//echo "sqlName=".$sqlName."<br>\n";

    $qryName = mysql_query($sqlName);
    $rowName = @mysql_fetch_row($qryName);
//print_r($rowName);
//print("<br>\n");

    print("      <tr height='20'><td valign='top'><p style='margin-left:150'><font size='2'>".$rowName[0]."</font></td></tr><br>\n");

    /*+---------------------------------------------------------------------------------+
    | Now, if there are any records, we'll step through getting the office address.     |
    +-----------------------------------------------------------------------------------+*/
      $sqlAddress = "SELECT sub_fld_value "
                 ."  FROM pf_submissions "
                 ." WHERE sub_rec_id = '" .$row["sub_rec_id"]. "' "
                 ."   AND sub_fld_name = 'Office Address'";
// echo "sqlAddress=".$sqlAddress."<br>\n";

      $qryAddress = mysql_query($sqlAddress);
      $rowAddress = @mysql_fetch_row($qryAddress);
    print("      <tr height='20' valign='top'><td valign='top'><p style='margin-left:150'><font size='2'>".$rowAddress[0]."</font></td></tr><br>\n");


  /*+-----------------------------------------------------------------------------------+
  | Now, if there are any records,  For now we get the Office City.                     |
  +-------------------------------------------------------------------------------------+*/
    $sqlCity = "SELECT sub_fld_value "
               ."  FROM pf_submissions "
               ." WHERE sub_rec_id = '" .$row["sub_rec_id"]. "' "
               ."   AND sub_fld_name = 'Office City'";
//echo "sqlCity=".$sqlCity."<br>\n";

    $qryCity = mysql_query($sqlCity);
    $rowCity = @mysql_fetch_row($qryCity);
    print("      <tr height='20'><td valign='top'><p style='margin-left:150'><font size='2'>".$rowCity[0]."</font></td></tr><br>\n");

/*+-------------------------------------------------------------------------------------+
  | Now, if there are any records, we'll step through getting the Office zip.           |
  | RJP 05/17/06                                                                        |
  +-------------------------------------------------------------------------------------+*/
    $sqlZip = "SELECT sub_fld_value "
               ."  FROM pf_submissions "
               ." WHERE sub_rec_id = '" .$row["sub_rec_id"]. "' "
               ."   AND sub_fld_name = 'Office Zip'";
//echo "sqlZip=".$sqlZip."<br>\n";

    $qryZip = mysql_query($sqlZip);
    $rowZip = @mysql_fetch_row($qryZip);
    print("      <tr height='20'><td valign'top'><p style='margin-left:150'><font size='2'>".$rowZip[0]."</font></td></tr><br>\n");

/*+------------------------------------------------------------------------------------+
  | Now, if there are any records, we'll step through getting the Office Phone Number.  |
  | RJP 05/17/06                                                                        |
  +-------------------------------------------------------------------------------------+*/
    $sqlPhone = "SELECT sub_fld_value "
               ."  FROM pf_submissions "
               ." WHERE sub_rec_id = '" .$row["sub_rec_id"]. "' "
               ."   AND sub_fld_name = 'Office Phone'";
//echo "sqlPhone=".$sqlPhone."<br>\n";

    $qryPhone = mysql_query($sqlPhone);
    $rowPhone = @mysql_fetch_row($qryPhone);
    print("      <tr height='20'><td valign='top'><p style='margin-left:150'><font size='2'>".$rowPhone[0]."</font></td></tr><br>\n");

/*+------------------------------------------------------------------------------------+
  | Now, if there are any records, we'll step through getting the Website. RJP 05/17/06 |
  +-------------------------------------------------------------------------------------+*/
    $sqlWeb = "SELECT sub_fld_value "
               ."  FROM pf_submissions "
               ." WHERE sub_rec_id = '" .$row["sub_rec_id"]. "' "
               ."   AND sub_fld_name = 'Website Address'";
//echo "sqlWeb=".$sqlWeb."<br>\n";

    $qryWeb = mysql_query($sqlWeb);
    $rowWeb = @mysql_fetch_row($qryWeb);
    print("      <tr height='20'><td valign='top'><p style='margin-left:150'><font size='2'>".$rowWeb[0]."</font></td></tr><br>\n");




/*+-------------------------------------------------------------------------------------+
  | Now, if there are any records, we'll step through getting the Birthday? There is no |
  | Birthday record in the pf_submissions table. If it's somewhere else, need to find   |
  | it and point this query to that table. For now we get the Office City.              |
  +-------------------------------------------------------------------------------------+*/
//    $sqlCity = "SELECT sub_fld_value "
//               ."  FROM pf_submissions "
//               ." WHERE sub_rec_id = '" .$row["sub_rec_id"]. "' "
//              ."   AND sub_fld_name = 'Office City'";
//echo "sqlCity=".$sqlCity."<br>\n";

//    $qryCity = mysql_query($sqlCity);
//    $rowCity = @mysql_fetch_row($qryCity);
//    echo "        <td>".$rowCity[0]."</td>\n";

    print("    </p></tr>\n");
  }

//below this is the function for no record!!
  if (!$variable1)
  {
    print ("$XX");
   // echo "      </tr>\n";
  }
//end
?>                </table>

      </table>

     </div>
  </body>

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

This isn't a php problem. It's all caused by the frankly awful html coding you have. Here's a few things that are wrong:

There are immediately consecutive <tr> tags - that won't work.
There are immediately consecutive <table> tags - that won't work
There are orphan <br> elements between <tr> tags - that won't work.
You have an orphan form opening statement (in the wrong place, and no closing element). Looks like a cut'n'paste error to me.

Here's a starter. Change this:
[code]    print("      <tr height='20'><td valign'top'><p style='margin-left:150'><font size='2'>".$rowZip[0]."</font></td></tr><br>\n");
[/code]
To this:
[code]    print("      <tr'><td valign'top'><p style='margin-left:150'><font size='2'>".$rowZip[0]."</font></p></td></tr>\n");
[/code]
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.