Search code examples
phpmysqlsystemfriend

Echo to print one value at a time


I have created a system where a user signs up to my site, their details are entered into my users table (SQL). The user can then search for other users, via their username. They can then send a user a friend request, entered into my friendrequest table (SQL). The friend requests are then printed onto a page using echo. If there are multiple friend requests then it shows friendrequest1 friendrequest2 friendrequest3 etc. Is it possible to get only friendrequest1 printed, the user then accepts, this users name gets place into my friends table (SQL) then friendrequest2 is shown etc, just so each request is individual. So echo could do a count of how many requests there are and show one at a time? Thanks in advance!


Solution

  • When you SELECT from the friendrequest table, you could do a LIMIT 1 at the end, and you'll only get back one result.