Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 216
  • Last Modified:

Quering a database

I am completly stuck i have my source code which select froma  database and the prints five records and the says next click next it show the next five however on the last page it all goes wrong





<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td>
<table width="456" border="0" cellspacing="2" cellpadding="0" bgcolor="#9900FF" align="center">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="2" bgcolor="#FFFFCC">
<tr>
<td>
<div align="center"><b><font face="Arial, Helvetica, sans-serif" size="2" color="#000000">
<?PHP echo $page_title_message_brds ?> - <?PHP echo $qry_town_data['t_name_upper'] ?>
</font></b></div>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p align="center"><font face="Arial, Helvetica, sans-serif" size="2">We Invite You to Leave Comments And Suggestions on Our Message Boards And Enter Our Chat Forum to Catch Up on The Latest Gossip.</font></p>
<table width="456" border="0" cellspacing="1" cellpadding="1" bordercolor="#FFFFFF" align="center">
<tr bgcolor="#0000CC">
<td width="19%">
<div align="left"><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif">&nbsp;<b>Date</b></font></div>
</td>
<td width="55%">
<div align="left"><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif">&nbsp;<b>Message Title </b></font></div>
</td>
<td width="26%">
<div align="left"> <font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif">&nbsp;<b>Name</b></font></div>
</td>
</tr>
</table>
<align="left">











<?php
$hostname="";
$username="";
$password="";
$dbname="";
mysql_connect($hostname,$username,$password);
mysql_select_db($dbname);
$query="SELECT date_format(updated, '%d-%m-%Y') as updated,id,subject,author,author_email FROM messages where t_id = '$townid' and allow = 1 ORDER BY id DESC";
$result=mysql_query($query);

$intCount=mysql_num_rows($result);     //Total records
$intEach=5;                    //Records each page
$intPages=ceil($intCount/$intEach);     //Total Pages
if(!$intPage)
    $intPage=1;               //page No
   

mysql_data_seek($result,($intPage-1)*$intEach);
for($i=0;$i<5;$i++)
{
    if($row=mysql_fetch_row($result))


print "<table width=456 border=0 cellspacing=1 cellpadding=2 align=center>";
print "<tr bgcolor=#DFE1FF> ";
print "<td width=86>".$row[0]."</td>";
print "<td width=250>".$row[2]."</td>";
print "<td width=119>".$row[3]."</td>";
print "</tr>";
print "</table>";
}

if($intPage>1)
    print "<div align=center><font face=Arial, Helvetica, sans-serif color=#000000 size=2><a class=black_underline href=\" print "<div align=center><font face=Arial, Helvetica, sans-serif color=#000000 size=2><a class=black_underline href=\"".basename($PHP_SELF)."?intPage=".($intPage-1)."\">Previous Page</a> | ";.basename($PHP_SELF)."?intPage=".($intPage-1)."\">Previous Page</a> | ";
else
    print "<div align=center><font face=Arial, Helvetica, sans-serif color=#000000 size=2>";
if($intPage<$intPages)
    print "<a class=black_underline href=\"".basename($PHP_SELF)."?intPage=".($intPage+1)."\"> Next Page </a>";
else
    print "<font face=Arial, Helvetica, sans-serif color=#000000 size=2>";
print "<font face=Arial, Helvetica, sans-serif color=#000000 size=2>".$intPage." of &nbsp".$intPages;

?>

<p align="center"><font face="Arial, Helvetica, sans-serif" size="2"><a class=black_underline href="add_message.php">Post
your own message!</a></font></p>
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>&nbsp; </td>
</tr>
<tr>
<td bgcolor="#C0C0C0"><img src="http://www.<?PHP echo $domain ?>/images/structure/line.gif" width="100%" height="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="http://www.<?PHP echo $domain ?>/images/structure/block.gif" width="2" height="5"></td>
</tr>
<tr>
<td><?PHP include("/home/phpdev/public_html/content/footer/footer.php"); ?></td>
</tr>
</table>
0
Boroughman
Asked:
Boroughman
  • 3
  • 2
1 Solution
 
us111Commented:
<td bgcolor="#C0C0C0"><img src="http://www. echo $domain ?>/images/structure/line.gif" width="100%" height="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="http://www. echo $domain ?>/images/structure/block.gif" width="2" height="5"></td>
</tr>
<tr>
<td><?PHP include("/home/phpdev/public_html/content/footer/footer.php"); ?></td>
</tr>
</table>

it looks there s a problem here!! you forgot 2 <?
0
 
MoondancerCommented:
It's time to clean up this topic area and that means taking care of this question. Your options at this point are:

1. Award points to the Expert who provided an answer, or who helped you most. Do this by clicking on the "Accept Comment as Answer" button that lies above and to the right of the appropriate expert's name.

2. PAQ the question because the information might be useful to others, but was not useful to you. To use this option, you must state why the question is no longer useful to you, and the experts need to let me know if they feel that you're being unfair.

3.  Ask Community Support to help split points between participating experts.  Just comment here with details.

4.  Delete the question because it is of no value to you or to anyone else.  To use this option, you must state why the question is no longer useful to you, and the experts need to let me know if they feel that you're being unfair.

If you elect for option 2, 3 or 4, just post comment with details here and I'll take it from there.  We also request that you review any other open questions you might have and update/close them.  Display all your question history from your Member Profile to view details.

PLEASE DO NOT AWARD THE POINTS TO ME.

____________________________________________



Hi Experts:

In the event that the Asker does not respond, I would very much appreciate your opinions as to which Expert ought to receive points (if any) as a result of this question.  Likewise, you can also suggest that I PAQ or delete the question.

Experts, please do not add further "answer" information to this question.  I will be back in about one week to finalize this question.

Thank you everyone.

Moondancer :)
Community Support Moderator @ Experts Exchange

P.S.  REGARDING POINTS, Guidelines and more:  http://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp  
0
 
MoondancerCommented:
If the answer given which you accepted is correct, I can change this, as apropos, from a C to an A grade.  The points to you are the same, but expert points are generated based upon grade assigned.

thanks,

Moondancer :)
Community Support Moderator @ Experts Exchange

0
 
us111Commented:
I think the answer is correct :)
0
 
MoondancerCommented:
Grade corrected.
Moondancer :)
Community Support Moderator @ Experts Exchange
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now