• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

removing zero with loop

Guest
Jul 28, 2006 Jul 28, 2006

Copy link to clipboard

Copied

Hello i have a Insert query which loops through my form from the previous page, what i need to do is if the PlayerPhone starts with "0" to remove it, i have tried the code below but i am having probllems can someone help

TOPICS
Advanced techniques

Views

303

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 29, 2006 Jul 29, 2006

Copy link to clipboard

Copied

The quotes around your variable in your cfif tag might be messing you up. Also, if the number does not start with a 0, your phoneno variable won't be defined.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 29, 2006 Jul 29, 2006

Copy link to clipboard

Copied

ok thanks i have done that and put a cfelse in, but now i get an error for the two # in line 1

<cfif left(form.PlayerPhone_#currRow#,1) EQ "0">
<cfset PhoneNo=removeChars(replace("form.PlayerPhone_#currRow#", " ", "", "all"),1,1)>
<cfelse>
<cfset PhoneNo=("form.PlayerPhone_#currRow#")>
</cfif>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 29, 2006 Jul 29, 2006

Copy link to clipboard

Copied

I forget the exact syntax you need, but it might involve square brackets.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 29, 2006 Jul 29, 2006

Copy link to clipboard

Copied

LATEST
ok i have sorted it but with 1 small problem.

if one of the "playerphone" has a space in it, instead of removing it, it actually removes the "f" from form.playerphone as in the error below

any ideas how to sort this?

Error:
SQL INSERT INTO sms_players_table (PlayerFirstName, PlayerSurname, PlayerPhone, ClubID) VALUES ('Robert', 'Aitken', orm.PlayerPhone_3, 3)
DATASOURCE iluvcricket

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation