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 8696719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:20:25+00:00 2026-06-13T01:20:25+00:00

The situation I have is a page with contact names which echos the 5

  • 0

The situation I have is a page with contact names which echos the 5 most frequently visited contacts of the current user. and I order them like this:

$name_a=mysql_query(SELECT * FROM contacts WHERE email='$semail' ORDER BY frequency 
DESC);
$name_b=mysql_query(SELECT * FROM contacts WHERE email='$semail' ORDER BY frequency           
DESC OFFSET1);

and when the member clicks a submit button associated with this name it adds 1 to the ‘frequency’ column of that user. like this:

UPDATE contacts SET frequency = frequency + 1 WHERE email='$semail' AND      
contact_a='$a[contact_a]'

The problem comes when two members have the same frequency value, because when one of these names is clicked it adds 1 and changes the order so then the other information appears after the page refreshes. for example if both ‘tom’ and ‘bob’ have a frequency value of 10
tom is echoed first(because his name appears first in the database) then bob, like this:

if ($name_a = mysql_fetch_assoc($name_a)) {echo $name_a['firstname'];} // eg. tom
if ($name_b = mysql_fetch_assoc($name_b)) {echo $name_b['firstname'];} // eg. bob

then if someone clicks the button for bob, his frequency value becomes 11 and when the page has refreshed he becomes $name_a and additional information which comes from clicking the submit button will be for tom. hope I have explained this OK. Thanks

  • 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-13T01:20:26+00:00Added an answer on June 13, 2026 at 1:20 am

    ...ORDER BY frequency, name, so that within any given frequency, names will be alphabetical, instead of whatever their natural sort order is?

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

Sidebar

Related Questions

I've the current situation: Have a Link in some HTML page. When the user
Situation: I have an index page which loads pages into it with ajax as
I have a situation with my php code. In a previous page the user
Okay, here is my situation. I have a page, index.php, which is the mainsite
Here's the situation: I have a host page that loads a custom web user
Situation: I have a page with an iframe, which contains a form. But the
I have a situation here: I have a page which is using to show
The situation: I have a mvc.net web page which, when called, runs a batch
Situation: I have a master page which has 3 content place holder but no
Here is my current situation: I have a web page containing a couple scrollable

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.