Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6579923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:57:33+00:00 2026-05-25T15:57:33+00:00

I am making a simple friends feature for my site and when people get

  • 0

I am making a simple friends feature for my site and when people get a friend request I want it to show on there friends panel link so I tried this.

 $q = $dbc -> prepare("SELECT id_to read FROM friend_requests WHERE id = ? && read == '0'");
 $q -> execute(array($details['id']));
 $request_count = $q -> rowCount();
 if ($request_count > 0) {
echo '<li><a href="/friends"><img src="/gameimages/friends.png" height="16" width="16" alt="" /><strong>Friends (' . $request_count . ')</strong></a></li>';
 }
 else {
echo $request_count;
echo '<li><a href="/friends"><img src="/gameimages/friends.png" height="16" width="16" alt="" />Friends </a></li>';
 }

Now on the friends page where requests are shown all requests get the column of read set to 1, and by default it is 0. If there are rows with 0 it shall be a new request and the query above should fire letting users know that they have new requests, what am I doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:57:34+00:00Added an answer on May 25, 2026 at 3:57 pm

    Read is a reserved word in MySQL and need to be escaped with backticks:

    SELECT id_to, `read` FROM friend_requests WHERE id = ? AND `read` = '0';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im making a simple app for some friends to use on there android phone
I'm making a simple URL request with code like this: URL url = new
I'm making a simple chat program for me and my friends as a tech
I'm making simple http post request using libcurl to index.php file on my web
I'm making a game with my friend. Now there is a question about levels.
I'm making a social networking site and I have two types of statuses. Friends
I am making simple WinForm application and I want to ask what is best
I'm making the following simple request to Facebook. My goal is to grab the
guys, I'm making simple graph drawer and want to find beautiful values for horizontal
I am making simple grid like game ( grid is matrix 128x128) and matrix

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.