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 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

So I am obviously not a very good programmer. I have written this small
First, let me say I'm not a professional programmer, but an engineer who had
I am not professional programmer so i can not be sure about this.How many
(DISCLAIMER: I'm not a programmer, I spend my time on serverfault, I'm just a
1st disclaimers: I'm not a programmer, never was had never been taught higher math
what is a good book to learn fractal programming? I am a programmer, I
Are there any good books for a relatively new but not totally new *nix
I'm an old (but not too old) Java programmer, that decided to learn C++.
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.