JTapp Posted April 17, 2008 Share Posted April 17, 2008 I'm getting all of the data I am asking for, its just my immature beginner's code is coupling all of the data into one table. Can somebody help me? ??? What you will find in the code below is a table, some php (let's call it Data1) and some more php (let's call it Data2). The table I have works fine and I want Data2 to populate it- and it is doing just that. However the data in php Data1 should not be in this table.. I need to have it at the top of my page but in its own table. Arrgh! It's driving me crazy and it's probably very SIMPLE! <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> </head> <body> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tbody> <tr> <td width="100%"><p align="center"><span class="style2"> Grand Lodge of Florida Lodge Locator</span><br /> </p></td> </tr> </tbody> </table> <center> </center> <center> <br /> <br /> <table border="1" cellpadding="4" cellspacing="0" width="86%"> <tbody> <tr> <td colspan="5" bgcolor="FFFF99" height="18"><center> <strong>Results Of Your Search </strong> </center></td> </tr> <tr> <td width="13%" height="18" align="center" bgcolor="FFFF99"><center> Lodge ID Number </center></td> <td width="19%" height="18" align="center" bgcolor="FFFF99"><center> Lodge Name </center></td> <td width="20%" align="center" bgcolor="FFFF99"> Click Button To View <strong>Lodge Details </strong></td> <td width="18%" height="18" align="center" bgcolor="FFFF99"><center> City </center></td> <td width="10%" height="18" align="center" bgcolor="FFFF99"><center> District Number </center></td> </tr> <?php $username = "username"; $password = "pswd"; $hostname = "localhost"; $dbhandle = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL"); $selected = mysql_select_db("dbb",$dbhandle) or die("Could not select dbb"); $id = $_POST['search']; echo $id; $query = "SELECT a.strLodgeName, a.intLodgeNumber, a.intDistrictID, a.strLodgeMailingCity, a.strLodgeMailingPostCode, b.strDistrictName, b.strDistrictWebSite, c.strOfficerTitle, c.strFirstName, c.strLastName, c.OfficePhone, c.Email FROM tblDistricts AS b LEFT JOIN tblLodges AS a ON b.intDistrictID = a.intDistrictID LEFT JOIN DistrictOfficers AS c ON a.intDistrictID = c.intDistrictID WHERE b.intDistrictID='$id' GROUP BY c.strOfficerTitle LIMIT 2"; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)){ echo $row["strDistrictWebSite"]; echo "</center></td><td><center>"; echo "<tr bgcolor=\"#dddddd\"><td><center>"; echo $row["strOfficerTitle"]; echo "</center></td><td><center>"; echo $row["strFirstName"]; echo "</center></td><td><center>"; echo $row["strLastName"]; echo "</center></td><td><center>"; echo $row["OfficePhone"]; echo "</center></td><td><center>"; echo $row["Email"]; } ?> <?php $username = "uname"; $password = "pwrd"; $hostname = "localhost"; $dbhandle = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL"); $selected = mysql_select_db("dbb",$dbhandle) or die("Could not select dbb"); $query = mysql_query("SELECT strLodgeName, intLodgeNumber, intDistrictID, strLodgeMailingCity, strLodgeMailingPostCode FROM tblLodges WHERE TRIM(LEADING '0' FROM $metode) = '$search' GROUP BY strLodgeName LIMIT 50"); while ($row = @mysql_fetch_array($query)) { echo "<tr bgcolor=\"#dddddd\"><td><center>"; echo $row["intLodgeNumber"]; echo "</center></td><td><center>"; echo $row["strLodgeName"]; echo "</center></td><td><center><span class=\"style2\">"; echo "<input name=\"submit\" type=\"button\" value=\"Lodge Details\" onclick=\"javascript:window.location='3view.php?id="; echo $row["intLodgeNumber"]; echo "'\" /></center></td>"; echo "</center></td><td><center>"; echo $row["strLodgeMailingCity"]; echo "</center></td><td><center>"; echo ltrim($row["intDistrictID"], '0'); }?> </tbody> </table> <br /> </center> </body> </html> Quote Link to comment Share on other sites More sharing options...
JTapp Posted April 17, 2008 Author Share Posted April 17, 2008 Never mind.. I'm just bug-eyed and tired. I figured it out. Quote Link to comment 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.