Page 1 of 1

php paging

Posted: Mon Mar 19, 2007 6:38 pm
by kiris3992
arborint | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Code: Select all

<?php

include '../library/opendb.php';



$get_topics = "select topic_id, topic_title, date_format(topic_create_time, '%b %e %Y at %r') as fmt_topic_create_time,
	topic_owner, topic_image , category from forum_topics order by topic_create_time desc";
	
	
	$get_topics_res = mysql_query($get_topics, $conn) or die(mysql_error());
	
	if (mysql_num_rows($get_topics_res) < 1) {
	
		
		$display_block = "<P><em>Den uparxoun themata.</em></p>";
	} else {
	
		
		$display_block = "
		<table width=100% cellpadding=3 cellspacing=1 border=0>
		<tr>
		<th>TOPIC TITLE</th>
		</tr>";
		
		while ($topic_info = mysql_fetch_array($get_topics_res)) {
			$topic_id = $topic_info['topic_id'];
			$topic_title = stripslashes($topic_info['topic_title']);
			$topic_create_time = $topic_info['fmt_topic_create_time'];
			$topic_owner = stripslashes($topic_info['topic_owner']);
			
			$topic_image = ($topic_info['topic_image']);				
			$category = ($topic_info['category']);			
			
			
			
			$get_num_posts = "select count(post_id) from forum_posts where topic_id = $topic_id";
			$get_num_posts_res = mysql_query($get_num_posts,$conn) or die(mysql_error());
			$num_posts = mysql_result($get_num_posts_res,0, 'count(post_id)');
			
			
			
			$display_block .= "
			<tr> 
			<td><div align=\"center\"><div id=\"title_post\"><a href=\"showtopic.php?topic_id=$topic_id\">
				<strong>$topic_title</strong></a></div><br>
				<img src=\"$topic_image\"><br>
			Created on $topic_create_time by $topic_owner</div></td>
			</tr>";
		}
		
		
		
		$display_block .= "</table>";
	}
?>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<style type="text/css">
/* block top */
.block_top td				{ padding:3px;}
.block_top img				{ border: 0; }
.block_top .left			{ border-left: 1px solid #555656 solid #555656; border-bottom:1px solid #555656;  }
.block_top .center			{ border-bottom-style: solid; border-bottom:  1px solid #555656;}
.block_top .right			{ border-left-width: 1px; border-right: 1px solid #555656; border-top-width: 1px; border-bottom: 1px solid #555656; }
.block_top a:link		    { font-size: 12px; font-family: tahoma, serif; color: #2e2e8a; text-decoration:underline; font-weight: normal; }
.block_top a:visited		{ font-size: 12px; font-family: tahoma, serif; color: #2e2e8a; text-decoration: underline; font-weight: normal; }
.block_top a:hover		    { font-size: 12px; font-family: tahoma, serif; color: #2e2e8a; text-decoration: underline; font-weight: normal; }
.block_top a:active		{ font-size: 12px; font-family: tahoma, serif; color: #2e2e8a;  text-decoration:underline; font-weight: normal; }

.dotted {border-style: dotted}
.table5 { border-color: rgb( 52, 107, 247); border-style: dotted; border-width: 1px }
.table6 { border-color: rgb( 52, 50, 147); border-style: dashed; border-width: 1px }
div#title_post {background: url(/world/title_background.png) no-repeat left top; vertical-align: middle; font-size: 17px; font-weight: bold; color: #ccc; text-align: left; text-indent: 15px; width: 100%; height: 24px; text-transform: uppercase;}

</style>

</head>
<body>




<table width="100%" border="0">
  <tr>
  
  
    <td width="200" valign="top">
		<table width="200" border="0" cellspacing="0" cellpadding="3" bgcolor="#CCCCCC" style="border-left:1px solid #B0C4DE; border-right:1px solid #B0C4DE; border-top:1px solid #B0C4DE; border-bottom:1px solid #B0C4DE;">
			<tr>
			<td>
				<p>programs</p>
    			<p>xxx</p>
    			<p>pictures</p>
    			<p>music</p>
    			<p>scripts</p>
			</td>
			</tr>
		</table>
	</td>
	
    <td width="100%" valign="top">
		<table width="100%" border="0" cellspacing="0" cellpadding="3"   class="table5">
			<tr>
			<td>
				<?php echo $display_block; ?>
			</td>
			</tr>
		</table>
	</td>
	
	<td width="200" valign="top">
		<table width="200" border="0" cellspacing="0" cellpadding="3"   class="table6">
			<tr>
			<td>
				a
			</td>
			</tr>
		</table>
	</td>

  
  
  </tr>
</table>

</body>
</html>

please help !!!

how can i paging this page ????

Posted: Mon Mar 19, 2007 7:13 pm
by Christopher
Can you let us know what you have tried, where you think the problem might be, and where this code is from?