help in next page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
firestar_lene
Forum Newbie
Posts: 10
Joined: Mon Mar 29, 2004 2:04 am

help in next page

Post by firestar_lene »

i have problem in displaying records in next page.when i select the month and year,it will display the first 50 records and the next 50 records in the next page.below i include the coding.


<?php
if (!eregi("admin.php", $PHP_SELF)) { die ("Access Denied"); }
if(is_admin('2') or is_admin('4')){

$mod_admin = "ENStory";
$mod_title = "STORY/ARTICLE";

/*********************************************************/
/* Functions */
/*********************************************************/

function select_display($display) {
echo "<br><b>Display this story ?</b>&nbsp;&nbsp;";
if (($display == 0) OR ($display == "")) {
$sel1 = "checked";
$sel2 = "";
}
if ($display == 1) {
$sel1 = "";
$sel2 = "checked";
}
echo "<input type=\"radio\" name=\"display\" value=\"0\" $sel1>No&nbsp;"
."<input type=\"radio\" name=\"display\" value=\"1\" $sel2>Yes"
."&nbsp;&nbsp;<br />";
}

function select_category($catid) {
global $db;
$sql = "SELECT DISTINCT b.id,a.title AS parent,b.title AS child FROM ".EN_CATEGORIES_TABLE." AS a, ".EN_CATEGORIES_TABLE." AS b WHERE a.id=b.parent AND b.parent!='0' ORDER BY b.parent";
if ( !($result = $db->sql_query($sql)) ){
message_die(GENERAL_ERROR, "Couldn't obtain category information.", "", __LINE__, __FILE__, $sql);
}
$numrows = $db->sql_numrows($result);

echo "<br><b>Category:</b>&nbsp;";
echo "<select name=\"catid\">"
."<option value=\"0\">None</option>";
for($i = 1; $i <= $numrows; $i++) {
list($id,$parent,$child) = $db->sql_fetchrow($result);

echo "<option value=\"$id\"";
if($catid == $id) echo " selected=\"selected\"";
echo ">[".stripslashes(strtoupper($parent))."] ".stripslashes($child)."</option>";
}
echo "</select>";
}

function edit($id) {
global $mod_admin,$mod_title,$db,$mainfile,$userdata;
include ('header.php');
AdminLinks();
$sql = "SELECT cid,title,subtitle,author,email,content,display,date FROM " . EN_STORIES_TABLE ." WHERE id ='$id'";
if ( !($result = $db->sql_query($sql)) ){
message_die(GENERAL_ERROR, "Couldn't obtain category information.", "", __LINE__, __FILE__, $sql);
}
list($cid,$title,$subtitle,$author,$email,$content,$display,$date) = $db->sql_fetchrow($result);
$date_array = explode(" ",$date);
$thedate = explode("-",$date_array[0]);
$thetime = explode(":",$date_array[1]);
$title = stripslashes($title);
$subtitle = stripslashes($subtitle);
$author = stripslashes($author);
$content = stripslashes($content);

// Retrieve Category Title
OpenTable3("90%");
echo "<br><center><div class=\"title\">Edit $mod_title</div></center><br>";
echo "<form action=\"admin.php\" method=\"post\" name=\"editor\">";
OpenTable("80%");
echo "<b>Title</b><br />"
."<input type=\"text\" name=\"title\" size=\"80\" value='".$title."'><br />";
echo "<b>Sub-Title</b><br />"
."<input type=\"text\" name=\"subtitle\" size=\"80\" value='".$subtitle."'><br />";
echo "<b>Author</b><br />"
."<input type=\"text\" name=\"author\" size=\"80\" value=\"$author\"><br />";
echo "<b>Email</b><br />"
."<input type=\"text\" name=\"email\" size=\"80\" value=\"$email\"><br />";
echo "<b>Date</b> <i>(yyyy/mm/dd hh:mm:ss)</i><br />"
."<input type='text' name='year' size='4' value='".$thedate[0]."'>/"
."<input type='text' name='month' size='2' value='".$thedate[1]."'>/"
."<input type='text' name='day' size='2' value='".$thedate[2]."'>&nbsp;&nbsp;"
."<input type='text' name='hours' size='2' value='".$thetime[0]."'>:"
."<input type='text' name='minutes' size='2' value='".$thetime[1]."'>:"
."<input type='text' name='seconds' size='2' value='".$thetime[2]."'><br />";
select_category($cid);
echo "<br><br><b>Content</b><br />";
//."<textarea wrap=\"virtual\" cols=\"80\" rows=\"30\" name=\"content\" class=\"content\">$content</textarea><br />";
echo "<script LANGUAGE=\"JavaScript\">\n"
."<!--\n"
."function button_over(eButton) {\n"
."eButton.style.backgroundColor = \"#B5BDD6\";"
."eButton.style.borderColor = \"darkblue darkblue darkblue darkblue\";"
."}\n";

echo "function button_out(eButton) {\n"
."eButton.style.backgroundColor = \"#efedde\";\n"
."eButton.style.borderColor = \"#efedde\";\n"
."}\n";

echo "function button_down(eButton) {\n"
."eButton.style.backgroundColor = \"#8494B5\";\n"
."eButton.style.borderColor = \"darkblue darkblue darkblue darkblue\";\n"
."}\n";

echo "function button_up(eButton) {\n"
."eButton.style.backgroundColor = \"#B5BDD6\";\n"
."eButton.style.borderColor = \"darkblue darkblue darkblue darkblue\";\n"
."eButton = null;\n"
."}\n";

echo "var isHTMLMode=false\n";

echo "function document.onreadystatechange() {\n"
."idContent.document.designMode = \"On\";\n"
."}\n";

echo "function cmdExec(cmd,opt) {\n"
."if (isHTMLMode) {\n"
."alert(\"Please uncheck 'Edit HTML'\");\n"
."return;\n"
."}\n"
."idContent.document.execCommand(cmd,\"\",opt);\n"
."idContent.focus();\n"
."}\n";

echo "function setMode(bMode) {\n"
."var sTmp;\n"
."isHTMLMode = bMode;\n"
."if (isHTMLMode) {\n"
."sTmp=idContent.document.body.innerHTML;\n"
."idContent.document.body.innerText=sTmp;\n"
."} else {\n"
."sTmp=idContent.document.body.innerText;\n"
."idContent.document.body.innerHTML=sTmp;\n"
."}\n"
."idContent.focus();\n"
."}\n";

echo "function createLink() {\n"
."if (isHTMLMode) {\n"
."alert(\"Please uncheck 'Edit HTML'\");\n"
."return;\n"
."}\n"
."cmdExec(\"CreateLink\");\n"
."}\n";

echo "function insertImageLink() {\n"
."if (isHTMLMode) {\n"
."alert(\"Please uncheck 'Edit HTML'\");\n"
."return;\n"
."}\n"
."var sImgSrc=prompt(\"Insert Image File (You can use your local image file) : \", \"../gallery/english/logo.jpg\");\n"
."if(sImgSrc!=null) cmdExec(\"InsertImage\",sImgSrc);\n"
."}\n";

echo "function insertImageLocal() {\n"
."if (isHTMLMode) {\n"
."alert(\"Please uncheck 'Edit HTML'\");\n"
."return;\n"
."}\n"
."var sImgSrc = showModalDialog(\"select_image.php\",\"\",\"dialogHeight: 500px; dialogWidth: 650px; dialogTop: px; dialogLeft: px; edge: Raised; center: Yes; help: No; resizable: Yes; status: No;\");\n"
."if(sImgSrc!=null) cmdExec(\"InsertImage\",sImgSrc);\n"
."}\n";

echo "function uploadImages() {\n"
."var newWindow;\n"
."var props = 'scrollBars=yes,resizable=yes,toolbar=no,menubar=no,location=no,directories=no,width=650,height=500,top=100,left=200';\n"
."newWindow = window.open('upload_image.php', 'Upload_Images_to_server', props);\n"
."}\n";

echo "function SubmitContent() {\n"
."if (isHTMLMode) {\n"
."alert(\"Please uncheck 'Edit HTML'\");\n"
."return (false);\n"
."}\n"
."document.editor.content.value = idContent.document.body.innerHTML;\n"
."document.editor.submit();\n"
."}\n";

echo "function foreColor() {\n"
."var arr = showModalDialog(\"selcolor.php\",\"\",\"font-family:Verdana; font-size:12; dialogWidth:45em; dialogHeight:24em\" );\n"
."if (arr != null) cmdExec(\"ForeColor\",arr);\n"
."}\n";

echo "function transferValue() {\n"
."idContent.document.designMode=\"On\"\n"
."var theHTML = document.editor.content.value;\n"
."idContent.document.open();\n"
."idContent.document.write(theHTML)\n"
."idContent.document.close();\n"
."}\n";

echo "function document.onreadystatechange() {\n"
."transferValue();\n"
."}\n";
echo "-->\n"
."</script>\n";

echo "<table border='0' cellpadding='1' cellspacing='0'>"
."<tr><td bgcolor='#d2b48c'>";
echo "<table border='0' cellpadding='0' cellspacing='0'>"
."<tr><td align='top' bgcolor='#efedde'>";
echo "<table border='0' cellpadding='0' cellspacing='0'>"
."<tr><td>&nbsp;"
."<select onchange=\"cmdExec('formatBlock',this[this.selectedIndex].value);this.selectedIndex=0\" id=select1 name=select1>"
."<option selected>Style</option>"
."<option value='Normal'>Normal</option>"
."<option value='Heading 1'>Heading 1</option>"
."<option value='Heading 2'>Heading 2</option>"
."<option value='Heading 3'>Heading 3</option>"
."<option value='Heading 4'>Heading 4</option>"
."<option value='Heading 5'>Heading 5</option>"
."<option value='Address'>Address</option>"
."<option value='Formatted'>Formatted</option>"
."<option value='Definition Term'>Definition Term</option>"
."</select>"
."<select onchange=\"cmdExec('fontname',this[this.selectedIndex].value);\" id=select2 name=select2>"
."<option selected>Font</option>"
."<option value='Arial'>Arial</option>"
."<option value='Arial Black'>Arial Black</option>"
."<option value='Arial Narrow'>Arial Narrow</option>"
."<option value='Comic Sans MS'>Comic Sans MS</option>"
."<option value='Courier New'>Courier New</option>"
."<option value='System'>System</option>"
."<option value='Tahoma'>Tahoma</option>"
."<option value='Times New Roman'>Times New Roman</option>"
."<option value='Verdana'>Verdana</option>"
."<option value='Wingdings'>Wingdings</option>"
."</select>"
."<select onchange=\"cmdExec('fontsize',this[this.selectedIndex].value);\" id=select3 name=select3>"
."<option selected>Size</option>"
."<option value='1'>1</option>"
."<option value='2'>2</option>"
."<option value='3'>3</option>"
."<option value='4'>4</option>"
."<option value='5'>5</option>"
."<option value='6'>6</option>"
."<option value='7'>7</option>"
."<option value='8'>8</option>"
."<option value='10'>10</option>"
."<option value='12'>12</option>"
."<option value='14'>14</option>"
."</select>"
."</td>"
."<td nowrap height='22'>&nbsp; <img hspace='1' vspace='1' align=absmiddle src='images/std/imageUpload.gif' alt='Upload Images' onClick='uploadImages()' onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/imageLocal.gif' alt='Insert Local Image' onClick='insertImageLocal()' onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/imageLink.gif' alt='Insert Link to External Image' onClick='insertImageLink()' onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/Link.gif' alt='Insert Link' onClick=\"cmdExec('createLink')\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>"
."&nbsp; </td>"
."</tr>"
."</table>"
."<table border='0' cellpadding='0' cellspacing='0'>"
."<tr>"
."<td nowrap height='22'>&nbsp; <img hspace='1' vspace=1 align=absmiddle src='images/std/Cut.gif' alt='Cut' onClick=\"cmdExec('cut')\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>\n"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/Copy.gif' alt='Copy' onClick=\"cmdExec('copy')\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>\n"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/Paste.gif' alt='Paste' onClick=\"cmdExec('paste')\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>\n"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/Undo.gif' alt='Undo' onClick=\"cmdExec('Undo')\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>\n"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/Bold.gif' alt='Bold' onClick=\"cmdExec('bold')\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>\n"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/Italic.gif' alt='Italics' onClick=\"cmdExec('italic')\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>\n"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/under.gif' alt='Underline' onClick=\"cmdExec('underline')\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>\n"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/Strikethrough.gif' alt='Strike-through' onClick=\"cmdExec('StrikeThrough')\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>\n"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/Superscript.gif' alt='Superscript' onClick=\"cmdExec('SuperScript')\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>\n"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/Subscript.gif' alt='Subscript' onClick=\"cmdExec('SubScript')\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>\n"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/left.gif' alt='Justify Left' onClick=\"cmdExec('justifyleft')\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>\n"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/Center.gif' alt='Center' onClick=\"cmdExec('justifycenter')\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>\n"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/right.gif' alt='Justify Right' onClick=\"cmdExec('justifyright')\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>\n"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/numlist.gif' alt='Ordered List' onClick=\"cmdExec('insertorderedlist')\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>\n"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/bullist.gif' alt='Unordered List' onClick=\"cmdExec('insertunorderedlist')\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>\n"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/inindent.gif' alt='Increase Indent' onClick=\"cmdExec('indent')\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>\n"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/outdent.gif' alt='Decrease Indent' onClick=\"cmdExec('outdent')\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>\n"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/HR.gif' alt='Insert Horizontal Rule' onClick=\"cmdExec('InsertHorizontalRule')\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>\n"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/fgcolor.gif' alt='Forecolor' onClick=\"foreColor()\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>\n"
."&nbsp;</td>"
."</tr></table>";
echo "</td></tr>"
."<tr><td>";
echo "<iframe width='600' id='idContent' height='380'></iframe>"
."<div id='Lyr1' style='position:absolute; visibility: hidden'><textarea name='content' cols='0' rows='0'>$content</textarea></div>";
echo "</td></tr>"
."<tr><td bgcolor='#efedde' align='right'>"
."<input type='checkbox' onclick='setMode(this.checked)' name='checkbox1'>Edit HTML";
echo "</td></tr></table>";
echo "</td></tr></table>";
select_display($display);
echo "<br /><br />";
echo "<input type=\"hidden\" name=\"op\" value=\"$mod_admin\">"
."<input type=\"hidden\" name=\"do\" value=\"save\">"
."<input type=\"hidden\" name=\"id\" value=\"$id\">"
."<input type=\"submit\" value=\"Save Changes\" onclick=\"SubmitContent();\">";
CloseTable();
echo "</form>";
CloseTable3();
echo "<br /><br />";
include ('footer.php');
}

function remove($id, $ok=0) {
global $mod_admin,$mod_title,$db,$mainfile,$userdata;
if($ok) {
$db->sql_query("DELETE FROM ".EN_STORIES_TABLE." where id=$id");
Header("Location: admin.php?op=".$mod_admin."");
} else {
include("header.php");
AdminLinks();
OpenTable3("90%");
echo "<br><center><div class=\"title\">Delete $mod_title</div></center>";
echo "<br>";
$result= $db->sql_query("SELECT title FROM " . EN_STORIES_TABLE ." WHERE id ='$id'");
list($story_title) = $db->sql_fetchrow($result);
OpenTable("100%");
echo "<center>Are you sure to remove <b>$id</b>&nbsp;$story_title ?";
echo "<br><br>[ <a href=\"admin.php?op=$mod_admin\">No</a> | <a href=\"admin.php?op=$mod_admin&do=remove&id=$id&ok=1\">Yes</a> ]</center>";
echo "<br><br>";
CloseTable();
CloseTable3();
include("footer.php");
}
}


function change($id,$title,$subtitle,$author,$email,$content,$catid,$display,$day,$month,$year,$hours,$minutes,$seconds) {
global $mod_admin,$db;
$mydate = $year."-".$month."-".$day." ".$hours.":".$minutes.":".$seconds;
if(empty($title)) $title = "-Untitled-";
$title = addslashes($title);
$subtitle = addslashes($subtitle);
$author = addslashes($author);
$note = addslashes($note);
$db->sql_query("UPDATE ".EN_STORIES_TABLE." SET title='$title',subtitle='$subtitle',author='$author',email='$email',content='$content',cid='$catid',display='$display',date='$mydate' where id=$id");
Header("Location: admin.php?op=$mod_admin");
}

function post($title,$subtitle,$author,$email,$content,$catid,$display,$day,$month,$year,$hours,$minutes,$seconds) {
global $mod_admin,$db;
$mydate = $year."-".$month."-".$day." ".$hours.":".$minutes.":".$seconds;
if(empty($title)) $title = "-Untitled-";
$title = addslashes($title);
$subtitle = addslashes($subtitle);
$author = addslashes($author);
$note = addslashes($note);

$sql = "INSERT INTO ".EN_STORIES_TABLE." SET title='$title',subtitle='$subtitle',author='$author',email='$email',content='$content',cid='$catid',display='$display',date='$mydate',count='0'";
if ( !($result = $db->sql_query($sql)) ){
message_die(GENERAL_ERROR, "Couldn't add story into database.", "", __LINE__, __FILE__, $sql);
}
Header("Location: admin.php?op=$mod_admin");
}

function dohighlight($id){
global $mod_admin,$db;
$result = $db->sql_query("SELECT highlight FROM ".EN_STORIES_TABLE." WHERE id='$id'");
list($my) = $db->sql_fetchrow($result);
if($my =='1') $new = '0';
else $new = '1';

$db->sql_query("UPDATE ".EN_STORIES_TABLE." SET highlight='$new' WHERE id='$id'");
Header("Location: admin.php?op=$mod_admin");
}

function create(){
global $mod_admin,$mod_title,$db,$mainfile,$userdata;
include ("header.php");
AdminLinks();

// Entry Form
echo "<br />";
OpenTable2("96%");
echo "<br><center><div class=\"title\">Add $mod_title</div></center>";
echo "<form action=\"admin.php\" method=\"post\" name=\"editor\">";
OpenTable("80%");
echo "<b>Title</b><br />"
."<input type=\"text\" name=\"title\" size=\"80\" value=\"$title\" class=\"content\"><br />";
echo "<b>Sub-Title</b><br />"
."<input type=\"text\" name=\"subtitle\" size=\"80\" value=\"$subtitle\" class=\"content\"><br />";
echo "<b>Author</b><br />"
."<input type=\"text\" name=\"author\" size=\"80\" value=\"$author\" class=\"content\"><br />";
echo "<b>Email</b><br />"
."<input type=\"text\" name=\"email\" size=\"80\" value=\"$email\" class=\"content\"><br />";
echo "<b>Date</b> <i>(yyyy/mm/dd hh:mm:ss)</i><br />"
."<input type='text' name='year' size='4' value='".date("Y")."'>/"
."<input type='text' name='month' size='2' value='".date("m")."'>/"
."<input type='text' name='day' size='2' value='".date("d")."'>&nbsp;&nbsp;"
."<input type='text' name='hours' size='2' value='".date("H")."'>:"
."<input type='text' name='minutes' size='2' value='".date("i")."'>:"
."<input type='text' name='seconds' size='2' value='".date("s")."'><br />";
select_category($catid);
echo "<br /><br />";
echo "<b>Content</b><br />";
//."<textarea wrap=\"virtual\" cols=\"80\" rows=\"30\" name=\"content\" class=\"content\">$content</textarea><br />";
echo "<script LANGUAGE=\"JavaScript\">\n"
."<!--\n"
."function button_over(eButton) {\n"
."eButton.style.backgroundColor = \"#B5BDD6\";"
."eButton.style.borderColor = \"darkblue darkblue darkblue darkblue\";"
."}\n";

echo "function button_out(eButton) {\n"
."eButton.style.backgroundColor = \"#efedde\";\n"
."eButton.style.borderColor = \"#efedde\";\n"
."}\n";

echo "function button_down(eButton) {\n"
."eButton.style.backgroundColor = \"#8494B5\";\n"
."eButton.style.borderColor = \"darkblue darkblue darkblue darkblue\";\n"
."}\n";

echo "function button_up(eButton) {\n"
."eButton.style.backgroundColor = \"#B5BDD6\";\n"
."eButton.style.borderColor = \"darkblue darkblue darkblue darkblue\";\n"
."eButton = null;\n"
."}\n";

echo "var isHTMLMode=false\n";

echo "function document.onreadystatechange() {\n"
."idContent.document.designMode = \"On\";\n"
."}\n";

echo "function cmdExec(cmd,opt) {\n"
."if (isHTMLMode) {\n"
."alert(\"Please uncheck 'Edit HTML'\");\n"
."return;\n"
."}\n"
."idContent.document.execCommand(cmd,\"\",opt);\n"
."idContent.focus();\n"
."}\n";

echo "function setMode(bMode) {\n"
."var sTmp;\n"
."isHTMLMode = bMode;\n"
."if (isHTMLMode) {\n"
."sTmp=idContent.document.body.innerHTML;\n"
."idContent.document.body.innerText=sTmp;\n"
."} else {\n"
."sTmp=idContent.document.body.innerText;\n"
."idContent.document.body.innerHTML=sTmp;\n"
."}\n"
."idContent.focus();\n"
."}\n";

echo "function createLink() {\n"
."if (isHTMLMode) {\n"
."alert(\"Please uncheck 'Edit HTML'\");\n"
."return;\n"
."}\n"
."cmdExec(\"CreateLink\");\n"
."}\n";

echo "function insertImageLink() {\n"
."if (isHTMLMode) {\n"
."alert(\"Please uncheck 'Edit HTML'\");\n"
."return;\n"
."}\n"
."var sImgSrc=prompt(\"Insert Image File (You can use your local image file) : \", \"../gallery/english/logo.jpg\");\n"
."if(sImgSrc!=null) cmdExec(\"InsertImage\",sImgSrc);\n"
."}\n";

echo "function insertImageLocal() {\n"
."if (isHTMLMode) {\n"
."alert(\"Please uncheck 'Edit HTML'\");\n"
."return;\n"
."}\n"
."var sImgSrc = showModalDialog(\"select_image.php\",\"\",\"dialogHeight: 500px; dialogWidth: 650px; dialogTop: px; dialogLeft: px; edge: Raised; center: Yes; help: No; resizable: Yes; status: No;\");\n"
."if(sImgSrc!=null) cmdExec(\"InsertImage\",sImgSrc);\n"
."}\n";

echo "function uploadImages() {\n"
."var newWindow;\n"
."var props = 'scrollBars=yes,resizable=yes,toolbar=no,menubar=no,location=no,directories=no,width=650,height=500,top=100,left=200';\n"
."newWindow = window.open('upload_image.php', 'Upload_Images_to_server', props);\n"
."}\n";

echo "function SubmitContent() {\n"
."if (isHTMLMode) {\n"
."alert(\"Please uncheck 'Edit HTML'\");\n"
."return (false);\n"
."}\n"
."document.editor.content.value = idContent.document.body.innerHTML;\n"
."document.editor.submit();\n"
."}\n";

echo "function foreColor() {\n"
."var arr = showModalDialog(\"selcolor.php\",\"\",\"font-family:Verdana; font-size:12; dialogWidth:45em; dialogHeight:24em\" );\n"
."if (arr != null) cmdExec(\"ForeColor\",arr);\n"
."}\n";

echo "function transferValue() {\n"
."idContent.document.designMode=\"On\"\n"
."var theHTML = document.editor.content.value;\n"
."idContent.document.open();\n"
."idContent.document.write(theHTML)\n"
."idContent.document.close();\n"
."}\n";

echo "function document.onreadystatechange() {\n"
."transferValue();\n"
."}\n";
echo "-->\n"
."</script>\n";

echo "<table border='0' cellpadding='1' cellspacing='0'>"
."<tr><td bgcolor='#d2b48c'>";
echo "<table border='0' cellpadding='0' cellspacing='0'>"
."<tr><td align='top' bgcolor='#efedde'>";
echo "<table border='0' cellpadding='0' cellspacing='0'>"
."<tr><td>&nbsp;"
."<select onchange=\"cmdExec('formatBlock',this[this.selectedIndex].value);this.selectedIndex=0\" id=select1 name=select1>"
."<option selected>Style</option>"
."<option value='Normal'>Normal</option>"
."<option value='Heading 1'>Heading 1</option>"
."<option value='Heading 2'>Heading 2</option>"
."<option value='Heading 3'>Heading 3</option>"
."<option value='Heading 4'>Heading 4</option>"
."<option value='Heading 5'>Heading 5</option>"
."<option value='Address'>Address</option>"
."<option value='Formatted'>Formatted</option>"
."<option value='Definition Term'>Definition Term</option>"
."</select>"
."<select onchange=\"cmdExec('fontname',this[this.selectedIndex].value);\" id=select2 name=select2>"
."<option selected>Font</option>"
."<option value='Arial'>Arial</option>"
."<option value='Arial Black'>Arial Black</option>"
."<option value='Arial Narrow'>Arial Narrow</option>"
."<option value='Comic Sans MS'>Comic Sans MS</option>"
."<option value='Courier New'>Courier New</option>"
."<option value='System'>System</option>"
."<option value='Tahoma'>Tahoma</option>"
."<option value='Times New Roman'>Times New Roman</option>"
."<option value='Verdana'>Verdana</option>"
."<option value='Wingdings'>Wingdings</option>"
."</select>"
."<select onchange=\"cmdExec('fontsize',this[this.selectedIndex].value);\" id=select3 name=select3>"
."<option selected>Size</option>"
."<option value='1'>1</option>"
."<option value='2'>2</option>"
."<option value='3'>3</option>"
."<option value='4'>4</option>"
."<option value='5'>5</option>"
."<option value='6'>6</option>"
."<option value='7'>7</option>"
."<option value='8'>8</option>"
."<option value='10'>10</option>"
."<option value='12'>12</option>"
."<option value='14'>14</option>"
."</select>"
."</td>"
."<td nowrap height='22'>&nbsp; <img hspace='1' vspace='1' align=absmiddle src='images/std/imageUpload.gif' alt='Upload Images' onClick='uploadImages()' onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/imageLocal.gif' alt='Insert Local Image' onClick='insertImageLocal()' onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/imageLink.gif' alt='Insert Link to External Image' onClick='insertImageLink()' onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/Link.gif' alt='Insert Link' onClick=\"cmdExec('createLink')\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>"
."&nbsp; </td>"
."</tr>"
."</table>"
."<table border='0' cellpadding='0' cellspacing='0'>"
."<tr>"
."<td nowrap height='22'>&nbsp; <img hspace='1' vspace=1 align=absmiddle src='images/std/Cut.gif' alt='Cut' onClick=\"cmdExec('cut')\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>\n"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/Copy.gif' alt='Copy' onClick=\"cmdExec('copy')\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>\n"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/Paste.gif' alt='Paste' onClick=\"cmdExec('paste')\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>\n"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/Undo.gif' alt='Undo' onClick=\"cmdExec('Undo')\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>\n"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/Bold.gif' alt='Bold' onClick=\"cmdExec('bold')\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>\n"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/Italic.gif' alt='Italics' onClick=\"cmdExec('italic')\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>\n"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/under.gif' alt='Underline' onClick=\"cmdExec('underline')\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>\n"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/Strikethrough.gif' alt='Strike-through' onClick=\"cmdExec('StrikeThrough')\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>\n"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/Superscript.gif' alt='Superscript' onClick=\"cmdExec('SuperScript')\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>\n"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/Subscript.gif' alt='Subscript' onClick=\"cmdExec('SubScript')\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>\n"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/left.gif' alt='Justify Left' onClick=\"cmdExec('justifyleft')\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>\n"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/Center.gif' alt='Center' onClick=\"cmdExec('justifycenter')\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>\n"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/right.gif' alt='Justify Right' onClick=\"cmdExec('justifyright')\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>\n"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/numlist.gif' alt='Ordered List' onClick=\"cmdExec('insertorderedlist')\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>\n"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/bullist.gif' alt='Unordered List' onClick=\"cmdExec('insertunorderedlist')\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>\n"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/inindent.gif' alt='Increase Indent' onClick=\"cmdExec('indent')\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>\n"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/outdent.gif' alt='Decrease Indent' onClick=\"cmdExec('outdent')\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>\n"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/HR.gif' alt='Insert Horizontal Rule' onClick=\"cmdExec('InsertHorizontalRule')\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>\n"
."<img hspace='1' vspace=1 align=absmiddle src='images/std/fgcolor.gif' alt='Forecolor' onClick=\"foreColor()\" onmouseover='button_over(this);' onmouseout='button_out(this);' onmousedown='button_down(this);' onmouseup='button_up(this);'>\n"
."&nbsp;</td>"
."</tr></table>";
echo "</td></tr>"
."<tr><td>";
echo "<iframe width='600' id='idContent' height='380'></iframe>"
."<div id='Lyr1' style='position:absolute; visibility: hidden'><textarea name='content' cols='0' rows='0'></textarea></div>";
echo "</td></tr>"
."<tr><td bgcolor='#efedde' align='right'>"
."<input type='checkbox' onclick='setMode(this.checked)' name='checkbox1'>Edit HTML";
echo "</td></tr></table>";
echo "</td></tr></table>";
select_display($display);
echo "<br />";
echo "<input type=\"hidden\" name=\"op\" value=\"$mod_admin\">";
echo "<input type=\"hidden\" name=\"do\" value=\"post\">";
echo "<input type=\"submit\" value=\"Submit\" onclick=\"SubmitContent();\">";
CloseTable();
echo "</form>";
CloseTable2();
echo "<br /><br />";
include ("footer.php");
}

function admin($page="",$hid=""){
global $mod_admin,$mod_title,$db,$mainfile,$userdata;
include ("header.php");
AdminLinks();

OpenTable3("96%");

echo "<table border='0' cellspacing='0' align='center'><tr><td valign='top' align='center' colspan='2'>";
echo "<br />";
echo "<form action=\"admin.php\" method=\"post\">"
."<input type=\"hidden\" name=\"op\" value=\"$mod_admin\">"
."<input type=\"hidden\" name=\"do\" value=\"create\">"
."<input type=\"submit\" name=\"addbutton\" value=\"ADD NEW RECORD\">"
."</form>";
echo "</td></tr><tr><td valign='top'>";
echo "<form action=\"admin.php\" method=\"post\">"
."<input type=\"hidden\" name=\"op\" value=\"$mod_admin\">"
."<input type=\"hidden\" name=\"hid\" value=\"0\">"
."<input type=\"submit\" name=\"addbutton\" value=\"SHOW ACTIVATED\">"
."</form>";
echo "</td><td valign='top'>";
echo "<form action=\"admin.php\" method=\"post\">"
."<input type=\"hidden\" name=\"op\" value=\"$mod_admin\">"
."<input type=\"hidden\" name=\"hid\" value=\"1\">"
."<input type=\"submit\" name=\"addbutton\" value=\"SHOW HIDDEN \">"
."</form>";
echo "</td></tr></table>";
CloseTable3();

// Browse
$sql = "SELECT id,cid,title,subtitle,author,email,display,date,count,highlight FROM ".EN_STORIES_TABLE."";
if(!empty($hid)) $sql .= " WHERE display='0'";
else $sql .= " WHERE display='1'";
$sql .= " ORDER BY date desc";
$limit = 20;
$numresults = $db->sql_query($sql);
$numrows = mysql_num_rows($numresults);

if (empty($page)) $page=1;
$offset = $limit * ($page-1);
$result = mysql_query("$sql limit $offset, $limit");
$rows = mysql_num_rows($result);

OpenTable3("96%");
echo "<br><center><div class=\"title\">BROWSE $mod_title</div></center><br>";
OpenTable("100%");
echo "<center><table border=\"1\" width=\"100%\">";
for($i = 1; $i <= $rows; $i++) {
list($id,$cid,$title,$subtitle,$author,$email,$display,$date,$count,$highlight) = mysql_fetch_row($result);

// Retrieve Category Title
$result2 = $db->sql_query("SELECT DISTINCT a.title AS parent, b.title AS child FROM ".EN_CATEGORIES_TABLE." AS a,".EN_CATEGORIES_TABLE." AS b where b.id = '$cid' AND b.parent=a.id");
list($parent,$child) = $db->sql_fetchrow($result2);

echo "<tr><td align=\"right\"><b>$id</b>"
."</td><td align=\"left\" width=\"100%\"><a href=\"article.php?id=$id\"><b>".stripslashes($title)."</b></a><div class=\"smtext\"><font color=\"black\"><b>".stripslashes($subtitle)."</b></font></div>"
."</td><td align=\"left\">$date"
."</td><td align=\"left\">";
if(!empty($author) && !empty($email)) echo "<a href=\"mailto:$email\">$author</a>";
else if(!empty($author)) echo "$author";
else echo "_______";

echo "</td><td align=\"left\">".stripslashes(strtoupper($parent)).""
."</td><td align=\"left\">".stripslashes($child).""
."</td><td align=\"left\">$count"
."</td><td align=\"right\">";
if($display=='1') echo "<img src=\"images/std/visible.gif\" alt=\"Visible\" border=\"0\">";
else echo "<img src=\"images/std/invisible.gif\" alt=\"Invisible\" border=\"0\">";

echo "</td><td align=\"right\">";
if($highlight=='1') echo "<a href='$PHP_SELF?op=$mod_admin&do=highlight&id=$id'><img src=\"images/std/star1.gif\" alt=\"Highlighted, click to disable !\" border=\"0\"></a>";
else echo "<a href='$PHP_SELF?op=$mod_admin&do=highlight&id=$id'><img src=\"images/std/star0.gif\" alt=\"Not highlighted, click to highlight !\" border=\"0\"></a>";

echo "</td><td align=\"right\">&nbsp;<a href=\"admin.php?op=$mod_admin&do=edit&id=$id\"><img src=\"images/std/edit.gif\" border=\"0\" alt=\"Edit\" /></a>|<a href=\"admin.php?op=$mod_admin&do=remove&id=$id\"><img src=\"images/std/del.gif\" border=\"0\" alt=\"Delete\" /></a>&nbsp;"
."</td></tr>";
}
echo "</table>";
echo "<br /><br />";
$numpages = intval($numrows/$limit);
if($numpages>=1) echo "&nbsp;Page:&nbsp;&nbsp;";

if($page>1){
$regpage = $page-1;
print "&nbsp;<a href='$PHP_SELF?op=$mod_admin&page=$regpage&hid=$hid'><b>PREV</b></a>\n";
}

if($numrows%$limit){
$numpages++;
}

$firstpage = max(1,$page-1);
$lastpage = min($numpages,$fistpage+9);

for ($i=$firstpage;$i<=$lastpage;++$i){
if($page!=$i) print "&nbsp;<a href='$PHP_SELF?op=$mod_admin&page=$i&hid=$hid'>$i</a>";
if($page==$i and $numpages!=1) print "&nbsp;<font color=\"red\"><b>$i</b></font>";
print "\n";
}

if($page<$numpages){
$refpage = $page+1;
print "&nbsp;<a href='".$_SERVER['PHP_SELF']."?op=$mod_admin&page=$refpage&hid=$hid'><b>NEXT</b></a><p>\n";
}
echo "<br /><br />";
CloseTable();
CloseTable3();

echo "<br />";
OpenTable2("96%");
OpenTable("100%");
echo "<br />";
echo "<center>"
."<form action=\"".$_SERVER['PHP_SELF']."\" method=\"post\">ID : "
."<input type=\"text\" name=\"id\" size=\"10\">"
."<input type=\"hidden\" name=\"op\" value=\"$mod_admin\">"
."<select name=\"do\">"
."<option value=\"edit\" selected=\"selected\">EDIT</option>"
."<option value=\"remove\">DELETE</option>"
."</select>"
."<input type=\"submit\" value=\"GO\">"
."</form></center>";
CloseTable();
CloseTable2();
echo "<br /><br />";
include ("footer.php");
}

switch($do) {

case "edit":
edit($id);
break;

case "remove":
remove($id, $ok);
break;

case "save":
change($id,$title,$subtitle,$author,$email,$content,$catid,$display,$day,$month,$year,$hours,$minutes,$seconds);
break;

case "post":
post($title,$subtitle,$author,$email,$content,$catid,$display,$day,$month,$year,$hours,$minutes,$seconds);
break;

case "create":
create();
break;

case "highlight":
dohighlight($id);
break;

default:
admin($page,$hid);
break;
}

} else {
include ('header.php');
AdminLinks();
OpenTable3("90%");
echo "<br><center><div class=\"title\">Access Denied!</div></center>";
echo "<br>";
OpenTable("100%");
echo "<center>Sorry! You are not authorized to perform this task.</center>";
echo "<br><br>";
CloseTable();
CloseTable3();
include("footer.php");
}
?>
firestar_lene
Forum Newbie
Posts: 10
Joined: Mon Mar 29, 2004 2:04 am

