OutFront Forums
     Home    Register     Search      Help      Login    

Follow Us
On Facebook
On Twitter
RSS
Via Email

Recent Posts
Todays Posts
Most Active posts
Posts since last visit
My Recent Posts
Mark posts read

Sponsors
Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.
Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.
Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

 

Using SPLIT to seperate values

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP, PHP, and Database >> Using SPLIT to seperate values
Page: [1]
 
maduko

 

Posts: 168
From: Tulsa OK USA
Status: offline

 
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

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
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?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to maduko)
maduko

 

Posts: 168
From: Tulsa OK USA
Status: offline

 
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.



< Message edited by maduko -- 1/24/2005 14:47:04 >

(in reply to rdouglass)
Spooky

 

Posts: 26680
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Using SPLIT to seperate values - 1/24/2005 14:56:24   
mySQL= mySQL & SQL_Esc(Left(Request("oid"),instr(Request("oid"),",")-1) & "','"

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

Sp:)ky


(in reply to maduko)
maduko

 

Posts: 168
From: Tulsa OK USA
Status: offline

 
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) & "','"
-------------------------------------------------------------------------------^

(in reply to Spooky)
Spooky

 

Posts: 26680
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
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 :-)

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

Sp:)ky


(in reply to maduko)
maduko

 

Posts: 168
From: Tulsa OK USA
Status: offline

 
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

(in reply to Spooky)
Spooky

 

Posts: 26680
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Using SPLIT to seperate values - 1/24/2005 15:20:28   
Is Request("oid") filled with a valid entry?

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

Sp:)ky


(in reply to maduko)
maduko

 

Posts: 168
From: Tulsa OK USA
Status: offline

 
RE: Using SPLIT to seperate values - 1/24/2005 15:35:42   
Yes, there isn't really any validuty check on the field.

(in reply to Spooky)
Spooky

 

Posts: 26680
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
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?

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

Sp:)ky


(in reply to maduko)
maduko

 

Posts: 168
From: Tulsa OK USA
Status: offline

 
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?

(in reply to Spooky)
Spooky

 

Posts: 26680
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
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



_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

Sp:)ky


(in reply to maduko)
maduko

 

Posts: 168
From: Tulsa OK USA
Status: offline

 
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.

(in reply to Spooky)
Page:   [1]

All Forums >> Web Development >> ASP, PHP, and Database >> Using SPLIT to seperate values
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts