Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
please help with update code
Old 07-28-2008, 02:52 PM please help with update code
Junior Talker

Posts: 1
Trades: 0
I have the following function in place to allow people to change the status of their payment gateway from "inactive" to "active". Currently this function allows users to have as many gateways of any type to be active or inactive at any given point. I decided that I only want them to allow one gateway of the type "Direct" to be "active" at one time. Thus in order to make a different "direct" gateway to be "active they would have to inactivate the current gateway. The gateway type is being stored in a table called "gateway". If anyone could give me some pointers on how to make this happen i would highly appreciate it.

function store_gateway_status ($STORE, $GATEWAY){
GLOBAL $DB;
$ERROR = "";
$SQuery = "SELECT SG1.Status AS StoreGatewayStatus "
. " FROM ".$DB['Table']['StoreGateway']." AS SG1 "
. " WHERE SG1.StoreID='".$STORE['ID']."' "
. " AND SG1.GatewayID='".$GATEWAY['ID']."' ";
$SResult = mysql_query($SQuery, $DB['Link']);
$SRow = mysql_fetch_object($SResult);
$StoreGatewayStatus = $SRow->StoreGatewayStatus;
if ($StoreGatewayStatus == 'Inactive'){
$StoreGatewayStatus = 'Active';
}
else {
$StoreGatewayStatus = 'Inactive';
}
$UQuery = "UPDATE ".$DB['Table']['StoreGateway']." AS SG1 "
. " SET SG1.Status='".$StoreGatewayStatus."' "
. " WHERE SG1.StoreID='".$STORE['ID']."' "
. " AND SG1.GatewayID='".$GATEWAY['ID']."' ";
$UResult = mysql_query($UQuery, $DB['Link']);
if (strlen(mysql_error($DB['Link'])) > 0){
$ERROR = $ERROR."<BR>".mysql_error($DB['Link']);
}
return ($ERROR);
cgfunk126 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Reply     « Reply to please help with update code
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.51035 seconds with 12 queries