Jump to content

[SOLVED] letting users know when something new has happend


runnerjp

Recommended Posts

hey guys... i was looking for some ADVICE lol

 

see i have put a few scripts together but i was wondering

 

what is the best way to make it so that when a users asks a user to be there friend to let the user know that "they have 1 friend request waiting" or "they have 17 friend requests waiting"

 

first how would i just let them know and 2nd how could i let them know how many

First, use email to tell them, and then maybe set up a table called invites which has "sender" and "reciever", and for the mail, maybe

 

$result = mysql_query("SELECT * FROM invites WHERE reciever = '$user'");

 

and mail could be

 

$mail = 'You have ' . mysql_num_rows($result) . ' friend requests.';

 

And then when they accept/decline, delete the row from the table

ahh wiked.. i allready have table set up

 

CREATE TABLE `friend_requests` (

  `id` int(10) NOT NULL auto_increment,

  `username` varchar(225) NOT NULL default '',

  `by_user` varchar(225) NOT NULL default '',

  PRIMARY KEY  (`id`)

) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;

 

 

so if i do

 

 

<?php session_start(); // starts sessions
include "../settings.php"; // inlcudes config
$id = $_SESSION['user_id'];
$get_username_value = get_username($id);
$results = "SELECT * FROM friend_requests WHERE `by_user` = '$get_username_value' LIMIT 1"; 
echo 'You have ' . mysql_num_rows($result) . ' friend requests.'
?>

 

with the 1 i posted i get

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/runningp/public_html/members/include/requests.php on line 6

 

Try executing the query :)

 

$results = mysql_query("SELECT * FROM friend_requests WHERE `by_user` = '$get_username_value' LIMIT 1");

oops... lol

 

im still getting the error tho just from

 

<?php session_start(); // starts sessions
include "../../settings.php"; // inlcudes config
$id = $_SESSION['user_id'];
$get_username_value = get_username($id);
$results = mysql_query("SELECT * FROM friend_requests WHERE `by_user` = '$get_username_value' LIMIT 1");
echo 'You have ' . mysql_num_rows($get) . ' friend requests.'
?>

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.