This topic is locked

How can I insert a where statement into my insert statement

12/1/2008 1:26:20 PM
PHPRunner General questions
C
chaintm author

This is what I want to add...
[codebox]where Order_num=".$keys["Order_num"][/codebox]
To the following code....
[codebox]global $conn;

$str = "insert into order_sales (Shipto_name,Shipto_Lname,Shipto_address,Shipto_address2,Shipto_city,Shipto_stat

e,Shipto_zip)

values ('".db_addslashes($values["Billto_name"])."','".db_addslashes($values["Billto_Lname"])."','".db_addslashes($values["Billto_address"])."'

,'".db_addslashes($values["Billto_address2"])."','".db_addslashes($values["Billto_city"])."','".db_addslashes($values["Billto_state"])."'

,'".db_addslashes($values["Billto_zip"])."')";

db_exec($str,$conn);[/codebox]
attempting to do what I know is usual, is not working out, anyone?

T
thesofa 12/1/2008
global $conn;

$str = "insert into order_sales (Shipto_name,Shipto_Lname,Shipto_address,Shipto_address2,Shipto_city,Shipto_s

tat

e,Shipto_zip)

values ('".db_addslashes($values["Billto_name"])."','".db_addslashes($values["Billto_Lname"])."','".db_addslashes($values["Billto_address"])."'

,'".db_addslashes($values["Billto_address2"])."','".db_addslashes($values["Billto_city"])."','".db_addslashes($values["Billto_state"])."'

,'".db_addslashes($values["Billto_zip"])."')";

db_exec($str,$conn);



try adding a line

$str.="where Order_num=".$keys["Order_num"]



before this line

db_exec($str,$conn);


you may need to play with the semicolons to get a proper line end.

hth

C
chaintm author 12/2/2008

ya , i tried these variances, I am missing something simple I am sure, but this is not it sadly.