Delete records not in top 15


Posted on 16th Feb 2014 07:03 pm by admin

Hi,

I'm creating a hall of fame page in my game and the page will only display the top 15 scores.
So I want to delete the scores that get bumped down the list.
Did you know?Explore Trending and Topic pages for more stories like this.

How would I write the query to delete everything NOT in the top 15?

I've been trying different things, but nothing is working.
I thought maybe something like this, but it didn't work.
Line number On/Off | Expand/Contract $removeold = $db->execute("DELETE FROM `soundoff_hof` WHERE `id` NOT IN (SELECT `id` LIMIT 15 FROM `soundoff_hof`)");

am I close with something like this, or is there another method to do it?
No comments posted yet

Your Answer:

Login to answer
303 Like 25 Dislike
Previous forums Next forums
Other forums

Socket problem
Hello,

Earlier I posted about my problem with my socket script. It took up to 100% CPU usage.

Automatically Detect Phone Model for WAP Jar Deployment
Making a wap site is fairly simple, but I'd like to know if there's a way to make it so that the wap

How to grab certain words ??
I am working with this API

Returns JSON.
curl http://letsbetrends.com/api/current_trends

Parse Error with doctype
I'm getting a parse error with this simple code. I don't get it. It worked one time then when I relo

Download Image from URL and Upload it
Ok, I have been googling for the last 1/2 hour trying to figure this out, Most likely I'm just not s

SHOW TABLES Help
Hi all

I have the following

Code: [Select]<?php
$sql = "SHOW TABLES&quo

Time-based image rotation script
I'm trying to write a PHP script that rotates an image based on what time of day it is. I want the

smart reading from a text file
Hello there fellow coders, i was wondering if one of you wouldnt mind helping me with this problem i

CHECH A STRING FOR ' " ' (DOUBLE QUOTES)
I am checking for delimiter (.!?) and if there is a " after a sentence then it should neglect a

Add User script "Could not execute query"
This should be an easy script but I can't get it to run. Can someone please help me?

<

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash