EchoFool Posted September 21, 2011 Share Posted September 21, 2011 Hey, Im busy making a social network style wall feed for my site where people make a status and people can comment. Now when some one comments the users active in the comment wall + original status maker gets notified but now the issue is theres so many while loops going on im thinking there must be a better way? My current method is as follows: 1) Get the userid of the person who made the status 2) Collect all unique userid's of all the people who made a comment 3) Create the array of userids 4) Loop the array and insert row after row of each userid to notify them a comment was made on a feed they are active on. Thing is - im thinking when i scale it up with alot of users this looping is going to increase the load alot so is there really any more efficient method i can use ? Link to comment https://forums.phpfreaks.com/topic/247556-collecting-userids-and-inserting-row-for-them/ Share on other sites More sharing options...
WebStyles Posted September 21, 2011 Share Posted September 21, 2011 I would do it like this: 1. each status phrase has an id (statusID). Statuses are stored in table1 2. each comment has a time/date and the statusID they refer to, stored in table2 when you show a status, you also retrieve the statusID, then you go into table2 and retrieve all comments that have the same statusID, order them by datedesc,time desc. Link to comment https://forums.phpfreaks.com/topic/247556-collecting-userids-and-inserting-row-for-them/#findComment-1271303 Share on other sites More sharing options...
EchoFool Posted September 21, 2011 Author Share Posted September 21, 2011 Think you have misread my post here i already have the status + comments loaded fine im referring to notifying users. Link to comment https://forums.phpfreaks.com/topic/247556-collecting-userids-and-inserting-row-for-them/#findComment-1271476 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.