This topic is locked

need help in codes

10/17/2009 10:56:33 AM
PHPRunner General questions
M
madcat820 author

i was wondering if anyone can help me converting some codes from vb to phprunner.. i have the following code...

or atleast any help....
VB.net code (or atleast the LOGIC ive got)
myRS.Open("Select from electrical_supplies where item_number Like '" & txtsearch.Text & "%'", myDB, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic)

While Not myRS.EOF
List1.Items.Add(myRS.Fields("product_description").Value)

If myRS.Fields("stocks").Value < myRS.Fields("minimum").Value Then

myRS.Fields("print_me").Value = "yes"

myRS.Update()

myRS.MoveNext()

Else

myRS.Fields("print_me").Value = "no"

myRS.Update()

myRS.MoveNext()

End If

End While

myRS.Close()

List1.Items.Clear()
'=================
the logic was, select
from an inventory table, and on the first record it will do the math

if item_stock < minimum then update its field printme to "YES"

then go to next record until END OF TABLE
i was about to join the above to this existing phprunner code
phprunner exisiting code
// Parameters:

// $values - Array object.

// Each field on the Add form is represented as a 'Field name'-'Field value' pair
//** Custom code ****

// put your custom code here
global $conn;
$sql = "SELECT * FROM inventory WHERE inv_id='".$values['withdraw_inv_name']."'";

$rs = db_query($sql,$conn);

$data=db_fetch_array($rs);

$new_value = $data['inv_stocks'] - $values['withdraw_how_many'];
$sql = "UPDATE inventory SET inv_stocks =".$new_value." WHERE inv_id='".$values['withdraw_inv_name']."'";

db_exec($sql,$conn);
return true;
// return true if you like to proceed with adding new record

// return false otherwise
'==============
any help appreciated... sorry for my bad english...... thanks so much

J
Jane 10/19/2009

Hi,
here is a sample for PHPRunner 5.1:

$values["inv_stocks"] = $oldvalues['inv_stocks'] - $values['withdraw_how_many'];
M
madcat820 author 10/20/2009



Hi,
here is a sample for PHPRunner 5.1:

$values["inv_stocks"] = $oldvalues['inv_stocks'] - $values['withdraw_how_many'];



thanks a lot, hey do you know how do i do the "movenext" code of vb to phprunner?

J
Jane 10/21/2009

Unfortunately we don't support the code written by our customers.