pedmeister Posted March 28, 2007 Share Posted March 28, 2007 Not sure if this is php or html problem, but thought I'd try here first. I have created a search page which returns records from a mysql db, but when it first opens it mucks up all the html beneath the form. If you enter a search value and submit all the formatting below is there. See screenshots below. Here's the search2.php code <? if(isset($_GET['id'])) { include 'library/config.php'; include 'library/opendb.php'; $id = $_GET['id']; $query = "SELECT name, type, size, content FROM upload WHERE id = '$id'"; $result = mysql_query($query) or die('Error, query failed'); list($name, $type, $size, $content) = mysql_fetch_array($result); header("Content-Disposition: attachment; filename=$name"); header("Content-length: $size"); header("Content-type: $type"); echo $content; include 'library/closedb.php'; exit; } ?> <!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> <title>Links 2003 LTS File Repository</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta name="description" content="Upload Links 2003 LTS files" /> <meta name="keywords" content="links 2003, LTS files, pga tour, golf, offline tours, online tours"/> <style type="text/css"> <!-- body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } --> </style> <link href="style.css" rel="stylesheet" type="text/css" /> <style type="text/css"> <!-- .style1 {color: #FF0000} .style2 { color: #FFFFFF; font-weight: bold; font-style: italic; } .style3 { font-size: 14px; font-weight: bold; } --> </style> </head> <body> <table width="778" border="0" align="center" cellpadding="1" cellspacing="1"> <tr> <td bgcolor="#333333"><table width="777" height="355" border="0" align="center" cellpadding="0" cellspacing="0"> <!-- Header Starts Here --> <tr bgcolor="#FFFFFF"> <td height="90" valign="top"><?php include("includes/header.php");?></td> </tr> <!-- Header Ends Here --> <!-- Center Body Starts Here --> <tr> <td height="150" valign="top" bgcolor="#FFFFFF"><table width="99%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="1%" valign="top"><img src="images/security_box_left_panel.jpg" width="9" height="8" /></td> <td width="98%" valign="top" background="images/security_center_box_horizontal.jpg"><img src="images/security_center_box_horizontal.jpg" width="9" height="8" /></td> <td width="1%" valign="top" background="images/security_center_box_horizontal.jpg"><img src="images/security_box_right_panel.jpg" width="9" height="8" /></td> </tr> <tr> <td height="200" valign="top" background="images/security_box_left_vertical.jpg"><img src="images/security_box_left_vertical.jpg" width="9" height="8" /></td> <td valign="top"><table width="99%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr valign="top"> <td width="17%" height="200" bgcolor="#FFFFFF"><a href="http://1and1.co.uk/xml/init/?k_id=9660732" target="_blank"><img src="http://banner.1and1.co.uk/xml/banner?size=5&number=1" width="120" height="600" border="0"/></a></td> <td width="83%"><table width="99%" height="257" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="45%" height="19" valign="middle" bgcolor="#333333"><div align="center" class="style2"> <div align="right">Welcome to the </div> </div></td> <td width="55%" valign="middle" bgcolor="#333333"><div align="right" class="style2"> <div align="left"> Links 2003 Mod 1.06 LTS files Repository</div> </div></td> </tr> <tr> <td height="34" colspan="2" valign="top"><table width="100%" height="101" border="0" cellpadding="1" cellspacing="1" class="blacknormalbold"> <tr><td width="98%" align="center" valign="top" class="blacknormalbold"> <h2>Search</h2> <form name="form" action="search2.php" method="get"> Search for Course: <input type="text" name="q" /> <input type="submit" name="Submit" value="Search" /> </form> <?php include 'library/config.php'; include 'library/opendb.php'; // Get the search variable from URL $var = @$_GET['q'] ; $trimmed = trim($var); //trim whitespace from the stored variable // rows to return $limit=10; // check for an empty string and display a message. if ($trimmed == "") { echo "<p>Please enter a search...</p>"; } else // Build SQL Query $query = "select * from upload where name like \"%$trimmed%\" order by name"; // EDIT HERE and specify your table and field names for the SQL query $numresults=mysql_query($query) or die; $numrows=mysql_num_rows($numresults); // If we have no results, offer a google search as an alternative if ($numrows == 0) { echo "<h4>Results</h4>"; echo "<p>Sorry, your search: "" . $trimmed . "" returned zero results</p>"; // google echo "<p><a href=\"http://www.google.com/search?q=" . $trimmed . "\" target=\"_blank\" title=\"Look up " . $trimmed . " on Google\">Click here</a> to try the search on google</p>"; } // next determine if s has been passed to script, if not use 0 if (empty($s)) { $s=0; } // get results $query .= " limit $s,$limit"; $result = mysql_query($query) or die("Couldn't execute query"); // display what the person searched for echo "<p>You searched for: "" . $var . ""</p>"; // begin to show results set echo "Results"; $count = 1 + $s ; // now you can display the results returned while(list($id, $name) = mysql_fetch_array($result)) { //$title = $name["name"]; echo "$count.)  $name"; echo "<br />"; echo "Download here   <a href=search2.php?id=$id>$name</a>"; echo "<br />"; $count++ ; } $currPage = (($s/$limit) + 1); //break before paging echo "<br />"; // next we need to do the links to other results if ($s>=1) { // bypass PREV link if s is 0 $prevs=($s-$limit); print " <a href=\"$PHP_SELF?s=$prevs&q=$var\"><< Prev 10</a>  "; } // calculate number of pages needing links $pages=intval($numrows/$limit); // $pages now contains int of pages needed unless there is a remainder from division if ($numrows%$limit) { // has remainder so add one page $pages++; } // check to see if last page if (!((($s+$limit)/$limit)==$pages) && $pages!=1) { // not last page so give NEXT link $news=$s+$limit; echo " <a href=\"$PHP_SELF?s=$news&q=$var\">Next 10 >></a>"; } $a = $s + ($limit) ; if ($a > $numrows) { $a = $numrows ; } $b = $s + 1 ; echo "<p>Showing results $b to $a of $numrows</p>"; include 'library/closedb.php'; ?> </td></tr> <tr> <td height="7" colspan="4" align="center" valign="top"><img src="images/security_menu_separator.jpg" width="100%" height="5" /></td> </tr> </table></td> </tr> <tr> <td height="68" colspan="2" valign="top"><table width="100%" height="92" border="0" cellpadding="1" cellspacing="1" class="greynormal"> <tr> <td width="23%" rowspan="2" align="center" valign="middle"><a href="http://www.winzip.com" target="_parent"><img src="images/winzip.jpg" alt="Winzip" width="120" height="120" border="0" /></a></td> <td height="68" colspan="3" valign="top"><div align="center" class="subheading"> <p align="left" class="style1">ALL FILES ON THE SITE ARE IN .ZIP FORMAT!! </p> <p align="left" class="greynormal">Please upload files in .zip format. If you don't have a program for this already, we recommend using WINZIP. Click on the icon (left) to go to the program's site. </p> <div align="left" class="greynormal"></div> </div></td> </tr> <tr> <td width="67%" height="10" valign="top"> </td> <td width="2%" align="center" valign="middle"></td> <td width="8%" align="left" valign="middle"></td> </tr> <tr> <td height="7" colspan="4" align="center" valign="top"><img src="images/security_menu_separator.jpg" width="100%" height="5" /></td> </tr> </table></td> </tr> <tr valign="middle" bgcolor="#FFFFFF"> <td height="5" colspan="2" class="googleheading"><!-- Google Advertisement --></td> </tr> <tr > <!-- bgcolor="#384ECA" --> <td height="34" colspan="2" valign="top"><table width="90%" border="0" align="center" cellpadding="5" cellspacing="10"> <tr align="center" valign="top"> <td height="50" bgcolor="#FFFFFF" class="blacknormal" > <div style="border:thin solid black; width:350px; height:80px"> <form method="get" target="_blank" ACTION=" http://order.1and1.co.uk/xml/order/domaincheck"> <p class="blacknormalbold">Trust 1&1 Internet for your domain name registration, from only £1.99/year!. Check now!</p> <table border="0" width="320"> <tr> <td class="form"> <input name="__currentindex[domaincheck]" value="0" type="hidden"/> <input name="__sendingdata" value="1" type="hidden"/> <input name="__pageflow" value="Order" type="hidden"/> <input name="k_id" value="9660732" type="hidden"/> <input size="20" maxlength="500" name="multicheck.Domain" type="text"/> </td> <td> <select style="width:60px" name="multicheck.Tlds"> <option value="co.uk">co.uk</option> <option value="me.uk">me.uk</option> <option value="org.uk">org.uk</option> <option value="info">info</option> <option value="com">com</option> <option value="mobi">mobi</option> <option value="net">net</option> <option value="org">org</option> <option value="eu">eu</option> <option value="info">info</option> <option value="name">name</option> <option value="biz">biz</option> <option value="us">us</option> </select> </td> <td> </td> <td> <input type="submit" name="Submit" value="Check Now"/> </td> </tr> </table> </form> </div> <br> <a href="http://www.apcd-courses.com" target="_blank"><img src="images/apcdcourses.gif" alt="apcd-courses" width="300" height="66" vspace="5" border="0" ></a> </td> </tr> </table></td> </tr> </table></td> </tr> </table> </td> <td valign="top" background="images/security_center_right_virtical.jpg"><img src="images/security_center_right_virtical.jpg" width="9" height="8" /></td> </tr> <tr> <td height="8" valign="top"><img src="images/security_center_box_left_bottom.jpg" width="9" height="8" /></td> <td valign="top" background="images/security_center_box_horizontal_bottom.jpg"><img src="images/security_center_box_horizontal_bottom.jpg" width="9" height="8" /></td> <td valign="top"><img src="images/security_center_box_right_bottom.jpg" width="9" height="8" /></td> </tr> </table></td> </tr> <!-- Center Body Starts Here --> <!-- Footer Starts Here --> <tr bgcolor="#FFFFFF"> <td height="21" valign="top"><?php include("includes/footer.php");?></td> </tr> <!-- Footer Ends Here --> </table></td> </tr> </table> </body> </html> Any advice hugely appreciated, this has been driving me mad for 2 days :'( Peds Link to comment https://forums.phpfreaks.com/topic/44684-solved-php-search-page-layout-problem/ Share on other sites More sharing options...
pedmeister Posted March 30, 2007 Author Share Posted March 30, 2007 Bumping this as 20 views and not one reply :-\ Please can anyone help? Thanks for looking Peds Link to comment https://forums.phpfreaks.com/topic/44684-solved-php-search-page-layout-problem/#findComment-217983 Share on other sites More sharing options...
neel_basu Posted March 30, 2007 Share Posted March 30, 2007 I am Not Going That Much Deep Into Your Code Cause The Same Thing Can be done in just 10 lines With Zigmoyd framework. I am Posting the example Php Code <?php $conn = mysql_connect("localhost", "root", ""); $test = new browse("php", "upload", $conn);//db_name, table_name, $conn $test->set("id", $id);//Set The GIVEN Fields, and its Value $test->find("name", "type", "size", "content");//Multiple Arguments Can Also be Given $result = $test->adv_output("name"); print_r($result); ?> And I Hope You are Done But first You have to include_once("config.php"); then db/browse.php and then done.php More Info here http://zigmoyd.sourceforge.net/man/db.php#browse Link to comment https://forums.phpfreaks.com/topic/44684-solved-php-search-page-layout-problem/#findComment-218020 Share on other sites More sharing options...
pedmeister Posted April 1, 2007 Author Share Posted April 1, 2007 Now I'm even more confused :'( Doing that gives me a blank page. Please anyone? Peds Link to comment https://forums.phpfreaks.com/topic/44684-solved-php-search-page-layout-problem/#findComment-219357 Share on other sites More sharing options...
neel_basu Posted April 2, 2007 Share Posted April 2, 2007 I am sure You have not included any files. First include_once('path/config.php'); include_once('path/db/browse.php'); include_once('path/done.php'); [Where path the folder name is where you have extracted the downloaded] And then Paste the Previous Code. Now Post Your Compleate Code after adding those include_once(). Link to comment https://forums.phpfreaks.com/topic/44684-solved-php-search-page-layout-problem/#findComment-219516 Share on other sites More sharing options...
Warptweet Posted April 2, 2007 Share Posted April 2, 2007 Post that code wherever you want the search results to appear. Make sure you close all your HTML tags like </font> and </table>. Thats all the advice I can tell you right now. Link to comment https://forums.phpfreaks.com/topic/44684-solved-php-search-page-layout-problem/#findComment-219524 Share on other sites More sharing options...
neel_basu Posted April 2, 2007 Share Posted April 2, 2007 So Here Is Your Compleate Code Try once more ---------------------------------------------- If you havn't downloaded it before. Download Those Files From here And EXtract The Archive In some folder. I am Assuming That The Name of that folder is "path". Use $_GET['id'] INstesd of $id --------------------------------------------------- <?php $db = 'Your_db_name'; include_once('path/config.php'); include_once('path/db/browse.php'); include_once('path/done.php'); $conn = mysql_connect("localhost", "root", ""); $test = new browse($db, "upload", $conn);//db_name, table_name, $conn $test->set("id", $_GET['id']);//Set The GIVEN Fields, and its Value $test->find("name", "type", "size", "content");//Multiple Arguments Can Also be Given $result = $test->adv_output("name"); print_r($result); ?> And post the output Link to comment https://forums.phpfreaks.com/topic/44684-solved-php-search-page-layout-problem/#findComment-219586 Share on other sites More sharing options...
pedmeister Posted April 2, 2007 Author Share Posted April 2, 2007 Having done all that I get: Fatal error: Cannot instantiate non-existent class: browse in /homepages/**/**********/htdocs/dadsden/LTS_Rep/zigmoyd/example.php on line 7 My config.php: <?php $fw_setup_base_document_root = $GLOBALS['_SERVER']['DOCUMENT_ROOT']; $fw_install_loc_dir_name = '\LTS_Rep\zigmoyd';//Set this Variable Correctly to Where You Placed The Frame Work Files $fw_install_loc_name = $fw_setup_base_document_root.$fw_install_loc_dir_name; chdir($fw_install_loc_name); class set_up_ums { var $encryption_algorithm = MHASH_SHA1; } class set_up_weather { var $search_url = 'http://zigmoyd.net/services/weather/rezml/search.php?loc_str='; var $info_url = 'http://zigmoyd.net/services/weather/rezml/parse.php?loc_id='; } function hash_it($str) { $set_up = new set_up_ums(); return base64_encode(bin2hex(mhash($set_up->encryption_algorithm, $str))); } ?> Thanks for the help so far Link to comment https://forums.phpfreaks.com/topic/44684-solved-php-search-page-layout-problem/#findComment-219642 Share on other sites More sharing options...
neel_basu Posted April 2, 2007 Share Posted April 2, 2007 You did not include_once('zigmoyd/db/browse.php'); include_once('zigmoyd/done.php'); After include_once('zigmoyd/config.php'); Link to comment https://forums.phpfreaks.com/topic/44684-solved-php-search-page-layout-problem/#findComment-219706 Share on other sites More sharing options...
neel_basu Posted April 2, 2007 Share Posted April 2, 2007 And Keep example.php out of the Zigmoyd Folder. Link to comment https://forums.phpfreaks.com/topic/44684-solved-php-search-page-layout-problem/#findComment-219709 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.