[program-l] Re: php logic

  • From: Parham Doustdar <parham90@xxxxxxxxx>
  • To: program-l@xxxxxxxxxxxxx
  • Date: Sun, 15 Jun 2014 17:54:43 +0430

Hi,

I'm not sure what OP wants to do after removing the first two lowest values. If persisting it to the database, it's best to use an ORM as they are made to make this kind of thing easy.

What I would suggest, if the OP is still reading this thread, is that instead of having all the values in one single field (which is what people go with because it's easier to start with), create another table to store these values. This means that you can easily remove the lowest values by a single query (I.E. write a select to find the lowest values, and delete those from the other table).

HTH.
On 6/15/2014 4:10 PM, Jacob Kruger wrote:
Well, then you might do best to pull them out of the database, load them into a PHP array, where you can sort them, and then use the lowest two values from there to generate an SQL statement to clear the values from the record..?

Stay well

Jacob Kruger
Blind Biker
Skype: BlindZA
"Roger Wilco wants to welcome you...to the space janitor's closet..."

----- Original Message ----- From: "Bryan Schulz" <b.schulz@xxxxxxxxxxxxx>
To: <program-l@xxxxxxxxxxxxx>
Sent: Saturday, 14 June, 2014 10:28 PM
Subject: [program-l] Re: php logic


hi,

close, they are a series of scores all in the same record for a player
Bryan Schulz


----- Original Message ----- From: "Jacob Kruger" <jacob@xxxxxxxxxxxxx>
To: <program-l@xxxxxxxxxxxxx>
Sent: Saturday, June 14, 2014 6:13 AM
Subject: [program-l] Re: php logic


If those are numbers in a specific field - field1 - in a mysql table, then something like the following SQL statement might select/delete the relevant two rows:

delete from tbl_one where id in (select id from tbl_one order by i_field1 desc limit 2);

And, haven't tested that, but, think it's roundabout right - might be minor syntax issues.

Stay well

Jacob Kruger
Blind Biker
Skype: BlindZA
"Roger Wilco wants to welcome you...to the space janitor's closet..."

----- Original Message ----- From: "Bryan Schulz" <b.schulz@xxxxxxxxxxxxx>
To: <program-l@xxxxxxxxxxxxx>
Sent: Saturday, 14 June, 2014 7:56 AM
Subject: [program-l] php logic


hi,

could someone provide pseudo thoughts of how to throw away two values from a mysql table using php?

a sample would be these numbers:
542, 567, 452, 624, 584, 472, 645.

how would you throw away the low values of 452 and 472?

thanks,
Bryan Schulz

** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq


** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq

** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq


** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq


** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq

Other related posts: