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

  • Home
  • SEARCH
  • 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 860781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:52:13+00:00 2026-05-15T08:52:13+00:00

i have a messaging system and it works fine but i have it so

  • 0

i have a messaging system and it works fine but i have it so when its read it mysql_querys and sets read to 1. so that way in futer you can tell if its opend. it does not update here is the script for viewing the message where its suppose to update. THANKS

<?php
session_start();

require "../scripts/connect_to_mysql.php";

    if (isset($_SESSION['id'])){
    $touser = $_SESSION['id'];
        }
        elseif (!isset($_SESSION['id'])){
            header('location: http://www.stat-me.com');
        }

$id = $_GET['id'];
$memberfirstname = $_SESSION['firstname'];


if(!isset($id)) {
    header('location: inbox.php');
}
elseif(isset($id)) {

    mysql_query("UPDATE pms SET read='1' WHERE id='$id'");    


    $grab_pm = mysql_query("SELECT * FROM pms WHERE touser = '$touser' AND id = '$id'");

    while($r= mysql_fetch_object($grab_pm)) {    
        $subject = $r->subject;    
        $message = $r->message;    
        $fromuser = $r->fromuser;    
        $datesent = $r->datesent;    
        $read = $r->read;
    }


}


?>
  • 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-15T08:52:13+00:00Added an answer on May 15, 2026 at 8:52 am

    It’s not entirely clear if the id field is an INT but I’m guessing so, in which case fix the code as follows (remove the single quotes around $id):

    mysql_query("UPDATE pms SET read='1' WHERE id=$id");
    $grab_pm = mysql_query("SELECT * FROM pms WHERE touser = $touser AND id = $id");
    

    Also be sure to escape your GET variables, e.g.

    $id = mysql_real_escape_string($_GET['id']) ;
    

    EDIT: also take single quotes around $touser above

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a messaging system (very basic) that has a table like this: **MESSAGE_ID**
I have make a messaging system in which user can send messages to each
I have a C# app that subscribes to a topic on our messaging system
I am trying to use new Google Cloud Messaging system but I have some
I have written a mvc that uses nservicebus to publish messages. This works fine
Suppose you have a messaging system built in PHP with a MySQL database backend,
I have a basic messaging system set up and I m using the same
I have a micropost/messaging system and each time a new micropost or comment/message is
On a messaging system, line breaks have been added automatically when messages are posted
I am creating a simple messaging system in WCF and have implemented a minimal

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.