Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7554255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:17:22+00:00 2026-05-30T11:17:22+00:00

I would just wanted to ask for a better idea for this. the scenario

  • 0

I would just wanted to ask for a better idea for this. the scenario is this:
1. Display messages on a clickable table row. if the message is already read the row can’t be clicked
2. Onced clicked it will open a popup window used for replying to the message. when the window is closed the page should refresh.

The problem is I can only get the last row data. it seems session variables are overwritten.

    <?php
    //Display Messages Starts Here
    $msg = "SELECT * FROM messages WHERE sid=". $_SESSION['SESS_SERVICE_ID'] ."";
    $resulta = mysql_query($msg)or die(mysql_error());
    while($row = mysql_fetch_array($resulta))
    {
        if($row['status']=='deleted'){
            echo "<tr bgcolor=#AAAAAA>";
            echo "<td>" . date("Y-m-d",strtotime($row['stamp'])) . "</td>";
            echo "<td>" . $row['msisdn'] . "</td>";
            echo "<td width=100%>" . $row['data'] . "</td>";
            echo "</tr>";
        }
        else{
            // id like to use this to a popup form for reply
            echo "<tr onmouseover='ChangeColor(this, true);' 
                      onmouseout='ChangeColor(this, false);' 
                      onclick=\"DoNav();\">";
            echo "<td>" . date("Y-m-d",strtotime($row['stamp'])) . "</td>";
            echo "<td>" . $row['msisdn'] . "</td>";
            $_SESSION['SESS_MSG_ID'] = $row['id'];
            $_SESSION['SESS_MSG_DATA'] = $row['data'];
            echo "<td width=100%>" . $row['data'] . "</td>";
            $_SESSION['SESS_MSG_NUM'] = $row['msisdn'];
            echo "</tr>";
        }
    }
    ?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T11:17:24+00:00Added an answer on May 30, 2026 at 11:17 am

    You are setting a $_SESSION variable, and this one is overwritten every time.

    You better store it in an array, like:

    $_SESSION[$row['id']]['SESS_MSG_DATA'] = $row['data'];
    

    And then change the onClick to:

    onclick=\"DoNav(".$row['id'].");
    

    And of course in DoNav function:

    function DoNav(row_id){
        window.open( "reply.php?id="+row_id, "myWindow", "status = 1, height = 300, width = 555, resizable = 0" );
    }
    

    And then in reply.php, get the ID with $_GET['id']; and get the data from the session like this:

    $_SESSION[$_GET['id']]['SESS_MSG_DATA'];
    

    Besides the SESS_MSG_DATA you can store them all in this array:

    $_SESSION[$row['id']][ANY VARIABLE HERE]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm almost sure this is not possible, but just wanted to ask if I'm
Just wanted to stop by and ask if anybody has had this problem. I’m
Just wanted to know if overriding UITabBarController would get my app rejected? Is it
I would like to learn ASP.NET and just wanted some input as to which
Normally I would just do this. $str = preg_replace('#(\d+)#', ' $1 ', $str); If
If I have a table of a hundred users normally I would just set
I just wanted to ask how to remove the first and the last char
I wanted to ask the SO community about this problem in my project. I
I seem to have faced this problem many times and I wanted to ask
I wanted to ask a quick question just to make sure I am not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.