Category : performance

In a php/mysql project design, is it better to write one function like this function getFromTableOneInt($l, $t, $f, $v) { $stmt = mysqli_prepare($l, "select * from $t where $f = ?"); mysqli_stmt_bind_param($stmt, "i", $v); mysqli_stmt_execute($stmt); $res = mysqli_stmt_get_result($stmt); $out = array(); while ($r=mysqli_fetch_assoc($res)){ $out[] = $r; } return $out; } where table name, field name, ..

Read more

Like the title asks, is there a better way to format the following PHP code. $uploadM = ($M_UsageResponse->data[$i]->data[0]->upload); $downloadM = ($M_UsageResponse->data[$i]->data[0]->download); $usageM = $uploadM + $downloadM; $usageM_gb = $usageM / 1000; $usage_final_M = number_format((float)$usageM_gb, 2, ‘.’, ”); $uploadD = ($D_UsageResponse->data[$i]->data[0]->upload); $downloadD = ($D_UsageResponse->data[$i]->data[0]->download); $usageD = $uploadD + $downloadD; $usageD_gb = $usageD / 1000; $usage_final_D = ..

Read more