Using SPLIT to seperate values (Full Version)

All Forums >> [Web Development] >> ASP, PHP, and Database



Message


maduko -> Using SPLIT to seperate values (1/24/2005 12:05:13)

Our payment gateway sends back the Order ID field twice (not sure why). So my SQL that puts the info into a database always ends with order ID numbers like:
66.44.105.1-55151.102, 66.44.105.1-55151.102

I only want one stored in the database, not both. What is the correct syntax to disregard the comma and extra text?




rdouglass -> RE: Using SPLIT to seperate values (1/24/2005 13:10:59)

You may not have to split it. How about something like:

<%
myField = left(myField,instr(myField,",")-1)
%>

That should give you everything to the left of the first comma. That any help?




maduko -> RE: Using SPLIT to seperate values (1/24/2005 14:38:10)

Hmmmm... here's the line from the INSERT statement:

mySQL= mySQL & SQL_Esc(Request("oid")) & "','"

I'm not sure how to incorporate the LEFT into that.





Spooky -> RE: Using SPLIT to seperate values (1/24/2005 14:56:24)

mySQL= mySQL & SQL_Esc(Left(Request("oid"),instr(Request("oid"),",")-1) & "','"




maduko -> RE: Using SPLIT to seperate values (1/24/2005 15:04:01)

I guess I'm not as dense as I thought- that's what I came up with. But this is what I get back:

Microsoft VBScript compilation error '800a03ee'

Expected ')'

/secure/thanks.asp, line 226

mySQL= mySQL & SQL_Esc(Left(Request("oid"),instr(Request("oid"),",")-1) & "','"
-------------------------------------------------------------------------------^




Spooky -> RE: Using SPLIT to seperate values (1/24/2005 15:06:27)

mySQL= mySQL & SQL_Esc(Left(Request("oid"),instr(Request("oid"),",")-1)) & "','"

Not quite enough :-)




maduko -> RE: Using SPLIT to seperate values (1/24/2005 15:18:34)

Grrrrr.....

Microsoft VBScript runtime error '800a0005'

Invalid procedure call or argument: 'Left'

/secure/thanks.asp, line 226




Spooky -> RE: Using SPLIT to seperate values (1/24/2005 15:20:28)

Is Request("oid") filled with a valid entry?




maduko -> RE: Using SPLIT to seperate values (1/24/2005 15:35:42)

Yes, there isn't really any validuty check on the field.




Spooky -> RE: Using SPLIT to seperate values (1/24/2005 15:44:51)

And line 226 is this code?
What happens when you use ON ERROR... and response.write mySQL?




maduko -> RE: Using SPLIT to seperate values (1/24/2005 16:01:00)

I'm sorry- what is the syntax for adding the ON ERROR to this?




Spooky -> RE: Using SPLIT to seperate values (1/24/2005 16:02:59)

ON ERROR RESUME NEXT
Add a "response.end" if you want to halt the code, and response.write any values before that break.

eg :

ON ERROR RESUME NEXT

' dodgy code

response.write mySQL
response.end





maduko -> RE: Using SPLIT to seperate values (1/24/2005 16:16:44)

MY APOLOGIES!

Maybe a "valid input" would be one with a friggin comma! Duh.

Thank you very much.




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.0625