Jump to content

Recommended Posts

hello i am writing a message script i am not sure where this problem lies but  everything works until i hit next to go to the second page then when i click a message to open it i get

 

 

"thanks for signing up for our classifieds"  is this a pagination error or an array session error with my code???

 

:wtf:

 

Messages.php

<?php


ob_start();


if($_POST['ajax_option']!=''){


    require_once('.global.php');


    $m_id=$_GET['m_id'];


}





require_once('inc/agent_functions.php');


//require_once('fvalidation.php');


include_once('configurations.php');


include_once('inc/tripwire_functions.php');








// Check to see if user has an active session


if($_SESSION['fname'] == "" and $_POST['ajax_option']==''){


echo '	


<p>You must be logged in to place an ad. Please log in<br />


<form name="form2" method="post" action="index.php?content=checkuser&page=cc">


	<span class="maintext">User Name :</span>          


        <input type="text" name="username" />


        <br />


        <span class="maintext">Password:  </span>  


        <input type="password" name="password" />


        <br />


        <br />


        <input type="submit" name="Submit" value="Submit">        


</form>


    <br />


    <span class="maintext">


    	<a href="index.php?content=lostpasswordform">Forgot Password</a>


    </span></p>';


}else{








// Gets the data


$id=isset($_POST['id']) ? $_POST['id'] : '';


$search=isset($_POST['search']) ? $_POST['search'] : '';


$multiple_search=isset($_POST['multiple_search']) ? $_POST['multiple_search'] : array();


$items_per_page=isset($_POST['items_per_page']) ? $_POST['items_per_page'] : '';


$sort=isset($_POST['sort']) ? $_POST['sort'] : 't_t_1d_t';


$page=isset($_POST['page']) ? $_POST['page'] : 1;


$total_items=(isset($_POST['total_items']) and $_POST['total_items']>=0) ? $_POST['total_items'] : '';


$extra_cols=isset($_POST['extra_cols']) ? $_POST['extra_cols'] : array();





// Uses the creativeTable to build the table


include_once('creativeTable.php');








$ct=new CreativeTable();





// Data Gathering


$params['sql_query']            = 'SELECT id,received_by,date,subject FROM notifications WHERE member_id=' . $m_id  ;   // IMPORTANT: you must specify the fields and not use *


$params['search']               = $search;


$params['multiple_search']      = $multiple_search;


$params['items_per_page']       = $items_per_page;


$params['sort']                 = $sort;


$params['page']                 = $page;


$params['total_items']          = $total_items;











// Layout Configurations (Most used - the commented lines are the default values)


$params['header']               = 'id,Sender,date,subject';    // If you need to use the comma use &#44; instead of ,


$params['width']                = '30,180,70';


$params['items_per_page_init']  = '7';               // default: '10*$i';


$params['ajax_url'] = 'messages.php?m_id='.$m_id;





$ct->table($params);





//print_r($ct);





$ct->pager = getCreativePagerLite('ct',$page,$ct->total_items,$ct->items_per_page);





// the data from the sql query is stored in the $ct->data in a 2D array format


//    [0] => Array


//        (


//            [0] => 1


//            [1] => 9.1


//            [2] => The Shawshank Redemption (1994)


//            [3] => 489048


//        )


//


//    [1] => Array


//        (


//            [0] => 2


//            [1] => 9.1


//            [2] => The Godfather (1972)


//            [3] => 392126


//				)


//


//		...





// Now you can adjust the data for your needs





foreach($ct->data as $key => $value){





	$ct->data[$key][3]='<a class="ezjax" href="view_message.php?id='.$ct->data[$key][0].'">'.$ct->data[$key][3].'</a>'; 











//  $ct->data[$key][3]='<a class="ezjax" href=" onclick="part2('.$ct->data[$key][0].');" href="javascript:void();">'.$ct->data[$key][3].'</a>';





//foreach($ct->data as $key => $value){


  //$ct->data[$key][3]='<a href=#" onclick="part2();" href="&id='.$ct->data[$key][0].'">'.$ct->data[$key][3].'</a>';





// $ct->data[$key][3]='<a onclick="part2();" href="#&id='.$ct->data[$key][0].'">'.$ct->data[$key][3].'</a>';


    //$ct->data[$key][2]='<a href="something.php?id=#COL1#">'.$ct->data[$key][2].'</a>'; //you may use also the tags #COL1#, #COL2#, ...


}





if($_POST['ajax_option']!=''){


    echo json_encode($ct->display($_POST['ajax_option'],true));


    exit;


}else{


    $out=$ct->display();


}


echo '<div id="notification_container">';


?>  


    <?php echo $out;?>





<?php 








echo "


<br><br>





<div id=\"ezjax_content\">





</div>





<br><br><br><br>    





</div>

 

 

Link to comment
https://forums.phpfreaks.com/topic/243319-pagination-problem/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.