473,385 Members | 1,919 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Page not right, when PHP runs it's 100%

142 100+
Hi,

I have a normal table with 3 rows.

In the middle row I added antoher table with my php search script (search in the database).

If you view the page the first time the 3rd row footer is gone and when you press the search button the results come up and the page display 100%.

Does anyone know what might be causing this and what I should look for.

Table HTML are all perfect and no bad or borken coding.
Jul 23 '08 #1
5 1325
r035198x
13,262 8TB
You might need to post the relevant code ...
Jul 23 '08 #2
Atli
5,058 Expert 4TB
You claim the HTML is perfect and yet you seem to be missing a row... That doesn't seem possible.

Post the code please and we can try to help spot the problem.
It's hard to debug that what you can not see :)
Jul 23 '08 #3
webandwe
142 100+
Sorry about the long code....



[PHP] <?php include("pass.php"); ?> [/PHP]

[HTML]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><title>Agri Bonus</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../images/agridb.css" rel="stylesheet" type="text/css">
</head>

<body>
<table width="678" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#336699"><img src="../images/AB_BOTTOM.jpg" width="140" height="60"></td>
</tr>
<tr>
<td height="18" bgcolor="#D2E1F0">
<p align="center"><a href="admin.php">Admin</a> | <a href="admin-view-form.php">View a Membership</a> | <a href="admin-update-form.php">Update</a> |<a href="admin-dform.php"> Delete</a>| <a href="search.php">Search by Memberhip No </a>|<a href="globalsearch.php"> Global Search </a>|<a href="view.php"> View All Entries</a>| <a href="logout.php">Logout</a> </p>
</td>
</tr>
<tr>
<td height="280" align="center" valign="top" bgcolor="#FFFFFF">
<table width="90%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="46"><div align="center"><strong>Search for a Membership by a Membership Number</strong></div></td>
</tr>
<tr>
<td><div align="center"><form name="form" action="search.php" method="get">

<input name="q" id="q" type="text">

<input type="submit" name="Submit" value="Search" />
</form>

[/HTML]

[PHP]

<?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 term.</p>";
exit;
}

// check for a search parameter
if (!isset($var))
{
echo "<p>We dont seem to have a search parameter!</p>";
exit;
}

include("database.php");

// Build SQL Query
$query = "select * from information where a1 like \"%$trimmed%\""; // EDIT HERE and specify your table and field names for the SQL query

$numresults=mysql_query($query);
$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: &quot;" . $trimmed . "&quot; returned zero results</p>";

// google
echo "No Results was found, please try again";
}

// 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: &quot;" . $var . "&quot;</p>";

// begin to show results set
echo "Results <br/>";
$count = 1 + $s ;

