jenodorf
Technical User
- Jan 11, 2005
- 36
Hi really sorry to be so dense , but I'm trying to get my head around PHP and mysql.
I have a mysql database and need to calculate a total stock value and display it in a web page.
Searched the web, asked here and been through a couple of books but I'm struggling.
The code I'm trying to use is as follows:-
<?php
Select sum (SKU_price * SKU_stock) as totalStockValue from tbl_skus;
echo totalStockVale;
?>
I've inserted this into a PHP admin page which is already logged onto the database.
I thought that LIne one created a value for the total stock called totalStockValue and line two echoed the result to the screen.
Is my logoc totally wrong?
thanks
Ian
I have a mysql database and need to calculate a total stock value and display it in a web page.
Searched the web, asked here and been through a couple of books but I'm struggling.
The code I'm trying to use is as follows:-
<?php
Select sum (SKU_price * SKU_stock) as totalStockValue from tbl_skus;
echo totalStockVale;
?>
I've inserted this into a PHP admin page which is already logged onto the database.
I thought that LIne one created a value for the total stock called totalStockValue and line two echoed the result to the screen.
Is my logoc totally wrong?
thanks
Ian