This topic is locked

Using DAL to update a field

3/30/2009 6:24:49 PM
PHPRunner General questions
K
Kevin Hill author

Hi,
I am very new to both PHP and PHPRunner.
I have a 2 table project with 1-many relationship.
It is used to track spare parts and as the qty is added or reduced I need it to recalculate the qty value in the main table for each product.
I would like to use SQL queries as I I have a lot of these situations to create and I ubderstand sql better than PHP.
I have read the DAL section but I can't seem to figure how the SQL code can be added.
Any suggestions would be welcomed.
Thanks
Kevin

Sergey Kornilov admin 3/30/2009

Kevin,
you don't need DAL to write and execute SQL.
Assuming that you need to run this code in one of events:

$global conn;

$sql = "Your SQL query here";

db_exec($sql,$conn);