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

  • Home
  • SEARCH
  • 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 7884535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:49:33+00:00 2026-06-03T04:49:33+00:00

the code i have below basically behaves as a friend search engine where you

  • 0

the code i have below basically behaves as a friend search engine where you can add someone if you don’t have them on you account. So i am trying to do the following: If exists it should just display the friend and if not then it should say add friend.

I got it to work but the tail end of the query (please see this comment “//Problem code – when i use this echo below this where it repeats 3 times”) is giving me trouble where it repeats Add 3 times.

<?php
$num_rows1 = mysql_num_rows($result);
if ($result == "") {
    echo "";
}
echo "";

$rows = mysql_num_rows($result);
if ($rows == 0) {
    print("<div id=norequests>No results for <strong>$q
                 </strong></div>");

}
elseif ($rows > 0) {
    while ($row = mysql_fetch_array($query))
    {

        $person  = htmlspecialchars($row['full_name']);
        $linksys = htmlspecialchars($row['name']);
        $pid     = htmlspecialchars($row['system_id']);
    }

    print("");
}

}


else{
    echo '<div id="error">No results.</div>';
}

$sql    = "SELECT `Friend_id` from `friends_container` 
                 WHERE `System_id` = '$sid'";
$result = mysql_query($sql);
$query = mysql_query($sql) or die("Error: " . mysql_error());

if ($result == "") {
    echo "";
}
echo "";

$rows = mysql_num_rows($result);
if ($rows == 0) {
    print("");

}
elseif ($rows > 0)
{
    while ($row = mysql_fetch_array($query))
    {
        $existing = htmlspecialchars($row['Friend_id']);
        if ($existing == $pid) {
            echo("<img src=$linksys />$person - Already Existing");
        }

        else
            //Problem code - when i use this echo below this where it repeats 3 times
        {
            echo("Add $person");
        }
    }
?>
  • 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-06-03T04:49:35+00:00Added an answer on June 3, 2026 at 4:49 am

    You must have 3 images stored for each account.

    Your query will always result in a multiple result. what you should do is use php to convert it to something which will result in a better option or say convert the result in an array for convenience.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So basically, the below is the code I have right now: class MY_Log extends
I have the code snippet below in C++ which basically calculates the pi using
Below I have some code which basically animates a div from the bottom of
I have some code below showing my JQUERY & HTML. Basically I have tried
Hi I have this code below which basically after 25 seconds of showing the
The code I have below works fine but I'm sure it could be more
I have below code in html. <li class=selected runat=server id=lihome><a href=/ISS/home.aspx title=Home><span>Home</span></a></li> Now I
I have below code behind in c# if (Session[cmpDictionaryTitle]!= null) { downloadLinks.Text += @<li><a
I have below code to insert a style into DOM (there is a use
I have below code.The logic here is if HostList conatains any blanck entry it

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.