// now you can display the results returned
while ($row= mysql_fetch_array($result)) {
echo "$count.)&nbsp;$title" ;
echo("<table width=\"670\" border=\"0\" align=\"center\" cellpadding=\"2\" cellspacing=\"2\" >
<tr>
<td height=\"31\"><span class=\"style1\">Registerded:</span> <span class=\"style2\">$row[a2]</span></td>
<td colspan=\"2\"><span class=\"style1\">Last Update:</span> $row[b2]</td>
</tr>
<tr>
<td width=\"283\">AgriBonues Lidnr./ Memership no </td>
<td colspan=\"2\"></td>
</tr>
<tr>
<td width=\"283\">Wagwoord / Password </td>
<td colspan=\"2\" class=\"style2\">$row[a3]</td>
</tr>
<tr>
<td>Titel / Title</td>
<td colspan=\"2\" class=\"style2\">$row[a4]</td>
</tr>
<tr>
<td>Voorletter(s)/Initial(s):</td>
<td colspan=\"2\" class=\"style2\">$row[a5]</td>
</tr>
<tr>
<td>Noemnaam/ First Name: </td>
<td colspan=\"2\" class=\"style2\">$row[a6]</td>
</tr>
<tr>
<td>Van / Surname</td>
<td colspan=\"2\" class=\"style2\">$row[a7]</td>
</tr>
<tr>
<td>ID Nr: </td>
<td colspan=\"2\" class=\"style2\">$row[a8]</td>
</tr>
<tr>
<td>Besigheidsnaam / Business Name </td>
<td colspan=\"2\" class=\"style2\">$row[a9]</td>
</tr>
<tr>
<td>Plaas naam / Farm Name </td>
<td colspan=\"2\" class=\"style2\">$row[a10]</td>
</tr>
<tr>
<td>E-Pos / E-mail</td>
<td colspan=\"2\" class=\"style2\">$row[a11]</td>
</tr>
<tr>
<td>Taalvoorkeur / Preferred Language </td>
<td colspan=\"2\"><span class=\"style2\">$row[a12] </span>Other:
<span class=\"style2\">$row[a13]</span></td>
</tr>
<tr>
<td>Posadres / Postal Address </td>
<td colspan=\"2\" class=\"style2\">$row[a14]</td>
</tr>
<tr>
<td>Telephone:</td>
<td colspan=\"2\" class=\"style2\">$row[a15]</td>
</tr>
<tr>
<td>Fax:</td>
<td colspan=\"2\" class=\"style2\">$row[a16]</td>
</tr>
<tr>
<td>Sel / Cell No </td>
<td colspan=\"2\" class=\"style2\">$row[a17]</td>
</tr>
<tr>
<td>Do you want sms text to you </td>
<td colspan=\"2\" class=\"style2\">$row[a18]</td>
</tr>
<tr>
<td>Landrosdistik / Magisterial distict </td>
<td colspan=\"2\" class=\"style2\">$row[a19]</td>
</tr>
<tr>
<td>Eskom Paalnr/pole no </td>
<td colspan=\"2\" class=\"style2\">$row[a20]</td>
</tr>
<tr>
<td>GPS koordinaat / co-ordinate </td>
<td colspan=\"2\" class=\"style2\">$row[a21]</td>
</tr>
<tr>
<td colspan=\"3\">Is jy 'n ladnbou boer, Are you an Agricultural Producer (Farmer)
<span class=\"style2\">$row[a22]</span></td>
</tr>
<tr>
<td>Aantal Arbeiders / No workers </td>
<td colspan=\"2\" class=\"style2\">$row[a23]</td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan=\"2\">&nbsp;</td>
</tr>
<tr>
<td colspan=\"3\"><div align=\"center\">
<p><strong>Gewsproduksie / Crop Production <br>
</strong>Lys slegs 3... </p>
</div></td>
</tr>
<tr>
<td><strong>1. Somergraan /Summer grain: </strong></td>
<td class=\"style2\">$row[a24]</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td width=\"154\">Hectare</td>
<td width=\"209\">Insetverskaffers / suppliers </td>
</tr>
<tr>
<td class=\"style2\">1.1
$row[a25]</td>
<td width=\"154\" class=\"style2\">$row[a26]</td>
<td width=\"209\" class=\"style2\">$row[a27]</td>
</tr>
<tr>
<td class=\"style2\">1.2
$row[a28]</td>
<td class=\"style2\">$row[a29]</td>
<td class=\"style2\">$row[a30]</td>
</tr>
<tr>
<td class=\"style2\">1.3
$row[a31]</td>
<td class=\"style2\">$row[a32]</td>
<td class=\"style2\">$row[a33]</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td><strong>2. Wintergraan/ Winter grain </strong></td>
<td class=\"style2\">$row[a34]</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>Hectare</td>
<td>Insetverskaffers </td>
</tr>
<tr>
<td class=\"style2\">2.1
$row[a35]</td>
<td class=\"style2\">$row[a36]</td>
<td class=\"style2\">$row[a37]</td>
</tr>
<tr>
<td class=\"style2\">2.2
$row[a38]</td>
<td class=\"style2\">$row[a39]</td>
<td class=\"style2\">$row[a40]</td>
</tr>
<tr>
<td class=\"style2\">2.3
$row[a41]</td>
<td class=\"style2\">$row[a42]</td>
<td class=\"style2\">$row[a43]</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td><strong>3. Oliesade / Oil seeds: </strong></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>Hectare</td>
<td>Insetverskaffers </td>
</tr>
<tr>
<td class=\"style2\">3.1
$row[a44]</td>
<td class=\"style2\">$row[a45]</td>
<td class=\"style2\">$row[a46]</td>
</tr>
<tr>
<td class=\"style2\">3.2
$row[a47]</td>
<td class=\"style2\">$row[a48]</td>
<td class=\"style2\">$row[a49]</td>
</tr>
<tr>
<td class=\"style2\">3.3
$row[a50]</td>
<td class=\"style2\">$row[a51]</td>
<td class=\"style2\">$row[a52]</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td><strong>4. Groente / Vegtables: </strong></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>Hectare</td>
<td>Insetverskaffers </td>
</tr>
<tr>
<td class=\"style2\">4.1
$row[a53]</td>
<td class=\"style2\">$row[a54]</td>
<td class=\"style2\">$row[a55]</td>
</tr>
<tr>
<td class=\"style2\">4.2
$row[a56]</td>
<td class=\"style2\">$row[a57]</td>
<td class=\"style2\">$row[a58]</td>
</tr>
<tr>
<td class=\"style2\">4.3
$row[a59]</td>
<td class=\"style2\">$row[a60]</td>
<td class=\"style2\">$row[a61]</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td><strong>5. Vrugte &amp; Neute / Fruits &amp; Nuts </strong></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>Hectare</td>
<td>Insetverskaffers </td>
</tr>
<tr>
<td class=\"style2\">5.1
$row[a62]</td>
<td class=\"style2\">$row[a63]</td>
<td class=\"style2\">$row[a64]</td>
</tr>
<tr>
<td class=\"style2\">5.2
$row[a65]</td>
<td class=\"style2\">$row[a66]</td>
<td class=\"style2\">$row[a67]</td>
</tr>
<tr>
<td class=\"style2\">5.3
$row[a68]</td>
<td class=\"style2\">$row[a69]</td>
<td class=\"style2\">$row[a70]</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan=\"3\"><div align=\"center\"><strong>Diereproduksie</strong></div></td>
</tr>
<tr>
<td>6. Beeste / Cattle: </td>
<td class=\"style2\">$row[a71]</td>
<td>Hoeveel / Quantity:
<span class=\"style2\">$row[a72]</span></td>
</tr>
<tr>
<td>7. Skape / Sheep </td>
<td class=\"style2\">$row[a73]</td>
<td>Hoeveel / Quantity:
<span class=\"style2\">$row[a74]</span></td>
</tr>
<tr>
<td>8. Hoenders / Chickens </td>
<td class=\"style2\">$row[a75]</td>
<td>Hoeveel / Quantity:
<span class=\"style2\">$row[a76]</span></td>
</tr>
<tr>
<td>9. Varke / Pigs: </td>
<td class=\"style2\">$row[a77]</td>
<td>Hoeveel / Quantity:<span class=\"style2\"> $row[a78]</span></td>
</tr>
<tr>
<td>10. Wild / Game </td>
<td class=\"style2\">$row[a79]</td>
<td>Hoeveel / Quantity:
<span class=\"style2\">$row[a80]</span></td>
</tr>
<tr>
<td>11. Ander / Other </td>
<td class=\"style2\">$row[a81]</td>
<td>Hoeveel / Quantity:
<span class=\"style2\">$row[a82]</span></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height=\"18\" colspan=\"3\"><div align=\"center\"><strong>Lys slegs u drie Grootste insetverskaffers / List only your three main input suppliers </strong></div></td>
</tr>
<tr>
<td><div align=\"center\" class=\"style2\">
$row[a83]
</div></td>
<td><div align=\"center\" class=\"style2\">
$row[a84]
</div></td>
<td><div align=\"center\" class=\"style2\">
$row[a85]
</div></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>Kooperasie / Landboubesigheid<br>
Co-op / Agricultural Business </td>
<td colspan=\"2\"><div align=\"center\">Lidnr. / Rek.nr. / folionr.<br>
Membership no / Acc no. / Folio </div></td>
</tr>
<tr>
<td class=\"style2\">1.
$row[a86]</td>
<td class=\"style2\">$row[a87]</td>
<td class=\"style2\">$row[a88]</td>
</tr>
<tr>
<td class=\"style2\">2.
$row[a89]</td>
<td class=\"style2\">$row[a90]</td>
<td class=\"style2\">$row[a91]</td>
</tr>
<tr>
<td class=\"style2\">3
$row[a92]</td>
<td class=\"style2\">$row[a93]</td>
<td class=\"style2\">$row[a94]</td>
</tr>
<tr>
<td class=\"style2\">4
$row[a95]</td>
<td class=\"style2\">$row[a96]</td>
<td class=\"style2\">$row[a97]</td>
</tr>
<tr>
<td class=\"style2\">5
$row[a98]</td>
<td class=\"style2\">$row[a99]</td>
<td class=\"style2\">$row[a100]</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan=\"3\"><div align=\"center\"><strong>Agri will graag help / Agri want's to help </strong></div></td>
</tr>
<tr>
<td colspan=\"3\"><div align=\"center\" class=\"style2\">
$row[a101]
</div></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>");
$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 "&nbsp;<a href=\"$PHP_SELF?s=$prevs&q=$var\">&lt;&lt;
Prev 10</a>&nbsp&nbsp;";
}

// 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 "&nbsp;<a href=\"$PHP_SELF?s=$news&q=$var\">Next 10 &gt;&gt;</a>";
}

