Jump to content

Show data from data base


magcr23

Recommended Posts

Hi guys, i have a private message system, but it was impossible to know when i had a reply, so i'm trying to do something like a notification systen, when a reply is sent i want to show in a page something like "reply from $FROM in $SUBJECT".

 

so i did that:

<?php
$utilizador = $_SESSION["user"];
$resp = mysqli_query($con, "SELECT * FROM `messsages` WHERE `from` = '$utilizador' AND `read` = '0' ");
$ln = mysqli_fetch_assoc($resp);
							
						
//NOTIFICATION
echo 'replyfrom: <b>' . $ln['from'] . ' </b>in <b>' . $ln['subject'] . '</b>';
							
?>

But if i do that it will show only the first one, how can i make it show them all?

 

in my database i have:

ID

from

to

subject

message

date

raiz (0=original message, 1=reply)

read (0= user don't read, 1= user already read)

Link to comment
https://forums.phpfreaks.com/topic/296997-show-data-from-data-base/
Share on other sites

Hi guys, i will need your help again,

 

i created a form to the original message where:

 

From:$user

To:$a

 

and my reply form is:

 

From:$user

To:$user_of_original_message

 

When start the conversation it results in:

 

message original:

  From: miguel

  To: admin

  Message: Hello

 

reply1:

From: admin

To: miguel

Message: Hi, how are you

 

reply2:

From: miguel

To: miguel

Message: IT'S NOT WORKING

 

Since i'm using the $user_of_original_message it result that when i do the second reply i will sent a message to myself.

 

How solve that? 

If no reply's-->to = $user_of_original_message

if 1 or more reply exist-->to ? $user_of_reply_before

 

how can i do that?

 

there's the code if you want to see: http://justpaste.it/lyb2

(justpaste.it   is an website to share text)

Store message ids and which id you are replying to, if any

message original:
	MessageID = 1
	From: miguel
	To: admin
	Message: Hello
	ReplyToID = null
 

reply1:
	MessageID = 2
	From: admin
	To: miguel
	Message: Hi, how are you
	ReplyToID = 1
 

reply2:
	MessageID = 3
	From: miguel
	To: miguel
	Message: IT'S NOT WORKING
	ReplyToID = 1

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.