When you select the number of rows, how can I choose a percentage of a percentage?

Pretty simple question:

Let's say I want to use 30% of the rows in the table of my MySQL table.

However, I also have user input, where they can select a percentage of this percentage

For instance: $_GET['percentage']% of 30%

so we say that $_GET['percentage'] = 30

How would I choose 30% (or $_GET['percentage'])30% to use in a while loop?

+3
source share
3 answers

30% of any value is a value times 0.3.

Thus, 30% of 30% 0.3 * 0.3 = 0.09, or 9%.

Replace everything you need.

+5
source

Multiplication?

.3 * $_GET['percentage'] / 100.0
+1
source

mysql_num_rows PDOStatement::rowCount , , , mysql_fetch_row PDOStatement::fetch.

0

Source: https://habr.com/ru/post/1744450/


All Articles