$a = $s + ($limit) ;
if ($a > $numrows) { $a = $numrows ; }
$b = $s + 1 ;
echo "<p>Showing results $b to $a of $numrows</p>";

?>

[/PHP]

[HTML]

</div></td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor="#336699"><div align="right"><img src="../images/AB_BOTTOM.jpg" width="140" height="60"></div></td>
</tr>
</table>
</body>
</html>

[/HTML]
Jul 24 '08 #4
webandwe
142 100+
Just give me a second while I check whats up with the tags...And won't color my code
Jul 24 '08 #5
Atli
5,058 Expert 4TB
Lines 14 and 21 of your PHP code.

Assuming that all that code is on one page (search.php).
The exit calls would stop the entire script, including any following HTML code.

Try removing those two lines and re-designing the flow of the PHP code so that the rest of the code is dependent on the existence and validity of the search parameter.
Jul 25 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: WindAndWaves | last post by:
Hi Gurus I am keen to make a search page on a website, but I have absolutely zero experience with PHP. I am going to hire an expert, but I thought that it may pay to try it a bit first myself...
0
by: Moshe | last post by:
Page with a <form> action calls ASP page. The ASP page has the following structure <%@ LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <% Option Explicit %> <% Server.ScriptTimeOut=100 With Response...
5
by: rathnesh | last post by:
when using a web application which includes taking an asp page then going to another asp page and coming back to first page ...some times connection to iis gets terminated and page canot be...
4
by: Tony | last post by:
I'm having a problem with the execution of some code and the timing. Basically, I want each cell in a table of images to change, followed by a small delay, so that it creates an animation that...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
3
by: Harry | last post by:
Hi. I'm trying to get a page layout using css instead of tables, where the various sections have fixed widths even when you resize the browser window. The css below produces the correct layout...
6
by: anthonykallay | last post by:
Hi there, I dont this this a bug but i cant get my head around it.. I have a master page that has a login control on it, to log in i press the button and the page posts back, however on the page...
1
by: soluvah | last post by:
Hello Folks, Been trying to widen my site's body from "779" to "1000" so it almost fills the window. IE 7 on windows XP just dismantles the pages and leaves wide gaps between the left column and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.