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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:18:14+00:00 2026-05-24T18:18:14+00:00

I am not a programmer or good at programming, just laying this out. I

  • 0

I am not a programmer or good at programming, just laying this out. I had a site coded for me, but the coder is not interested in further development. I need to rank images in the database by losses (kinda like votes) to views of an image. Originally, here is what was written for the code:

// get images 
$result = $this->db->query("SELECT * FROM `ylyl_images` ORDER BY `loses` DESC LIMIT    $start, 12");

That basically orders the images on the site by loses, and to paginate, it has the $start variable which is incremented by 12 for every “next page” click.

$result = $this->db->query("SELECT (`loses`/`views`) AS `ratio` FROM `ylyl_images` WHERE `views` > 150 ORDER BY  `ratio` DESC LIMIT $start, 12");

That is what I came up with to order images based on ratio of loses to views, but the query doesn’t return anything. I tried replacing the $start variable with just 0, but it still doesn’t work.

  • 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-24T18:18:16+00:00Added an answer on May 24, 2026 at 6:18 pm

    Are you returning the right fields? In the code above, you Changed:

    SELECT * FROM...
    

    To…

    SELECT loses/views AS ratio FROM...
    

    Perhaps you need to return more fields. While I do not recommend ‘SELECT *’, you could do the following:

    SELECT *, loses/views AS ratio FROM...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm wondering what you do as a programmer that's not programming but necessary for
Disclaimer This is not strictly a programming question, but most programmers soon or later
This might not be exactly a programming question but it is related to programmers
I am a pretty good programmer but I am not great when it comes
I am a hacker not and not a full-time programmer but am looking to
I'm an old (but not too old) Java programmer, that decided to learn C++.
Not really a programming question, but relevant to many programmers... Let's say I have
First of all, sorry, but my English is not very good. I'm at the
I am a programmer with a relatively good background programming in ActionScript using Flash
I am not a professional programmer (my area is medical research), but I am

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.