runnerjp Posted May 11, 2008 Share Posted May 11, 2008 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 Link to comment https://forums.phpfreaks.com/topic/105150-solved-letting-users-know-when-something-new-has-happend/ Share on other sites More sharing options...
LooieENG Posted May 11, 2008 Share Posted May 11, 2008 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 Link to comment https://forums.phpfreaks.com/topic/105150-solved-letting-users-know-when-something-new-has-happend/#findComment-538348 Share on other sites More sharing options...
runnerjp Posted May 11, 2008 Author Share Posted May 11, 2008 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.' ?> Link to comment https://forums.phpfreaks.com/topic/105150-solved-letting-users-know-when-something-new-has-happend/#findComment-538349 Share on other sites More sharing options...
runnerjp Posted May 11, 2008 Author Share Posted May 11, 2008 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 Link to comment https://forums.phpfreaks.com/topic/105150-solved-letting-users-know-when-something-new-has-happend/#findComment-538350 Share on other sites More sharing options...
AndyB Posted May 11, 2008 Share Posted May 11, 2008 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"); Link to comment https://forums.phpfreaks.com/topic/105150-solved-letting-users-know-when-something-new-has-happend/#findComment-538351 Share on other sites More sharing options...
runnerjp Posted May 11, 2008 Author Share Posted May 11, 2008 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.' ?> Link to comment https://forums.phpfreaks.com/topic/105150-solved-letting-users-know-when-something-new-has-happend/#findComment-538355 Share on other sites More sharing options...
AndyB Posted May 11, 2008 Share Posted May 11, 2008 echo 'You have ' . mysql_num_rows($get) . ' friend requests.' Surely $get should be $results since $results is the resource from your query. Take a deep breath, check code twice. Link to comment https://forums.phpfreaks.com/topic/105150-solved-letting-users-know-when-something-new-has-happend/#findComment-538357 Share on other sites More sharing options...
runnerjp Posted May 11, 2008 Author Share Posted May 11, 2008 oops... ty Link to comment https://forums.phpfreaks.com/topic/105150-solved-letting-users-know-when-something-new-has-happend/#findComment-538363 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.