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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:40:07+00:00 2026-05-28T02:40:07+00:00

I have mysql_query problem in php. Of course I have visitors in my website

  • 0

I have mysql_query problem in php. Of course I have visitors in my website and they read football news there. The problem is that I try to sort news by views DESCending, but it doesn’t work for new uploaded news. Somehow it appears at the end of the page. I’ve figured out one more thing that when views of the news is 9 it appears at the beginning of the page, but if it is more than 9 it appears at the end of the page. I’d appreciate any kind of help. Here is mysql_query.

mysql_query("SELECT * FROM news ORDER BY views DESC");

Oh and by the way, my website is http://www.bbcsport-football.com/football

there you can find Sorting options, New and Most Viewed. Click most viewed and you’ll see it.

  • 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-28T02:40:08+00:00Added an answer on May 28, 2026 at 2:40 am

    You need to convert the views column to a number

    mysql_query("SELECT * FROM news ORDER BY cast(views as INTEGER) DESC")
    

    Or even better change the table definition so views is a INTEGER

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

Sidebar

Related Questions

I have some problem whith such mysql_query INSERT INTO table VALUES ('', CURDATE()-1) why
I have a problem with my php/mysql script. It should only output the while
I have a strange problem with php scripts - mysql_affected_rows() sometimes returns 0 for
I have problem with php's preg_match.I want to make something like this : When
I have problem in my PHP code. I'm trying to make internet shop and
I have faced a problem whenever exporting a CSV file with PHP. I have
I have been struggling with a small problem for a while. It's been there
Possible Duplicate: php warning mysql_fetch_assoc I have a weird problem about my script. It
i have a problem with php in the following: $sql = 'SELECT name FROM
i'm new in php and mysql i have a problem i have 2 tables

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.