Optimize code for sending collected data to a database
Functional approach

For simplicity you can create few helper functions to get rid of code duplication:


getValuesFromPost(array $list): gets list of parameters names and
returns according POST values.
composeFieldListSql(array $list): gets list of fields and returns SQL expression of fields list like 'ComputerName', 'usage_0', 'usage_10'
composeValuesListSql(array $list): gets list of values and returns SQL expression of escaped values list like 'PC', 'value1', 'value2'
composeInsertSql(array $fields, array $values): composes full insert SQL expression from fields and values lists.


Functions composeFieldListSql() and composeValuesListSql() could be declared inside function composeInsertSql() since you don't need to use them elsewhere.

Your code will look like this:

$fields = ['ComputerName', 'usage_0', 'usage_10', 'usage_20', 'usage_30', 'usage_40', 'usage_50', 'usage_60', 'usage_70', 'usage_80', 'usage_90', 'users', 'OrderDate'];
$sql = composeInsertSql($fields, getValuesFromPost($fields));
mysqli_query($cxn, $sql);


Object oriented approach

Basically you could write wrapper class for mysqli extension functions to encapsulate low level interactions with extension and to make interaction with database more abstract. Also, it will be easy to change inner working of wrapper, if for example you will decide to change database type.

Or you can use one of many existent wrappers, which are already covered by tests and have rich functionality.