Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Textbox changes .t. string to 1.0 1

Status
Not open for further replies.

Rutsagig

IS-IT--Management
Jun 24, 2019
9
ES
I have a textbox to insert email address to mysql database.
Last day, entering an address like john.t.smith@gmail.com, I notice it saved it as john1.0smith@gmail.com.
It understand .t. and .f. as true or false, and change it to 1.0 and 0.0.
How could I solve this?
Thanks
 
Code:
DO WHILE ATC("(.t.",lcConsulta)>0
	lcConsulta=STUFFC( lcConsulta,ATC("(.t.",lcConsulta),4,'(1.0')
ENDDO 
DO WHILE ATC(",.t.",lcConsulta)>0
	lcConsulta=STUFFC( lcConsulta,ATC(",.t.",lcConsulta),4,',1.0')
ENDDO 
DO WHILE ATC("(.f.",lcConsulta)>0
	lcConsulta=STUFFC( lcConsulta,ATC("(.f.",lcConsulta),4,'(0.0')
ENDDO 
DO WHILE ATC(",.f.",lcConsulta)>0
	lcConsulta=STUFFC( lcConsulta,ATC(",.f.",lcConsulta),4,',0.0')
ENDDO

Something like the above should sort the INSERT INTO

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
Thanks GriffMG, I added that and this too:
Code:
DO WHILE ATC(" .t.",lcConsulta)>0
	lcConsulta=STUFFC( lcConsulta,ATC(" .t.",lcConsulta),4,',1.0')
ENDDO 
DO WHILE ATC(" .f.",lcConsulta)>0
	lcConsulta=STUFFC( lcConsulta,ATC(" .f.",lcConsulta),4,'(0.0')
ENDDO

Because it has some queries like:
SQL:
SELECT *
FROM CLIENTS
WHERE .T.
And if I don't change this '.T.' it doesn't work
 
You would drop the WHERE altogether in those cases

SELECT * FROM CLIENTS

is the same as

SELECT * FROM CLIENTS WHERE .T.

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
For other databases than VFP, when you absolutely want a universal WHERE .T. replacement, then take WHERE 1=1.

Chriss
 
Ricky, I think you have done what I did, not read the question...

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
Ricky, I think you have done what I did, not read the question...

Actually, Griff, this was a rather weak attempt at spamming the forum. As you can see, Ricky has now been expunged (and from other forums as well).

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Ah, I did wonder, his code being PHP rather than VFP...

Thanks for the heads up.

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top