Quantcast
Channel: ASPRunner forums
Viewing all articles
Browse latest Browse all 2586

[SOLVED] SQL Code efficiency question

$
0
0
I'm just an amateur guy who is winging using PHPRunner to make a site for our condo association. I've found a few different ways to do what I need to do, and I was wondering about the efficiency of a few different ways to update a joined/different table:

Method 1:
DB::Query("update accounts_data set linked='1' where id = " . $values["current_owner"] . "" );
DB::Query("update accounts_data set unit=".$values["unit"]." where id = ".$values["current_owner"]."" );
DB::Query("update accounts_data set building=".$values["building"]." where id = ".$values["current_owner"]."" );
DB::Query("update accounts_data set address=".$values['unit']." where id = ".$values["current_owner"]."" );
DB::Query("update accounts_data set moveoutdate='' where id = ".$values["current_owner"]."" );


Method 2:
DB::Query("update accounts_data set linked='1', unit=".$values["unit"].", building=".$values["building"].", address=".$values['unit'].", moveoutdate='' where id = " . $values["current_owner"] . "" );


Method 3:
global $dal;
$tblDetail = $dal->Table("accounts_data");
$tblDetail->Param["id"] = $values["current_owner"];
$tblDetail->Value["ownername"] = $values["ownername"];
$tblDetail->Value["email"] = $values["email"];
$tblDetail->Update();
unset($values["ownername"], $values["email"]);


I used method 1 for initial testing but use method 2 for the final product. I'm guessing method 2 is less resource intensive, but it's also not as clean to look at when dealing with testing in a way.

For method 3, I use that to update a joined table, but I was wondering if something like that was more efficiency in terms of resource usage than method 2?

Thanks
-David

Viewing all articles
Browse latest Browse all 2586

Trending Articles