next page problem

Post by firestar_lene »

sorry,the earlier coding is wrong.this is the correct coding that have probelm that i want to solve

have problem in display the records in the next page.when i select the month and year from the puill down,it display the first 50 records and it will display the next 50 records in the next page.but it didnt display the next 50 records in the next page.....i included the coding below..anybody can help?whats is missing



<?php


if (!eregi("admin.php", $PHP_SELF)) { die ("Access Denied"); }
if(is_admin('2')) {

$mod_admin = "en_aview";
$mod_title = "ACTIVITY VIEWING";

/*********************************************************/
/* Functions */
/*********************************************************/
function select_date($name,$year,$month){
$select = "<select name=\"".$name."_month\">";
$select .= "<option value=\"00\">-----</option>";
for ($im=1; $im < 13 ; $im++){
$select .= "<option value=\"$im\"";
if($month == $im) $select .=" selected=\"selected\"";
$select .= " >".date("F", mktime(2, 0, 0, $im, 1, 2000) )."</option>";
}
$select .= "</select>";

$select .= "<select name=\"".$name."_year\">";
$year_end = date("Y") + 1;
$select .= "<option value=\"0000\">----</option>";
for ($iy = 2000 ; $iy < $year_end; $iy++){
$select .= "<option value=\"$iy\"";
if($year == $iy) $select .=" selected=\"selected\"";
$select .= ">".$iy."</option>";
}
$select .= "</select>";

return $select;
}

function menu($start_year,$start_month){
global $mod_admin,$mod_title;

echo "<center><div class='title'>".$mod_title."</div></center><br />";
echo "<form method='post' action='".$_SERVER["PHPSELF"]."'>";
echo "<table width='200' border='0' cellspacing='0' align='center'>";
echo "<tr><td>".select_date("start",$start_year,$start_month);
echo "</td><td>"
."<input type='submit' name='submitok' value=' Go '>"
."<input type='hidden' name='op' value='".$mod_admin."'>"
."</td></tr>";
echo "</table></form>";
echo "<br />";
}

function main($submitok,$start_year,$start_month){
global $mod_admin,$db,$mainfile,$userdata,$mod_title;
include ("header.php");
AdminLinks();

OpenTable3("96%");
echo "<br />";
menu($start_year,$start_month);
if($submitok){
$start = mktime(0, 0, 0, $start_month, 1, $start_year);
$end = mktime(0, 0, 0, $start_month, 31, $start_year);
if(!isset($page)) $page = 1;
$pagesize = 50;

$sqlSearch = "SELECT id,date,ip,login,activity FROM ".EN_ACTIVITY_TABLE." WHERE date >= $start AND date <= $end ORDER BY date";
$pagination = new datapager($sqlSearch);
$res = $pagination->execute($page, $pagesize);

echo "<table width=\"100%\" cellspacing=\"2\" cellpadding=\"5\" align=\"center\">";
echo "<tr bgcolor=\"#FF9900\" align='center'><td colspan=\"2\"><font color=\"#000000\"><b>Activity Report</b></font></td></tr>";
echo "<table width='100%' cellpadding='5' cellspacing='0' border='1'>";
echo "<tr><td><b>DATE</b></td><td><b>USER ID</b></td><td><b>ACTIVITY</b></td><td><b>IP ADDRESS</b></td></tr>";

if( $res ){
while ( $row = $db->sql_fetchrow($res) )
{
$result = $db->sql_query("SELECT title FROM ".EN_ACTIVITY_CAT_TABLE." WHERE id='".$row['activity']."'");
list($act_title) = $db->sql_fetchrow($result);

$result2 = $db->sql_query("SELECT username FROM ".USERS_TABLE." WHERE user_id='".$row['login']."'");
list($username) = $db->sql_fetchrow($result2);

echo "<tr><td>".date("d-M-Y",$row['date'])."</td><td>".$username."</td><td>".$act_title."</td><td>".$row['ip']."</td></tr>";
}
}

echo "</table>";
// Gets the current records according to the current page
echo "<center><br>";
echo $pagination->prevpage("<a href='".$_SERVER["PHPSELF"]."?op=$mod_admin&do=doresult&realname=$realname&username=$username&start_year=$start_year&start_month=$start_month&page=%page%'>< Previous</a>&nbsp;&nbsp;\n")
."Page: <strong>".$pagination->page." of ".$pagination->pagecount."</strong>"
."&nbsp;&nbsp;".$pagination->nextpage("<a href='".$_SERVER["PHPSELF"]."?op=$mod_admin&do=doresult&realname=$realname&username=$username&start_year=$start_year&start_month=$start_month&page=%page%'>Next ></a>")
."<br>";

// Gets the links for browsing
echo "<table width='100%' align='center'><tr>\n";
echo "<td width='96%' align='center'>".$pagination->pagelinks("<a href='".$_SERVER["PHPSELF"]."?op=$mod_admin&do=doresult&realname=$realname&username=$username&start_year=$start_year&start_month=$start_month&page=%page%'>%page%</a>", "%page%");
echo "</td></tr></table>";
echo "</center><br />";
echo "<tr><td colspan=\"2\"><br /></td></tr>"
."</table>";
$result = $db->sql_query("INSERT INTO ".EN_ACTIVITY_TABLE." SET date=UNIX_TIMESTAMP(CURDATE()),ip='".getenv("REMOTE_ADDR")."',login='".$userdata["user_id"]."',activity='10'"); // Activity Viewing
} else {
echo "<center><b>No result found</b></center>";
echo "<br /><br />";
}
CloseTable3();
include ("footer.php");
}

switch($do){
default:
main($submitok,$start_year,$start_month);
break;
}

} else {
include ('header.php');
AdminLinks();
OpenTable3("90%");
echo "<br><center><div class=\"title\">Access Denied!</div></center>";
echo "<br>";
OpenTable("100%");
echo "<center>Sorry! You are not authorized to perform this task.</center>";
echo "<br><br>";
CloseTable();
CloseTable3();
include("footer.php");
}
?>
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post by CoderGoblin »

Not trying to sound harsh but that is way too much code to browse through.

Am i right in saying the sql to get the information you require is

SELECT id,date,ip,login,activity FROM ".EN_ACTIVITY_TABLE." WHERE date >= $start AND date <= $end ORDER BY date

If yes does MySQL have OFFSET and LIMIT (I use POSTGRES) ? If so you can easily use offset=page*50 limit 50 to return just the information you need rather than everything. You may need to get a coun total to begin with so you know how many pages you need.

Have you looked at similar topics as pages of information have been discussed before.

Regards
firestar_lene
Forum Newbie
Posts: 10
Joined: Mon Mar 29, 2004 2:04 am

thanks

Post by firestar_lene »

thanks for the reply but im sitll blur partly because im still a begiiner in this coding and this problem occurs from previous programmer.

any other URL for "next page" coding in the forum?
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

Please try to narrow down your problem before posting EVERYTHING..
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post by tim »

and always post your php code within the [syntax=php][/syntax] tags
Post Reply