I'm DESPERATE for Table Help in .php
Posted: Sun May 28, 2006 5:05 pm
DESPERATE doesn't begin to describe it.

Can someone PLEASE tell me what is WRONG with this code?
Now..a bit of background. It is a search results page for http://www.azsoma.info/directory.htm. (use Scottsdale for the city)
If you go look, you see that the search results post (I do have my table borders up for debugging) but it doesn't line up with the table above it...the whole scroll background doesn't show up and I cannot get my results to have a space between them. And on top of it...they want an inline frame! I haven't even attempted that...at all....
Please...can someone help me. Hell, I'll pay someone if I have to...be glad to...but this page needs to be done for the client....
Warning...long coding....
Thank you in advance....please, if someone could/would help me....
Can someone PLEASE tell me what is WRONG with this code?
Now..a bit of background. It is a search results page for http://www.azsoma.info/directory.htm. (use Scottsdale for the city)
If you go look, you see that the search results post (I do have my table borders up for debugging) but it doesn't line up with the table above it...the whole scroll background doesn't show up and I cannot get my results to have a space between them. And on top of it...they want an inline frame! I haven't even attempted that...at all....
Please...can someone help me. Hell, I'll pay someone if I have to...be glad to...but this page needs to be done for the client....
Warning...long coding....
Thank you in advance....please, if someone could/would help me....
Code: Select all
<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" background="images/scroll.jpg" length="800">
<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>Code: Select all
<?php
//print_r($_POST);
//echo "<br>\n";
$hostname = "***DON'T SHOW US YOUR LOGIN INFO SILLY***"; // The Thinkhost DB server.
$username = "***DON'T SHOW US YOUR LOGIN INFO SILLY***"; // The username you created for this database.
$password = "***DON'T SHOW US YOUR LOGIN INFO SILLY***"; // The password you created for the username.
$usertable = "***DON'T SHOW US YOUR LOGIN INFO SILLY***"; // The name of the table you made.
$dbName = "***DON'T SHOW US YOUR LOGIN INFO SILLY***"; // 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 state. |
| RJP 05/28/06 |
+-------------------------------------------------------------------------------------+*/
$sqlState = "SELECT sub_fld_value "
." FROM pf_submissions "
." WHERE sub_rec_id = '" .$row["sub_rec_id"]. "' "
." AND sub_fld_name = 'Office State'";
//echo "sqlState=".$sqlState."<br>\n";
$qryState = mysql_query($sqlState);
$rowState = @mysql_fetch_row($qryState);
print(" <tr height='20'><td valign'top'><p style='margin-left:150'><font size='2'>".$rowState[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");
print(" </tr>\n");
}
//below this is the function for no record!!
if (!$variable1)
{
print ("$XX");
// echo " </tr>\n";
}
//end
?>
</table>
</table>
</div>
</body>
</html>