CountryGirl Posted April 1, 2010 Share Posted April 1, 2010 My initial search result page only returns a few results (as I want) and then the account number is linked to a more detailed search result page (www.wagonerassessor.com/searchlink.php - search example "730000003"). Now, I gotta be able to have the detailed results show up in the appropriate spaces on a page that looks like this - www.wagonerassessor.com/formresults.html, just in a .php page. I'm sure it's not too difficult and it's just a matter of linking the $result to the tables. But, how exactly would I do that? Would I add the table/field name to the right spot in the table HTML and then have it linked back to the PHP coding? Here's the code I have on formresults.php. I know I have some extra coding in there, that I'm not going to use (in the $result) spot, but I'm thinking I probably have to tie in all that table HTML somehow similarily to how the $result table area is. Ideas? Suggestions? Any help is greatly appreciated! <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <?php $dbHost = $dbUser = $dbPass = $dbDatabase = $con = mysql_connect($dbHost, $dbUser, $dbPass) or die("Failed to connect to MySQL Server. Error: " . mysql_error()); mysql_select_db($dbDatabase) or die("Failed to connect to database {$dbDatabase}. Error: " . mysql_error()); $query = "SELECT Appr_Value.ApprID as id, Appr_Value.Account, Asmnt_Parcel.OwnersName, Asmnt_Situs.Situs FROM Appr_Value INNER JOIN Asmnt_Parcel ON Appr_Value.Account=Asmnt_Parcel.Account INNER JOIN Asmnt_Situs ON Appr_Value.Account=Asmnt_Situs.Account WHERE Appr_Value.Account LIKE '{$search}' AND Appr_Value.ApprID = '".mysql_real_escape_string($_GET['id'])."' ORDER BY Appr_Value.Account ASC"; $result = mysql_query($query, $con) or die(mysql_error().": $query"); if ($result) { echo "Results:<br><br>"; echo "<table width=90% align=center border=1><tr> <td align=center bgcolor=#4A6B3F>Account</td> </tr>"; while ($r = mysql_fetch_array($result)) { // Begin while $act = $r["Account"]; echo "<tr> <td>$act</td> </tr>"; } // end while echo "</table>"; ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <meta name="generator" content="Adobe GoLive" /> <title>Search Results</title> </head> <body background="(EmptyReference!)" bgcolor="#bba86d"> <div align="left"> </div> <div align="center"> <div style="position:relative;width:871px;height:912px;-adbe-g:p;"> <div style="position:absolute;top:384px;left:2px;width:434px;height:138px;"> <table width="434" border="1" cellspacing="2" cellpadding="0"> <tr align="left"> <td><font size="2" color="#352200" face="Georgia, Times New Roman, Times, serif"><strong>Account:</strong></font> <p><font size="2" color="#352200" face="Georgia, Times New Roman, Times, serif"><strong>Name ID:</strong></font></p> <p><font size="2" color="#352200" face="Georgia, Times New Roman, Times, serif"><strong>Address:</strong></font></p> <p><font size="2" color="#352200" face="Georgia, Times New Roman, Times, serif"><strong>Situs:</strong></font></p> </td> </tr> </table> </div> <div style="position:absolute;top:384px;left:436px;width:434px;height:122px;"> <table width="434" border="1" cellspacing="2" cellpadding="0"> <tr> <td> <div align="left"> <font size="2" color="#352200" face="Georgia, Times New Roman, Times, serif"><strong>Instrument Number:</strong></font> <p><font size="2" color="#352200" face="Georgia, Times New Roman, Times, serif"><strong>Grantor:</strong></font></p> <p><font size="2" color="#352200" face="Georgia, Times New Roman, Times, serif"><strong>Sale Date:</strong></font></p> <p><font size="2" color="#352200" face="Georgia, Times New Roman, Times, serif"><strong>Sale Price:</strong></font></p> </div> </td> </tr> </table> </div> <div style="position:absolute;top:544px;left:2px;width:434px;height:69px;"> <table width="434" border="1" cellspacing="2" cellpadding="0"> <tr align="right"> <td> <div align="left"> <font size="2" color="#352200" face="Georgia, Times New Roman, Times, serif"><strong>Legal Description:</strong></font> <p></p> </div> </td> </tr> </table> </div> <div style="position:absolute;top:350px;left:34px;width:800px;height:33px;"> <table width="800" border="1" cellspacing="2" cellpadding="0"> <tr> <td> <div align="center"> <font size="4" color="#003300" face="Georgia, Times New Roman, Times, serif">Wagoner County Public Records Search Results:</font></div> </td> </tr> </table> </div> <div style="position:absolute;top:544px;left:436px;width:434px;height:94px;"> <table width="434" border="1" cellspacing="2" cellpadding="0"> <tr align="right"> <td> <div align="left"> <font size="2" color="#352200" face="Georgia, Times New Roman, Times, serif"><strong>Exemption Type:</strong></font> <p><font size="2" color="#352200" face="Georgia, Times New Roman, Times, serif"><strong>Exemption:</strong></font></p> <p><font size="2" color="#352200" face="Georgia, Times New Roman, Times, serif"><strong>Code:</strong></font></p> </div> </td> </tr> </table> </div> <div style="position:absolute;top:656px;left:1px;width:209px;height:77px;"> <table width="209" border="1" cellspacing="2" cellpadding="0"> <tr> <td> <div align="left"> <font size="2" color="#352200" face="Georgia, Times New Roman, Times, serif"><strong>Land Value:</strong></font></div> <p></p> </td> </tr> </table> </div> <div style="position:absolute;top:656px;left:227px;width:209px;height:77px;"> <table width="209" border="1" cellspacing="2" cellpadding="0"> <tr> <td> <div align="left"> <font size="2" color="#352200" face="Georgia, Times New Roman, Times, serif"><strong>Improvements:</strong></font></div> <p></p> </td> </tr> </table> </div> <div style="position:absolute;top:656px;left:437px;width:209px;height:77px;"> <table width="209" border="1" cellspacing="2" cellpadding="0"> <tr> <td> <div align="left"> <font size="2" color="#352200" face="Georgia, Times New Roman, Times, serif"><strong>Mobile Home:</strong></font></div> <p></p> </td> </tr> </table> </div> <div style="position:absolute;top:656px;left:659px;width:209px;height:69px;"> <table width="209" border="1" cellspacing="2" cellpadding="0"> <tr> <td> <div align="left"> <font size="2" color="#352200" face="Georgia, Times New Roman, Times, serif"><strong>Total Value:</strong></font> <p></p> </div> </td> </tr> </table> </div> <div style="position:absolute;top:752px;left:128px;width:306px;height:69px;"> <table width="306" border="1" cellspacing="2" cellpadding="0"> <tr> <td> <div align="left"> <font size="2" color="#352200" face="Georgia, Times New Roman, Times, serif"><strong>Assessed Value:</strong></font> <p></p> </div> </td> </tr> </table> </div> <div style="position:absolute;top:752px;left:436px;width:306px;height:69px;"> <table width="306" border="1" cellspacing="2" cellpadding="0"> <tr> <td> <div align="left"> <font size="2" color="#352200" face="Georgia, Times New Roman, Times, serif"><strong>Total Taxable:</strong></font> <p></p> </div> </td> </tr> </table> </div> <div style="position:absolute;top:0px;left:111px;width:648px;height:350px;"> <img src="toplogo3.jpg" alt="" height="350" width="648" border="0" /></div> </div> <p></p> </div> </body> </html> Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/197285-returning-results-in-defined-spots/ Share on other sites More sharing options...
Psycho Posted April 1, 2010 Share Posted April 1, 2010 OK, I'm not going to "weed" through all of your code, but I'll give you a direction to follow. Yoo already have a "template" of sorts with the HTML code. So, the rest is fairly simple. All you need to do is run the query at the top of the page. Then, if you need to "modify" any of the returned results (e.g. If a field is empty and you want it to state something like "Pending") then do that as well. Then simply echo the values int eh HTML. Here is a simple example: <?php $user_id = (int) $_GET['user_id']; $query = "SELECT name, phone, addr1, addr2, city, state, zip FROM users where user_id = '{$user_id}'"; $result = mysql_query($query); $record = mysql_fetch_assoc($result); $name = htmlentities($record['name']); $phone = htmlentities($record['phone']); //Create the address output $addressAry = array(); if (!empty($record['addr1']) { $addressAry[] = htmlentities($record['addr1']); } if (!empty($record['addr2']) { $addressAry[] = htmlentities($record['addr2']); } //Create & format the City, ST ZIP line if (!empty($record['city'] || !empty($record['state'] || !empty($record['zip']) { $cityStZip = ''; $cityStZip .= htmlentities($record['city']); if (!empty($record['city'] && !empty($record['state']) { $cityStZip .= ", "; } $cityStZip .= htmlentities($record['state']); if (!empty($cityStZip) && !empty($record['zip']) { $cityStZip .= " "; } $cityStZip .= htmlentities($record['zip']); $addressAry[] = $cityStZip; } $addressStr = implode("<br />\n", $addressAry); ?> <html> <body> Name: <?php echo $name; ?><br /> Phone: <?php echo $phone; ?><br /> Address:<br /> <?php echo $addressStr; ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/197285-returning-results-in-defined-spots/#findComment-1035522 Share on other sites More sharing options...
CountryGirl Posted April 7, 2010 Author Share Posted April 7, 2010 OK, I'm not going to "weed" through all of your code, but I'll give you a direction to follow. Yoo already have a "template" of sorts with the HTML code. So, the rest is fairly simple. All you need to do is run the query at the top of the page. Then, if you need to "modify" any of the returned results (e.g. If a field is empty and you want it to state something like "Pending") then do that as well. Then simply echo the values int eh HTML. Here is a simple example: <?php $user_id = (int) $_GET['user_id']; $query = "SELECT name, phone, addr1, addr2, city, state, zip FROM users where user_id = '{$user_id}'"; $result = mysql_query($query); $record = mysql_fetch_assoc($result); $name = htmlentities($record['name']); $phone = htmlentities($record['phone']); //Create the address output $addressAry = array(); if (!empty($record['addr1']) { $addressAry[] = htmlentities($record['addr1']); } if (!empty($record['addr2']) { $addressAry[] = htmlentities($record['addr2']); } //Create & format the City, ST ZIP line if (!empty($record['city'] || !empty($record['state'] || !empty($record['zip']) { $cityStZip = ''; $cityStZip .= htmlentities($record['city']); if (!empty($record['city'] && !empty($record['state']) { $cityStZip .= ", "; } $cityStZip .= htmlentities($record['state']); if (!empty($cityStZip) && !empty($record['zip']) { $cityStZip .= " "; } $cityStZip .= htmlentities($record['zip']); $addressAry[] = $cityStZip; } $addressStr = implode("<br />\n", $addressAry); ?> <html> <body> Name: <?php echo $name; ?><br /> Phone: <?php echo $phone; ?><br /> Address:<br /> <?php echo $addressStr; ?> </body> </html> Okay, I'm a little lost. This doesn't make all that much sense to me, as I think I just need a few more things explained. Sorry, but yes I am quite new to PHP :-\. Questions: Do I need to create something like these: " $name = htmlentities($record['OwnersName']); $nameid = htmlentities($record['NameID']); " for each result I want in my HTML? And the formatting? What exactly does that do? Tie in the results to the PHP? If someone could break this down a bit more for me, that'd be very appreciated! Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/197285-returning-results-in-defined-spots/#findComment-1038534 Share on other sites More sharing options...
Psycho Posted April 7, 2010 Share Posted April 7, 2010 It is good practice to separate your logic (PHP code to get and prepare the results) from the presentation (the HTML ouput). That is the process I illustrated above. The logic at the top of the script queries the database to get the data. I then used htmlentities() on those values the prevent against content corrupting the output and/or CSS attacks (explained more below). One that is done, then I populate the data into the pre-formatted HTML ouput. regarding htmlentities(), that function will change certain characters into their equivalent HTML escape characters. This prevents those characters from being interpreted by the browser. For example, if a user entered "<b>Bobby</b>" as their name, then their name would be displayed as Bobby because the bold tags would be interpreted by the browser. htmlentities() will convert the lessthan/greaterthan tags to < and > so what will be displayed is EXACTLY what the user entered: "<b>Bobby</b>". Of course, bold tags is a minor consequence. If you do not protect the output, users can inject JavaScript to make some really bad things happen: redirect the user to another site, crash the browser, load a virus, etc. Quote Link to comment https://forums.phpfreaks.com/topic/197285-returning-results-in-defined-spots/#findComment-1038599 Share on other sites More sharing options...
CountryGirl Posted April 12, 2010 Author Share Posted April 12, 2010 It is good practice to separate your logic (PHP code to get and prepare the results) from the presentation (the HTML ouput). That is the process I illustrated above. The logic at the top of the script queries the database to get the data. I then used htmlentities() on those values the prevent against content corrupting the output and/or CSS attacks (explained more below). One that is done, then I populate the data into the pre-formatted HTML ouput. regarding htmlentities(), that function will change certain characters into their equivalent HTML escape characters. This prevents those characters from being interpreted by the browser. For example, if a user entered "<b>Bobby</b>" as their name, then their name would be displayed as Bobby because the bold tags would be interpreted by the browser. htmlentities() will convert the lessthan/greaterthan tags to < and > so what will be displayed is EXACTLY what the user entered: "<b>Bobby</b>". Of course, bold tags is a minor consequence. If you do not protect the output, users can inject JavaScript to make some really bad things happen: redirect the user to another site, crash the browser, load a virus, etc. Hmm, okay. I'll try to figure it out. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/197285-returning-results-in-defined-spots/#findComment-1040477 Share on other sites More sharing options...
MatthewJ Posted April 12, 2010 Share Posted April 12, 2010 I mean no offense by this... but most people get a book, or go to a good tutorial site and start from scratch when they learn to write code... If you did that, you would then be able to request help for the specific portions you are having trouble with, at this point you're really just throwing things at the wall to see what sticks Quote Link to comment https://forums.phpfreaks.com/topic/197285-returning-results-in-defined-spots/#findComment-1040486 Share on other sites More sharing options...
Ken2k7 Posted April 12, 2010 Share Posted April 12, 2010 Hmm, okay. I'll try to figure it out. Thanks. You still confused? Basically, mjdamato is telling you what a good approach is. Though it may be a bit more complicated than you wanted it to be. He's basically telling you that you should keep PHP code and HTML code separate so they don't look like a mess. Since you already have the HTML, you can use it as a template, which you can think of as a Mad Lib story lol. Basically, you have some text, and you just want to replace a value here and there. That is simple. In your PHP code (the one you have now), you've done the query and now, you just have to put them in the HTML. This is easy. Just replace them with the respective variable. For example: <?php $dbHost = ''; $dbUser = ''; $dbPass = ''; $dbDatabase = ''; $con = mysql_connect($dbHost, $dbUser, $dbPass) or die("Failed to connect to MySQL Server. Error: " . mysql_error()); mysql_select_db($dbDatabase) or die("Failed to connect to database {$dbDatabase}. Error: " . mysql_error()); $query = "SELECT Appr_Value.ApprID as id, Appr_Value.Account, Asmnt_Parcel.OwnersName, Asmnt_Situs.Situs FROM Appr_Value INNER JOIN Asmnt_Parcel ON Appr_Value.Account=Asmnt_Parcel.Account INNER JOIN Asmnt_Situs ON Appr_Value.Account=Asmnt_Situs.Account WHERE Appr_Value.Account LIKE '{$search}' AND Appr_Value.ApprID = '".mysql_real_escape_string($_GET['id'])."' ORDER BY Appr_Value.Account ASC"; $result = mysql_query($query, $con) or die(mysql_error().": $query"); ?> .. some HTML ... <span><?php echo $result['name']; ?></span> .. some more HTML ... Does that help or not? Quote Link to comment https://forums.phpfreaks.com/topic/197285-returning-results-in-defined-spots/#findComment-1040489 Share on other sites More sharing options...
CountryGirl Posted April 12, 2010 Author Share Posted April 12, 2010 Hmm, okay. I'll try to figure it out. Thanks. You still confused? Basically, mjdamato is telling you what a good approach is. Though it may be a bit more complicated than you wanted it to be. He's basically telling you that you should keep PHP code and HTML code separate so they don't look like a mess. Since you already have the HTML, you can use it as a template, which you can think of as a Mad Lib story lol. Basically, you have some text, and you just want to replace a value here and there. That is simple. In your PHP code (the one you have now), you've done the query and now, you just have to put them in the HTML. This is easy. Just replace them with the respective variable. For example: <?php $dbHost = ''; $dbUser = ''; $dbPass = ''; $dbDatabase = ''; $con = mysql_connect($dbHost, $dbUser, $dbPass) or die("Failed to connect to MySQL Server. Error: " . mysql_error()); mysql_select_db($dbDatabase) or die("Failed to connect to database {$dbDatabase}. Error: " . mysql_error()); $query = "SELECT Appr_Value.ApprID as id, Appr_Value.Account, Asmnt_Parcel.OwnersName, Asmnt_Situs.Situs FROM Appr_Value INNER JOIN Asmnt_Parcel ON Appr_Value.Account=Asmnt_Parcel.Account INNER JOIN Asmnt_Situs ON Appr_Value.Account=Asmnt_Situs.Account WHERE Appr_Value.Account LIKE '{$search}' AND Appr_Value.ApprID = '".mysql_real_escape_string($_GET['id'])."' ORDER BY Appr_Value.Account ASC"; $result = mysql_query($query, $con) or die(mysql_error().": $query"); ?> .. some HTML ... <span><?php echo $result['name']; ?></span> .. some more HTML ... Does that help or not? Yes, that does help. That is more what I was looking for. Thank you. I will keep the information mjdamato has written and look into it more. But, at the moment I'm just trying to get something up. I can always go back and revise. Yes, I know I should read up more on PHP and I plan to do that. But, at the moment since I know the basics of it, this is where I'm at. Sorry if these are stupid questions, but the help is really appreciated . Okay, back to this code. This is what I've put on my page. I'm not returning any results for some reason though, even though I know there are results in these spots (that return on the not as detailed page). Where am I going wrong at? PHP: $con = mysql_connect($dbHost, $dbUser, $dbPass) or die("Failed to connect to MySQL Server. Error: " . mysql_error()); mysql_select_db($dbDatabase) or die("Failed to connect to database {$dbDatabase}. Error: " . mysql_error()); $query = "SELECT Appr_Value.ApprID as id, Appr_Value.Account, Asmnt_Parcel.OwnersName FROM Appr_Value INNER JOIN Asmnt_Parcel ON Appr_Value.Account=Asmnt_Parcel.Account WHERE Appr_Value.Account LIKE '{$search}' AND Appr_Value.ApprID = '".mysql_real_escape_string($_GET['id'])."' ORDER BY Appr_Value.Account ASC"; $result = mysql_query($query, $con) or die(mysql_error().": $query"); ?> Some of the HTML: <td><font size="2" color="#352200" face="Georgia, Times New Roman, Times, serif"><strong>Account:</strong></font><span><?php echo $result['Appr_Value.Account'];?></span> <p><font size="2" color="#352200" face="Georgia, Times New Roman, Times, serif"><strong>Name:</strong></font></p><span><?php echo $result['Asmnt_Parcel.OwnersName'];?></span> Thanks for the help! Quote Link to comment https://forums.phpfreaks.com/topic/197285-returning-results-in-defined-spots/#findComment-1040497 Share on other sites More sharing options...
the182guy Posted April 12, 2010 Share Posted April 12, 2010 mysql_query() only returns a resource, not any actual data. You need to call one of the other mysql functions to get the data returned from the query. Example $result = mysql_query($query, $con) or die(mysql_error().": $query"); if($result && mysql_num_rows($result) > 0) { while($row = mysql_fetch_assoc($result)) { // now you can access the data using $row['id'] etc } } Quote Link to comment https://forums.phpfreaks.com/topic/197285-returning-results-in-defined-spots/#findComment-1040501 Share on other sites More sharing options...
Ken2k7 Posted April 12, 2010 Share Posted April 12, 2010 CountryGirl, if there is only one record, you don't need the while loop the182guy posted, but you do need the $row = mysql_fetch_assoc($result); portion. That will actually get the results. And if you only need 1 record every time, may I suggest adding a - LIMIT 1 at the very end of your SQL query. $query = "SELECT Appr_Value.ApprID as id, Appr_Value.Account, Asmnt_Parcel.OwnersName FROM Appr_Value INNER JOIN Asmnt_Parcel ON Appr_Value.Account=Asmnt_Parcel.Account WHERE Appr_Value.Account LIKE '{$search}' AND Appr_Value.ApprID = '".mysql_real_escape_string($_GET['id'])."' ORDER BY Appr_Value.Account ASC LIMIT 1"; Quote Link to comment https://forums.phpfreaks.com/topic/197285-returning-results-in-defined-spots/#findComment-1040508 Share on other sites More sharing options...
Psycho Posted April 12, 2010 Share Posted April 12, 2010 OK, I was trying to write anything specific for the code you had because, quite honestly, I knew I would have to rewrite the whole thing just to understand what went where. But, if it helps you, then it's worth it. I only see a few values being selected in your query. I suspect you need to get more results. Anyway, I left it up to you to define all the values to populate the page. I also rewrote the entire layout of the page using CSS which greatly cleaned it up. Although I would probably have gone further in removing all the redundant DIV's <?php $dbHost = '***'; $dbUser = '***'; $dbPass = '***'; $dbDatabase = '***'; $con = mysql_connect($dbHost, $dbUser, $dbPass) or die("Failed to connect to MySQL Server. Error: " . mysql_error()); mysql_select_db($dbDatabase) or die("Failed to connect to database {$dbDatabase}. Error: " . mysql_error()); $apprID = mysql_real_escape_string($_GET['id']); $query = "SELECT Appr_Value.ApprID as id, Appr_Value.Account, Asmnt_Parcel.OwnersName, Asmnt_Situs.Situs FROM Appr_Value INNER JOIN Asmnt_Parcel ON Appr_Value.Account=Asmnt_Parcel.Account INNER JOIN Asmnt_Situs ON Appr_Value.Account=Asmnt_Situs.Account WHERE Appr_Value.Account LIKE '{$search}' AND Appr_Value.ApprID = '{$apprID}' ORDER BY Appr_Value.Account ASC"; $result = mysql_query($query, $con) or die(mysql_error().": $query"); $error = ''; if (!$result) { $error = "<span style=\"color:#ff0000;\">No results found</span>"; } else { $r = mysql_fetch_assoc($result); $account = htmlentities($r['Account']); $nameID = htmlentities($r['OwnersName']); $address = htmlentities($r['']); $situs = htmlentities($r['']); $instrNo = htmlentities($r['']); $grantor = htmlentities($r['']); $saleDate = htmlentities($r['']); $salePrice = htmlentities($r['']); $description = htmlentities($r['']); $exempType = htmlentities($r['']); $exemption = htmlentities($r['']); $code = htmlentities($r['']); $landValue = htmlentities($r['']); $improvements = htmlentities($r['']); $mobileHome = htmlentities($r['']); $totalValue = htmlentities($r['']); $assessedValue = htmlentities($r['']); $taxableValue = htmlentities($r['']); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <meta name="generator" content="Adobe GoLive" /> <title>Search Results</title> <style> body { background-color: #bba86d; } .title { font-family: Georgia, Times New Roman, Times, serif; font-size: 16pt; font-weight: bold; color: #003300; text-align: center; } .tableBlock { border: 2px solid #cecece; } .tableBlock td { /* put styles that apply to both labels and values here */ font-family: Georgia, Times New Roman, Times, serif; font-size: 10pt; color: #352200; text-align: left; } .label { /* put styles specific classes here */ font-weight: bold; white-space: nowrap; padding: 8px 5px 8px 5px; } .value { /* put styles specific classes here */ padding: 8px 5px 8px 5px; color: red; width: 100%; } </style> </head> <body> <div align="center"> <div style="position:relative;width:871px;height:912px;-adbe-g:p;"> <div style="position:absolute;top:0px;left:111px;width:648px;height:350px;"> <img src="toplogo3.jpg" alt="" height="350" width="648" border="0" /> </div> <div style="position:absolute;top:350px;left:34px;width:800px;height:33px;"> <table width="800" border="1" cellspacing="2" cellpadding="0"> <tr><td class="title">Wagoner County Public Records Search Results:</td></tr> </table> </div> <?php echo $error; ?> <div style="position:absolute;top:384px;left:2px;width:434px;height:138px;"> <table class="tableBlock" width="430"> <tr><td class="label">Account:</td><td class="value"><?php echo $account; ?></td></tr> <tr><td class="label">Name ID:</td><td class="value"><?php echo $nameID; ?></td></tr> <tr><td class="label">Address:</td><td class="value"><?php echo $address; ?></td></tr> <tr><td class="label">Situs:</td><td class="value"><?php echo $situs; ?></td></tr> </table> </div> <div style="position:absolute;top:384px;left:436px;width:434px;height:122px;"> <table class="tableBlock" width="430"> <tr><td class="label">Instrument Number:</td><td class="value"><?php echo $instrNo; ?></td></tr> <tr><td class="label">Grantor:</td><td class="value"><?php echo $grantor; ?></td></tr> <tr><td class="label">Sale Date:</td><td class="value"><?php echo $saleDate; ?></td></tr> <tr><td class="label">Sale Price:</td><td class="value"><?php echo $salePrice; ?></td></tr> </table> </div> <div style="position:absolute;top:544px;left:2px;width:434px;height:69px;"> <table class="tableBlock" width="430"> <tr><td class="label">Legal Description:</td><td class="value"><?php echo $description; ?></td></tr> </table> </div> <div style="position:absolute;top:544px;left:436px;width:434px;height:94px;"> <table class="tableBlock" width="430"> <tr><td class="label">Exemption Type:</td><td class="value"><?php echo $exempType; ?></td></tr> <tr><td class="label">Exemption:</td><td class="value"><?php echo $exemption; ?></td></tr> <tr><td class="label">Code:</td><td class="value"><?php echo $code; ?></td></tr> </table> </div> <div style="position:absolute;top:656px;left:1px;width:209px;height:77px;"> <table class="tableBlock" width="207"> <tr><td class="label">Land Value:</td><td class="value"><?php echo $landValue; ?></td></tr> </table> </div> <div style="position:absolute;top:656px;left:227px;width:209px;height:77px;"> <table class="tableBlock" width="207"> <tr><td class="label">Improvements:</td><td class="value"><?php echo $improvements; ?></td></tr> </table> </div> <div style="position:absolute;top:656px;left:437px;width:209px;height:77px;"> <table class="tableBlock" width="207"> <tr><td class="label">Mobile Home:</td><td class="value"><?php echo $mobileHome; ?></td></tr> </table> </div> <div style="position:absolute;top:656px;left:659px;width:209px;height:69px;"> <table class="tableBlock" width="207"> <tr><td class="label">Total Value:</td><td class="value"><?php echo $totalValue; ?></td></tr> </table> </div> <div style="position:absolute;top:752px;left:128px;width:306px;height:69px;"> <table class="tableBlock" width="306"> <tr><td class="label">Assessed Value:</td><td class="value"><?php echo $assessedValue; ?></td></tr> </table> </div> <div style="position:absolute;top:752px;left:436px;width:306px;height:69px;"> <table class="tableBlock" width="306"> <tr><td class="label">Total Taxable:</td><td class="value"><?php echo $taxableValue; ?></td></tr> </table> </div> </div> </div> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/197285-returning-results-in-defined-spots/#findComment-1040522 Share on other sites More sharing options...
CountryGirl Posted April 12, 2010 Author Share Posted April 12, 2010 OK, I was trying to write anything specific for the code you had because, quite honestly, I knew I would have to rewrite the whole thing just to understand what went where. But, if it helps you, then it's worth it. I only see a few values being selected in your query. I suspect you need to get more results. Anyway, I left it up to you to define all the values to populate the page. I also rewrote the entire layout of the page using CSS which greatly cleaned it up. Although I would probably have gone further in removing all the redundant DIV's THANK YOU SO MUCH!! That is a huge help! Now I can visually see it all and it makes much more sense. It's not returning any results, which doesn't make any sense to me. Since everything looks correct (I've read over it several times). I'm going to come back to it later, but if you have any ideas off the top of your head, let me know . If you go to www.wagonerassessor.com/searchlink.php and use something like "730000450" to search, you'll be able to follow the linked account number to the detailed search page. It's coming up, but just doesn't have any results in it. I'll have to look at it more later to see if I'm missing something or what's going on. Thanks so much again ! Quote Link to comment https://forums.phpfreaks.com/topic/197285-returning-results-in-defined-spots/#findComment-1040540 Share on other sites More sharing options...
Psycho Posted April 12, 2010 Share Posted April 12, 2010 OK, I see the problem. You have two WHERE clauses in your query, but only one of those search values is being set. $apprID = mysql_real_escape_string($_GET['id']); $query = "SELECT Appr_Value.ApprID as id, Appr_Value.Account, Asmnt_Parcel.OwnersName, Asmnt_Situs.Situs FROM Appr_Value INNER JOIN Asmnt_Parcel ON Appr_Value.Account=Asmnt_Parcel.Account INNER JOIN Asmnt_Situs ON Appr_Value.Account=Asmnt_Situs.Account WHERE Appr_Value.Account LIKE '{$search}' AND Appr_Value.ApprID = '{$apprID}' ORDER BY Appr_Value.Account ASC"; WHERE is $seach being defined? Also, I mode one error in logic in the above code. Change this if (!$result) { $error = "<span style=\"color:#ff0000;\">No results found</span>"; } To this: if (mysql_num_rows($result)==0) { $error = "<span style=\"color:#ff0000;\">No results found</span>"; } That would have at least ensured you would have gotten the correct error message. Quote Link to comment https://forums.phpfreaks.com/topic/197285-returning-results-in-defined-spots/#findComment-1040560 Share on other sites More sharing options...
CountryGirl Posted April 14, 2010 Author Share Posted April 14, 2010 OK, I see the problem. You have two WHERE clauses in your query, but only one of those search values is being set. ....... That would have at least ensured you would have gotten the correct error message. Thank you!! I changed my WHERE clause to just be WHERE Appr_Value.ApprID = '{$apprID}' . And I got the correct results! This is so great! You've been a huge help! Qadoshyah Quote Link to comment https://forums.phpfreaks.com/topic/197285-returning-results-in-defined-spots/#findComment-1041817 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.