Is it possible to convert this code to I can use in my query?
Code:
$totaal = 0;
while ($row = mysql_fetch_array($res))
{
$gewicht = ($row["p_lengte"] * $row["p_breedte"] * $row["d_dikte"] * $row["k_soortelijk_gewicht"] / 1000000 * $row["p_aantal"]) + (M_PI_2 * $row["p_schijf"] * 0.5 * $row["p_schijf"] * $row["d_dikte"] * $row["k_soortelijk_gewicht"] / 1000000 * $row["p_aantal"]);
$totaal = $totaal+$gewicht;
I hav tried but that didn't work.
Code:
$sql = "SELECT
p.id AS p_id,
p.van_id AS p_van_id,
p.lengte AS p_lengte,
p.breedte AS p_breedte,
p.schijf AS p_schijf,
p.aantal AS p_aantal,
p.charge AS p_charge,
p.status AS p_status,
p.prijs_gekocht AS p_prijs_gekocht,
p.opmerkingen AS p_opmerkingen,
p.order AS p_order,
k.id AS k_id,
k.kwaliteit AS k_kwaliteit,
k.soortelijk_gewicht AS k_soortelijk_gewicht,
d.dikte AS d_dikte,
a.klantnaam AS a_klantnaam,
gewicht AS (p_lengte * p_breedte * d_dikte * k_soortelijk_gewicht / 1000000 * p_aantal) + (M_PI_2 * p_schijf * 0.5 * p_schijf * d_dikte * k_soortelijk_gewicht / 1000000 * p_aantal)
FROM plaatregistratie AS p
LEFT OUTER JOIN kwaliteit AS k
ON k.id = p.kwaliteit_id
LEFT OUTER JOIN dikte AS d
ON d.id = p.dikte_id
LEFT OUTER JOIN adressen AS a
ON a.id = p.leverancier_id
ORDER BY p.id DESC
LIMIT $currentRecord, $recordsPerPage";