Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #13816 > unrolled thread

function for preserving special characters?

Started byrichard <noreply@example.com>
First post2014-06-13 00:57 -0400
Last post2014-06-13 22:08 -0400
Articles 20 on this page of 30 — 9 participants

Back to article view | Back to comp.lang.php


Contents

  function for preserving special characters? richard <noreply@example.com> - 2014-06-13 00:57 -0400
    Re: function for preserving special characters? Tim Streater <timstreater@greenbee.net> - 2014-06-13 10:03 +0100
      Re: function for preserving special characters? Christoph Michael Becker <cmbecker69@arcor.de> - 2014-06-13 15:32 +0200
        Re: function for preserving special characters? Tim Streater <timstreater@greenbee.net> - 2014-06-13 14:42 +0100
          Re: function for preserving special characters? Christoph Michael Becker <cmbecker69@arcor.de> - 2014-06-13 16:26 +0200
            Re: function for preserving special characters? Tim Streater <timstreater@greenbee.net> - 2014-06-13 18:23 +0100
    Re: function for preserving special characters? Doug Miller <doug_at_milmac_dot_com@example.com> - 2014-06-13 10:39 +0000
      Re: function for preserving special characters? Paul Herber <paul@pherber.com> - 2014-06-13 12:37 +0100
        Re: function for preserving special characters? Doug Miller <doug_at_milmac_dot_com@example.com> - 2014-06-13 12:59 +0000
        Re: function for preserving special characters? richard <noreply@example.com> - 2014-06-13 14:45 -0400
    solved  (was: function for preserving special characters?) richard <noreply@example.com> - 2014-06-13 09:57 -0400
      Re: solved Jerry Stuckle <jstucklex@attglobal.net> - 2014-06-13 10:14 -0400
        Re: solved richard <noreply@example.com> - 2014-06-13 14:43 -0400
          Re: solved Jerry Stuckle <jstucklex@attglobal.net> - 2014-06-13 15:01 -0400
            Re: solved richard <noreply@example.com> - 2014-06-13 15:44 -0400
              Re: solved Jerry Stuckle <jstucklex@attglobal.net> - 2014-06-13 16:09 -0400
              Re: solved Tim Streater <timstreater@greenbee.net> - 2014-06-13 21:16 +0100
                Re: solved Jerry Stuckle <jstucklex@attglobal.net> - 2014-06-13 16:38 -0400
                  Re: solved richard <noreply@example.com> - 2014-06-13 18:29 -0400
                    Re: solved Jerry Stuckle <jstucklex@attglobal.net> - 2014-06-13 19:43 -0400
                      Re: solved richard <noreply@example.com> - 2014-06-13 20:48 -0400
                        Re: solved Jerry Stuckle <jstucklex@attglobal.net> - 2014-06-13 21:39 -0400
                    Re: solved Evan Platt <evan@theobvious.espphotography.com.invalid> - 2014-06-13 21:20 -0700
                    Re: solved Denis McMahon <denismfmcmahon@gmail.com> - 2014-06-14 19:50 +0000
                Re: solved richard <noreply@example.com> - 2014-06-13 18:23 -0400
                  Re: solved Denis McMahon <denismfmcmahon@gmail.com> - 2014-06-14 20:01 +0000
              Re: solved Denis McMahon <denismfmcmahon@gmail.com> - 2014-06-13 20:50 +0000
    Re: function for preserving special characters? Richard Damon <Richard@Damon-Family.org> - 2014-06-13 20:45 -0400
      Re: function for preserving special characters? Jerry Stuckle <jstucklex@attglobal.net> - 2014-06-13 20:51 -0400
        Re: function for preserving special characters? Richard Damon <Richard@Damon-Family.org> - 2014-06-13 22:08 -0400

Page 1 of 2  [1] 2  Next page →


#13816 — function for preserving special characters?

Fromrichard <noreply@example.com>
Date2014-06-13 00:57 -0400
Subjectfunction for preserving special characters?
Message-ID<4s7xh8hg1pcy.ov70m21znbte$.dlg@40tude.net>
When attempting to transfer records from one table to another, certain
records refuse to be.
Such as those with words like "I'm".
What's even more confusing is, "It's" won't work, but "Cathy's" is ok?

I know there is a procedure in PHP for dealing with this.
I just can't find it right now.
Can anyone help on this?

[toc] | [next] | [standalone]


#13817

FromTim Streater <timstreater@greenbee.net>
Date2014-06-13 10:03 +0100
Message-ID<130620141003124648%timstreater@greenbee.net>
In reply to#13816
In article <4s7xh8hg1pcy.ov70m21znbte$.dlg@40tude.net>, richard
<noreply@example.com> wrote:

> When attempting to transfer records from one table to another, certain
> records refuse to be.
> Such as those with words like "I'm".
> What's even more confusing is, "It's" won't work, but "Cathy's" is ok?
> 
> I know there is a procedure in PHP for dealing with this.
> I just can't find it right now.
> Can anyone help on this?

You need to read up on your database and find how it deals with things
like single-quotes (') in strings that you want to update a column
with. Or rather, how it expects *you* to present the data.

For SQLite, I do this:

     $x   = str_replace ('\'', '\'\'', $xx);

-- 
"Freedom is sloppy. But since tyranny's the only guaranteed byproduct of
those who insist on a perfect world, freedom will have to do." -- Bigby Wolf

[toc] | [prev] | [next] | [standalone]


#13821

FromChristoph Michael Becker <cmbecker69@arcor.de>
Date2014-06-13 15:32 +0200
Message-ID<539afd73$0$6602$9b4e6d93@newsspool4.arcor-online.net>
In reply to#13817
Tim Streater wrote:

> In article <4s7xh8hg1pcy.ov70m21znbte$.dlg@40tude.net>, richard
> <noreply@example.com> wrote:
> 
>> When attempting to transfer records from one table to another, certain
>> records refuse to be.
>> Such as those with words like "I'm".
>> What's even more confusing is, "It's" won't work, but "Cathy's" is ok?
>>
>> I know there is a procedure in PHP for dealing with this.
>> I just can't find it right now.
>> Can anyone help on this?
> 
> You need to read up on your database and find how it deals with things
> like single-quotes (') in strings that you want to update a column
> with. Or rather, how it expects *you* to present the data.
> 
> For SQLite, I do this:
> 
>     $x   = str_replace ('\'', '\'\'', $xx);

However, remember Bobby Tables: <http://xkcd.com/327/>.

-- 
Christoph M. Becker

[toc] | [prev] | [next] | [standalone]


#13822

FromTim Streater <timstreater@greenbee.net>
Date2014-06-13 14:42 +0100
Message-ID<130620141442531527%timstreater@greenbee.net>
In reply to#13821
In article <539afd73$0$6602$9b4e6d93@newsspool4.arcor-online.net>,
Christoph Michael Becker <cmbecker69@arcor.de> wrote:

> Tim Streater wrote:
> 
> > In article <4s7xh8hg1pcy.ov70m21znbte$.dlg@40tude.net>, richard
> > <noreply@example.com> wrote:
> > 
> >> When attempting to transfer records from one table to another, certain
> >> records refuse to be.
> >> Such as those with words like "I'm".
> >> What's even more confusing is, "It's" won't work, but "Cathy's" is ok?
> >>
> >> I know there is a procedure in PHP for dealing with this.
> >> I just can't find it right now.
> >> Can anyone help on this?
> > 
> > You need to read up on your database and find how it deals with things
> > like single-quotes (') in strings that you want to update a column
> > with. Or rather, how it expects *you* to present the data.
> > 
> > For SQLite, I do this:
> > 
> >     $x   = str_replace ('\'', '\'\'', $xx);
> 
> However, remember Bobby Tables: <http://xkcd.com/327/>.

:-)  Yeah yeah.

However in this case the guy doing the hacking would be the guy whose
data would be trashed. Why destroy your own data that way when you can
just drag the entire file to the Trash and empty it.

-- 
"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted"  --  Bill of Rights 1689

[toc] | [prev] | [next] | [standalone]


#13825

FromChristoph Michael Becker <cmbecker69@arcor.de>
Date2014-06-13 16:26 +0200
Message-ID<539b0a09$0$6621$9b4e6d93@newsspool4.arcor-online.net>
In reply to#13822
Tim Streater wrote:

> In article <539afd73$0$6602$9b4e6d93@newsspool4.arcor-online.net>,
> Christoph Michael Becker <cmbecker69@arcor.de> wrote:
> 
>> Tim Streater wrote:
>>
>> > In article <4s7xh8hg1pcy.ov70m21znbte$.dlg@40tude.net>, richard
>> > <noreply@example.com> wrote:
>> > >> When attempting to transfer records from one table to another,
>> certain
>> >> records refuse to be.
>> >> Such as those with words like "I'm".
>> >> What's even more confusing is, "It's" won't work, but "Cathy's" is ok?
>> >>
>> >> I know there is a procedure in PHP for dealing with this.
>> >> I just can't find it right now.
>> >> Can anyone help on this?
>> > > You need to read up on your database and find how it deals with
>> things
>> > like single-quotes (') in strings that you want to update a column
>> > with. Or rather, how it expects *you* to present the data.
>> > > For SQLite, I do this:
>> > >     $x   = str_replace ('\'', '\'\'', $xx);
>>
>> However, remember Bobby Tables: <http://xkcd.com/327/>.
> 
> :-)  Yeah yeah.
> 
> However in this case the guy doing the hacking would be the guy whose
> data would be trashed. Why destroy your own data that way when you can
> just drag the entire file to the Trash and empty it.

ACK.

However, my reply was not particularly meant for you, but also for
others who want to do this on otherwise unsanitized user input.

-- 
Christoph M. Becker

[toc] | [prev] | [next] | [standalone]


#13826

FromTim Streater <timstreater@greenbee.net>
Date2014-06-13 18:23 +0100
Message-ID<130620141823386203%timstreater@greenbee.net>
In reply to#13825
In article <539b0a09$0$6621$9b4e6d93@newsspool4.arcor-online.net>,
Christoph Michael Becker <cmbecker69@arcor.de> wrote:

> Tim Streater wrote:
> 
> > In article <539afd73$0$6602$9b4e6d93@newsspool4.arcor-online.net>,
> > Christoph Michael Becker <cmbecker69@arcor.de> wrote:
> > 
> >> Tim Streater wrote:
> >>
> >> > In article <4s7xh8hg1pcy.ov70m21znbte$.dlg@40tude.net>, richard
> >> > <noreply@example.com> wrote:
> >> > >> When attempting to transfer records from one table to another,
> >> certain
> >> >> records refuse to be.
> >> >> Such as those with words like "I'm".
> >> >> What's even more confusing is, "It's" won't work, but "Cathy's" is ok?
> >> >>
> >> >> I know there is a procedure in PHP for dealing with this.
> >> >> I just can't find it right now.
> >> >> Can anyone help on this?
> >> > > You need to read up on your database and find how it deals with
> >> things
> >> > like single-quotes (') in strings that you want to update a column
> >> > with. Or rather, how it expects *you* to present the data.
> >> > > For SQLite, I do this:
> >> > >     $x   = str_replace ('\'', '\'\'', $xx);
> >>
> >> However, remember Bobby Tables: <http://xkcd.com/327/>.
> > 
> > :-)  Yeah yeah.
> > 
> > However in this case the guy doing the hacking would be the guy whose
> > data would be trashed. Why destroy your own data that way when you can
> > just drag the entire file to the Trash and empty it.
> 
> ACK.
> 
> However, my reply was not particularly meant for you, but also for
> others who want to do this on otherwise unsanitized user input.

Still, it was quite useful as I went back and entered variants of:

    xxx'); drop table xyz; --

into some screen entry fields without succeeding in doing any damage.
Either the entry was rejected (by my code) for a numeric field, or was
accepted verbatim and ended up in a database field. Not that this
proves invulnerability, but it's at least a start.

-- 
"The idea that Bill Gates has appeared like a knight in shining armour to
 lead all customers out of a mire of technological chaos neatly ignores 
 the fact that it was he who, by peddling second-rate technology, led them
 into it in the first place."                             - Douglas Adams

[toc] | [prev] | [next] | [standalone]


#13818

FromDoug Miller <doug_at_milmac_dot_com@example.com>
Date2014-06-13 10:39 +0000
Message-ID<XnsA34B43BA585F3dougmilmaccom@78.46.70.116>
In reply to#13816
richard <noreply@example.com> wrote in news:4s7xh8hg1pcy.ov70m21znbte$.dlg@
40tude.net:

> When attempting to transfer records from one table to another, certain
> records refuse to be.
> Such as those with words like "I'm".
> What's even more confusing is, "It's" won't work, but "Cathy's" is ok?

That alone should be sufficient for you to realize that the problem isn't what you think it is.

[toc] | [prev] | [next] | [standalone]


#13819

FromPaul Herber <paul@pherber.com>
Date2014-06-13 12:37 +0100
Message-ID<iholp91t72h47t8e069ks5ils0iaimcsib@news.eternal-september.org>
In reply to#13818
On Fri, 13 Jun 2014 10:39:59 +0000 (UTC), Doug Miller <doug_at_milmac_dot_com@example.com>
wrote:

>richard <noreply@example.com> wrote in news:4s7xh8hg1pcy.ov70m21znbte$.dlg@
>40tude.net:
>
>> When attempting to transfer records from one table to another, certain
>> records refuse to be.
>> Such as those with words like "I'm".
>> What's even more confusing is, "It's" won't work, but "Cathy's" is ok?
>
>That alone should be sufficient for you to realize that the problem isn't what you think it is.

cue abuse from RTS



-- 
Regards, Paul Herber, Sandrila Ltd.
http://www.sandrila.co.uk/
      

[toc] | [prev] | [next] | [standalone]


#13820

FromDoug Miller <doug_at_milmac_dot_com@example.com>
Date2014-06-13 12:59 +0000
Message-ID<XnsA34B5B6C5C726dougmilmaccom@78.46.70.116>
In reply to#13819
Paul Herber <paul@pherber.com> wrote in 
news:iholp91t72h47t8e069ks5ils0iaimcsib@news.eternal-september.org:

> On Fri, 13 Jun 2014 10:39:59 +0000 (UTC), Doug Miller 
<doug_at_milmac_dot_com@example.com>
> wrote:
> 
>>richard <noreply@example.com> wrote in news:4s7xh8hg1pcy.ov70m21znbte$.dlg@
>>40tude.net:
>>
>>> When attempting to transfer records from one table to another, certain
>>> records refuse to be.
>>> Such as those with words like "I'm".
>>> What's even more confusing is, "It's" won't work, but "Cathy's" is ok?
>>
>>That alone should be sufficient for you to realize that the problem isn't what you think it is.
> 
> cue abuse from RTS

Not taking that bet.

[toc] | [prev] | [next] | [standalone]


#13829

Fromrichard <noreply@example.com>
Date2014-06-13 14:45 -0400
Message-ID<1g29a93nv10g4.14oq8auyo295a$.dlg@40tude.net>
In reply to#13819
On Fri, 13 Jun 2014 12:37:50 +0100, Paul Herber wrote:

> On Fri, 13 Jun 2014 10:39:59 +0000 (UTC), Doug Miller <doug_at_milmac_dot_com@example.com>
> wrote:
> 
>>richard <noreply@example.com> wrote in news:4s7xh8hg1pcy.ov70m21znbte$.dlg@
>>40tude.net:
>>
>>> When attempting to transfer records from one table to another, certain
>>> records refuse to be.
>>> Such as those with words like "I'm".
>>> What's even more confusing is, "It's" won't work, but "Cathy's" is ok?
>>
>>That alone should be sufficient for you to realize that the problem isn't what you think it is.
> 
> cue abuse from RTS

Every one is entitled to their opinion.

[toc] | [prev] | [next] | [standalone]


#13823 — solved (was: function for preserving special characters?)

Fromrichard <noreply@example.com>
Date2014-06-13 09:57 -0400
Subjectsolved (was: function for preserving special characters?)
Message-ID<itrvizyykmyu$.1m8xc48h8xvgi.dlg@40tude.net>
In reply to#13816
On Fri, 13 Jun 2014 00:57:10 -0400, richard wrote:

> When attempting to transfer records from one table to another, certain
> records refuse to be.
> Such as those with words like "I'm".
> What's even more confusing is, "It's" won't work, but "Cathy's" is ok?
> 
> I know there is a procedure in PHP for dealing with this.
> I just can't find it right now.
> Can anyone help on this?

$a=str_replace("'","\'",$a);
Works just fine.
Thanks for the reminder tim.

[toc] | [prev] | [next] | [standalone]


#13824 — Re: solved

FromJerry Stuckle <jstucklex@attglobal.net>
Date2014-06-13 10:14 -0400
SubjectRe: solved
Message-ID<lnf0vd$e2n$1@dont-email.me>
In reply to#13823
On 6/13/2014 9:57 AM, richard wrote:
> On Fri, 13 Jun 2014 00:57:10 -0400, richard wrote:
> 
>> When attempting to transfer records from one table to another, certain
>> records refuse to be.
>> Such as those with words like "I'm".
>> What's even more confusing is, "It's" won't work, but "Cathy's" is ok?
>>
>> I know there is a procedure in PHP for dealing with this.
>> I just can't find it right now.
>> Can anyone help on this?
> 
> $a=str_replace("'","\'",$a);
> Works just fine.
> Thanks for the reminder tim.
> 

That might work for sqllite, but it's definitely the WRONG way to do it
in MySQL.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#13828 — Re: solved

Fromrichard <noreply@example.com>
Date2014-06-13 14:43 -0400
SubjectRe: solved
Message-ID<1dix54w7x6apy$.1jl70bauvt0a0$.dlg@40tude.net>
In reply to#13824
On Fri, 13 Jun 2014 10:14:06 -0400, Jerry Stuckle wrote:

> On 6/13/2014 9:57 AM, richard wrote:
>> On Fri, 13 Jun 2014 00:57:10 -0400, richard wrote:
>> 
>>> When attempting to transfer records from one table to another, certain
>>> records refuse to be.
>>> Such as those with words like "I'm".
>>> What's even more confusing is, "It's" won't work, but "Cathy's" is ok?
>>>
>>> I know there is a procedure in PHP for dealing with this.
>>> I just can't find it right now.
>>> Can anyone help on this?
>> 
>> $a=str_replace("'","\'",$a);
>> Works just fine.
>> Thanks for the reminder tim.
>> 
> 
> That might work for sqllite, but it's definitely the WRONG way to do it
> in MySQL.

As you continously remind me, this is not an mysql issue.
The table data could care less what characters are in it.
mysqli doesn't give a shit either.

if I code the data with a \ in the column cell, the output will show that
\.

[toc] | [prev] | [next] | [standalone]


#13830 — Re: solved

FromJerry Stuckle <jstucklex@attglobal.net>
Date2014-06-13 15:01 -0400
SubjectRe: solved
Message-ID<lnfhr0$e8v$1@dont-email.me>
In reply to#13828
On 6/13/2014 2:43 PM, richard wrote:
> On Fri, 13 Jun 2014 10:14:06 -0400, Jerry Stuckle wrote:
> 
>> On 6/13/2014 9:57 AM, richard wrote:
>>> On Fri, 13 Jun 2014 00:57:10 -0400, richard wrote:
>>>
>>>> When attempting to transfer records from one table to another, certain
>>>> records refuse to be.
>>>> Such as those with words like "I'm".
>>>> What's even more confusing is, "It's" won't work, but "Cathy's" is ok?
>>>>
>>>> I know there is a procedure in PHP for dealing with this.
>>>> I just can't find it right now.
>>>> Can anyone help on this?
>>>
>>> $a=str_replace("'","\'",$a);
>>> Works just fine.
>>> Thanks for the reminder tim.
>>>
>>
>> That might work for sqllite, but it's definitely the WRONG way to do it
>> in MySQL.
> 
> As you continously remind me, this is not an mysql issue.
> The table data could care less what characters are in it.
> mysqli doesn't give a shit either.
> 
> if I code the data with a \ in the column cell, the output will show that
> \.
> 

One again you are WRONG!  As evidenced by the failure of the insertions.

And if you would have checked for errors (as you've been told many times
before), you would have found a MySQL error.

I remind you if something is not a MySQL issue when it's not a MySQL
issue.  However, you can't learn the difference between PHP and MySQL.

Here's a hint: PHP doesn't care what's in a string.  So if neither one
cares, why should the INSERT fail?

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#13834 — Re: solved

Fromrichard <noreply@example.com>
Date2014-06-13 15:44 -0400
SubjectRe: solved
Message-ID<157nwayhe47ig.1exa9x5yqxi59$.dlg@40tude.net>
In reply to#13830
On Fri, 13 Jun 2014 15:01:53 -0400, Jerry Stuckle wrote:

> On 6/13/2014 2:43 PM, richard wrote:
>> On Fri, 13 Jun 2014 10:14:06 -0400, Jerry Stuckle wrote:
>> 
>>> On 6/13/2014 9:57 AM, richard wrote:
>>>> On Fri, 13 Jun 2014 00:57:10 -0400, richard wrote:
>>>>
>>>>> When attempting to transfer records from one table to another, certain
>>>>> records refuse to be.
>>>>> Such as those with words like "I'm".
>>>>> What's even more confusing is, "It's" won't work, but "Cathy's" is ok?
>>>>>
>>>>> I know there is a procedure in PHP for dealing with this.
>>>>> I just can't find it right now.
>>>>> Can anyone help on this?
>>>>
>>>> $a=str_replace("'","\'",$a);
>>>> Works just fine.
>>>> Thanks for the reminder tim.
>>>>
>>>
>>> That might work for sqllite, but it's definitely the WRONG way to do it
>>> in MySQL.
>> 
>> As you continously remind me, this is not an mysql issue.
>> The table data could care less what characters are in it.
>> mysqli doesn't give a shit either.
>> 
>> if I code the data with a \ in the column cell, the output will show that
>> \.
>> 
> 
> One again you are WRONG!  As evidenced by the failure of the insertions.
> 
> And if you would have checked for errors (as you've been told many times
> before), you would have found a MySQL error.
> 
> I remind you if something is not a MySQL issue when it's not a MySQL
> issue.  However, you can't learn the difference between PHP and MySQL.
> 
> Here's a hint: PHP doesn't care what's in a string.  So if neither one
> cares, why should the INSERT fail?

Jerry, you are argumentative here just to be arguing.
I did put in an error check.
That confirmed that it was the single quotes causing the problem.

What's going to happen when you say:
insert into tabe VALUES('it's').
PHP, not mysqli, kicks back an error right?
PHP sees the third single quote as a mismatch.
To correct this, you must include a \.
Insert into table VALUES('it\'s') is now acceptable.

[toc] | [prev] | [next] | [standalone]


#13835 — Re: solved

FromJerry Stuckle <jstucklex@attglobal.net>
Date2014-06-13 16:09 -0400
SubjectRe: solved
Message-ID<lnflph$dac$1@dont-email.me>
In reply to#13834
On 6/13/2014 3:44 PM, richard wrote:
> On Fri, 13 Jun 2014 15:01:53 -0400, Jerry Stuckle wrote:
> 
>> On 6/13/2014 2:43 PM, richard wrote:
>>> On Fri, 13 Jun 2014 10:14:06 -0400, Jerry Stuckle wrote:
>>>
>>>> On 6/13/2014 9:57 AM, richard wrote:
>>>>> On Fri, 13 Jun 2014 00:57:10 -0400, richard wrote:
>>>>>
>>>>>> When attempting to transfer records from one table to another, certain
>>>>>> records refuse to be.
>>>>>> Such as those with words like "I'm".
>>>>>> What's even more confusing is, "It's" won't work, but "Cathy's" is ok?
>>>>>>
>>>>>> I know there is a procedure in PHP for dealing with this.
>>>>>> I just can't find it right now.
>>>>>> Can anyone help on this?
>>>>>
>>>>> $a=str_replace("'","\'",$a);
>>>>> Works just fine.
>>>>> Thanks for the reminder tim.
>>>>>
>>>>
>>>> That might work for sqllite, but it's definitely the WRONG way to do it
>>>> in MySQL.
>>>
>>> As you continously remind me, this is not an mysql issue.
>>> The table data could care less what characters are in it.
>>> mysqli doesn't give a shit either.
>>>
>>> if I code the data with a \ in the column cell, the output will show that
>>> \.
>>>
>>
>> One again you are WRONG!  As evidenced by the failure of the insertions.
>>
>> And if you would have checked for errors (as you've been told many times
>> before), you would have found a MySQL error.
>>
>> I remind you if something is not a MySQL issue when it's not a MySQL
>> issue.  However, you can't learn the difference between PHP and MySQL.
>>
>> Here's a hint: PHP doesn't care what's in a string.  So if neither one
>> cares, why should the INSERT fail?
> 
> Jerry, you are argumentative here just to be arguing.

WRONG.

> I did put in an error check.
> That confirmed that it was the single quotes causing the problem.
>
> What's going to happen when you say:
> insert into tabe VALUES('it's').
> PHP, not mysqli, kicks back an error right?

WRONG.

> PHP sees the third single quote as a mismatch.

WRONG.

> To correct this, you must include a \.

WRONG.

> Insert into table VALUES('it\'s') is now acceptable.
> 

It works - but it is not ACCEPTABLE.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#13836 — Re: solved

FromTim Streater <timstreater@greenbee.net>
Date2014-06-13 21:16 +0100
SubjectRe: solved
Message-ID<130620142116006731%timstreater@greenbee.net>
In reply to#13834
In article <157nwayhe47ig.1exa9x5yqxi59$.dlg@40tude.net>, richard
<noreply@example.com> wrote:

> On Fri, 13 Jun 2014 15:01:53 -0400, Jerry Stuckle wrote:
> 
> > On 6/13/2014 2:43 PM, richard wrote:
> >> On Fri, 13 Jun 2014 10:14:06 -0400, Jerry Stuckle wrote:
> >> 
> >>> On 6/13/2014 9:57 AM, richard wrote:
> >>>> On Fri, 13 Jun 2014 00:57:10 -0400, richard wrote:
> >>>>
> >>>>> When attempting to transfer records from one table to another, certain
> >>>>> records refuse to be.
> >>>>> Such as those with words like "I'm".
> >>>>> What's even more confusing is, "It's" won't work, but "Cathy's" is ok?
> >>>>>
> >>>>> I know there is a procedure in PHP for dealing with this.
> >>>>> I just can't find it right now.
> >>>>> Can anyone help on this?
> >>>>
> >>>> $a=str_replace("'","\'",$a);
> >>>> Works just fine.
> >>>> Thanks for the reminder tim.
> >>>>
> >>>
> >>> That might work for sqllite, but it's definitely the WRONG way to do it
> >>> in MySQL.
> >> 
> >> As you continously remind me, this is not an mysql issue.
> >> The table data could care less what characters are in it.
> >> mysqli doesn't give a shit either.
> >> 
> >> if I code the data with a \ in the column cell, the output will show that
> >> \.
> >> 
> > 
> > One again you are WRONG!  As evidenced by the failure of the insertions.
> > 
> > And if you would have checked for errors (as you've been told many times
> > before), you would have found a MySQL error.
> > 
> > I remind you if something is not a MySQL issue when it's not a MySQL
> > issue.  However, you can't learn the difference between PHP and MySQL.
> > 
> > Here's a hint: PHP doesn't care what's in a string.  So if neither one
> > cares, why should the INSERT fail?
> 
> Jerry, you are argumentative here just to be arguing.
> I did put in an error check.
> That confirmed that it was the single quotes causing the problem.
> 
> What's going to happen when you say:
> insert into tabe VALUES('it's').
> PHP, not mysqli, kicks back an error right?
> PHP sees the third single quote as a mismatch.
> To correct this, you must include a \.
> Insert into table VALUES('it\'s') is now acceptable.

Can you post the exact PHP statement you were using?

See, if you were doing something like (I don't know the syntax exactly):

  $dbh->mysqli ("insert into table VALUES('it's')");

then if you're using double-quotes (") to delimit the SQL string, PHP
won't care that you have three single quotes inside it. That's just
string data to PHP. What will happen is that mysqli will complain,
because what it gets passed is wrong SQL.

It would still be mysqli complaining if you did this:

  $dbh->mysqli ("three coins in a fountain, said Fred");

-- 
"People don't buy Microsoft for quality, they buy it for compatibility
with what Bob in accounting bought last year. Trace it back - they buy
Microsoft because the IBM Selectric didn't suck much" - P Seebach, afc

[toc] | [prev] | [next] | [standalone]


#13837 — Re: solved

FromJerry Stuckle <jstucklex@attglobal.net>
Date2014-06-13 16:38 -0400
SubjectRe: solved
Message-ID<lnfnfb$q8o$1@dont-email.me>
In reply to#13836
On 6/13/2014 4:16 PM, Tim Streater wrote:
> In article <157nwayhe47ig.1exa9x5yqxi59$.dlg@40tude.net>, richard
> <noreply@example.com> wrote:
> 
>> On Fri, 13 Jun 2014 15:01:53 -0400, Jerry Stuckle wrote:
>>
>> > On 6/13/2014 2:43 PM, richard wrote:
>> >> On Fri, 13 Jun 2014 10:14:06 -0400, Jerry Stuckle wrote:
>> >> >>> On 6/13/2014 9:57 AM, richard wrote:
>> >>>> On Fri, 13 Jun 2014 00:57:10 -0400, richard wrote:
>> >>>>
>> >>>>> When attempting to transfer records from one table to another,
>> certain
>> >>>>> records refuse to be.
>> >>>>> Such as those with words like "I'm".
>> >>>>> What's even more confusing is, "It's" won't work, but "Cathy's"
>> is ok?
>> >>>>>
>> >>>>> I know there is a procedure in PHP for dealing with this.
>> >>>>> I just can't find it right now.
>> >>>>> Can anyone help on this?
>> >>>>
>> >>>> $a=str_replace("'","\'",$a);
>> >>>> Works just fine.
>> >>>> Thanks for the reminder tim.
>> >>>>
>> >>>
>> >>> That might work for sqllite, but it's definitely the WRONG way to
>> do it
>> >>> in MySQL.
>> >> >> As you continously remind me, this is not an mysql issue.
>> >> The table data could care less what characters are in it.
>> >> mysqli doesn't give a shit either.
>> >> >> if I code the data with a \ in the column cell, the output will
>> show that
>> >> \.
>> >> > > One again you are WRONG!  As evidenced by the failure of the
>> insertions.
>> > > And if you would have checked for errors (as you've been told many
>> times
>> > before), you would have found a MySQL error.
>> > > I remind you if something is not a MySQL issue when it's not a MySQL
>> > issue.  However, you can't learn the difference between PHP and MySQL.
>> > > Here's a hint: PHP doesn't care what's in a string.  So if neither
>> one
>> > cares, why should the INSERT fail?
>>
>> Jerry, you are argumentative here just to be arguing.
>> I did put in an error check.
>> That confirmed that it was the single quotes causing the problem.
>>
>> What's going to happen when you say:
>> insert into tabe VALUES('it's').
>> PHP, not mysqli, kicks back an error right?
>> PHP sees the third single quote as a mismatch.
>> To correct this, you must include a \.
>> Insert into table VALUES('it\'s') is now acceptable.
> 
> Can you post the exact PHP statement you were using?
> 
> See, if you were doing something like (I don't know the syntax exactly):
> 
>  $dbh->mysqli ("insert into table VALUES('it's')");
> 
> then if you're using double-quotes (") to delimit the SQL string, PHP
> won't care that you have three single quotes inside it. That's just
> string data to PHP. What will happen is that mysqli will complain,
> because what it gets passed is wrong SQL.
> 
> It would still be mysqli complaining if you did this:
> 
>  $dbh->mysqli ("three coins in a fountain, said Fred");
> 

Tim,

No, RTS can't tell the difference between a string containing a single
quote and a string variable containing a single quote.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#13840 — Re: solved

Fromrichard <noreply@example.com>
Date2014-06-13 18:29 -0400
SubjectRe: solved
Message-ID<c70kxhswj3g5$.xgpxov41spse.dlg@40tude.net>
In reply to#13837
On Fri, 13 Jun 2014 16:38:04 -0400, Jerry Stuckle wrote:

> On 6/13/2014 4:16 PM, Tim Streater wrote:
>> In article <157nwayhe47ig.1exa9x5yqxi59$.dlg@40tude.net>, richard
>> <noreply@example.com> wrote:
>> 
>>> On Fri, 13 Jun 2014 15:01:53 -0400, Jerry Stuckle wrote:
>>>
>>> > On 6/13/2014 2:43 PM, richard wrote:
>>> >> On Fri, 13 Jun 2014 10:14:06 -0400, Jerry Stuckle wrote:
>>> >> >>> On 6/13/2014 9:57 AM, richard wrote:
>>> >>>> On Fri, 13 Jun 2014 00:57:10 -0400, richard wrote:
>>> >>>>
>>> >>>>> When attempting to transfer records from one table to another,
>>> certain
>>> >>>>> records refuse to be.
>>> >>>>> Such as those with words like "I'm".
>>> >>>>> What's even more confusing is, "It's" won't work, but "Cathy's"
>>> is ok?
>>> >>>>>
>>> >>>>> I know there is a procedure in PHP for dealing with this.
>>> >>>>> I just can't find it right now.
>>> >>>>> Can anyone help on this?
>>> >>>>
>>> >>>> $a=str_replace("'","\'",$a);
>>> >>>> Works just fine.
>>> >>>> Thanks for the reminder tim.
>>> >>>>
>>> >>>
>>> >>> That might work for sqllite, but it's definitely the WRONG way to
>>> do it
>>> >>> in MySQL.
>>> >> >> As you continously remind me, this is not an mysql issue.
>>> >> The table data could care less what characters are in it.
>>> >> mysqli doesn't give a shit either.
>>> >> >> if I code the data with a \ in the column cell, the output will
>>> show that
>>> >> \.
>>> >> > > One again you are WRONG!  As evidenced by the failure of the
>>> insertions.
>>> > > And if you would have checked for errors (as you've been told many
>>> times
>>> > before), you would have found a MySQL error.
>>> > > I remind you if something is not a MySQL issue when it's not a MySQL
>>> > issue.  However, you can't learn the difference between PHP and MySQL.
>>> > > Here's a hint: PHP doesn't care what's in a string.  So if neither
>>> one
>>> > cares, why should the INSERT fail?
>>>
>>> Jerry, you are argumentative here just to be arguing.
>>> I did put in an error check.
>>> That confirmed that it was the single quotes causing the problem.
>>>
>>> What's going to happen when you say:
>>> insert into tabe VALUES('it's').
>>> PHP, not mysqli, kicks back an error right?
>>> PHP sees the third single quote as a mismatch.
>>> To correct this, you must include a \.
>>> Insert into table VALUES('it\'s') is now acceptable.
>> 
>> Can you post the exact PHP statement you were using?
>> 
>> See, if you were doing something like (I don't know the syntax exactly):
>> 
>>  $dbh->mysqli ("insert into table VALUES('it's')");
>> 
>> then if you're using double-quotes (") to delimit the SQL string, PHP
>> won't care that you have three single quotes inside it. That's just
>> string data to PHP. What will happen is that mysqli will complain,
>> because what it gets passed is wrong SQL.
>> 
>> It would still be mysqli complaining if you did this:
>> 
>>  $dbh->mysqli ("three coins in a fountain, said Fred");
>> 
> 
> Tim,
> 
> No, RTS can't tell the difference between a string containing a single
> quote and a string variable containing a single quote.

Jerry, all you're doing now is bashing me.
Makes no difference what the issue is, you just have to bash.
Besides, you fucked up.
You said single quote twice.
(Oh but I meant to say that)

You have stepped down to Evan's level.

[toc] | [prev] | [next] | [standalone]


#13841 — Re: solved

FromJerry Stuckle <jstucklex@attglobal.net>
Date2014-06-13 19:43 -0400
SubjectRe: solved
Message-ID<lng2bn$6b4$1@dont-email.me>
In reply to#13840
On 6/13/2014 6:29 PM, richard wrote:
> On Fri, 13 Jun 2014 16:38:04 -0400, Jerry Stuckle wrote:
> 
>> On 6/13/2014 4:16 PM, Tim Streater wrote:
>>> In article <157nwayhe47ig.1exa9x5yqxi59$.dlg@40tude.net>, richard
>>> <noreply@example.com> wrote:
>>>
>>>> On Fri, 13 Jun 2014 15:01:53 -0400, Jerry Stuckle wrote:
>>>>
>>>>> On 6/13/2014 2:43 PM, richard wrote:
>>>>>> On Fri, 13 Jun 2014 10:14:06 -0400, Jerry Stuckle wrote:
>>>>>>>>> On 6/13/2014 9:57 AM, richard wrote:
>>>>>>>> On Fri, 13 Jun 2014 00:57:10 -0400, richard wrote:
>>>>>>>>
>>>>>>>>> When attempting to transfer records from one table to another,
>>>> certain
>>>>>>>>> records refuse to be.
>>>>>>>>> Such as those with words like "I'm".
>>>>>>>>> What's even more confusing is, "It's" won't work, but "Cathy's"
>>>> is ok?
>>>>>>>>>
>>>>>>>>> I know there is a procedure in PHP for dealing with this.
>>>>>>>>> I just can't find it right now.
>>>>>>>>> Can anyone help on this?
>>>>>>>>
>>>>>>>> $a=str_replace("'","\'",$a);
>>>>>>>> Works just fine.
>>>>>>>> Thanks for the reminder tim.
>>>>>>>>
>>>>>>>
>>>>>>> That might work for sqllite, but it's definitely the WRONG way to
>>>> do it
>>>>>>> in MySQL.
>>>>>>>> As you continously remind me, this is not an mysql issue.
>>>>>> The table data could care less what characters are in it.
>>>>>> mysqli doesn't give a shit either.
>>>>>>>> if I code the data with a \ in the column cell, the output will
>>>> show that
>>>>>> \.
>>>>>>>> One again you are WRONG!  As evidenced by the failure of the
>>>> insertions.
>>>>>> And if you would have checked for errors (as you've been told many
>>>> times
>>>>> before), you would have found a MySQL error.
>>>>>> I remind you if something is not a MySQL issue when it's not a MySQL
>>>>> issue.  However, you can't learn the difference between PHP and MySQL.
>>>>>> Here's a hint: PHP doesn't care what's in a string.  So if neither
>>>> one
>>>>> cares, why should the INSERT fail?
>>>>
>>>> Jerry, you are argumentative here just to be arguing.
>>>> I did put in an error check.
>>>> That confirmed that it was the single quotes causing the problem.
>>>>
>>>> What's going to happen when you say:
>>>> insert into tabe VALUES('it's').
>>>> PHP, not mysqli, kicks back an error right?
>>>> PHP sees the third single quote as a mismatch.
>>>> To correct this, you must include a \.
>>>> Insert into table VALUES('it\'s') is now acceptable.
>>>
>>> Can you post the exact PHP statement you were using?
>>>
>>> See, if you were doing something like (I don't know the syntax exactly):
>>>
>>>  $dbh->mysqli ("insert into table VALUES('it's')");
>>>
>>> then if you're using double-quotes (") to delimit the SQL string, PHP
>>> won't care that you have three single quotes inside it. That's just
>>> string data to PHP. What will happen is that mysqli will complain,
>>> because what it gets passed is wrong SQL.
>>>
>>> It would still be mysqli complaining if you did this:
>>>
>>>  $dbh->mysqli ("three coins in a fountain, said Fred");
>>>
>>
>> Tim,
>>
>> No, RTS can't tell the difference between a string containing a single
>> quote and a string variable containing a single quote.
> 
> Jerry, all you're doing now is bashing me.
> Makes no difference what the issue is, you just have to bash.
> Besides, you fucked up.
> You said single quote twice.
> (Oh but I meant to say that)
> 
> You have stepped down to Evan's level.
> 

I'm just telling the truth, RTS.  And I know I said single quote twice -
I meant to.  And anyone with half a brain understands what I said.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle


jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


Page 1 of 2  [1] 2  Next page →

Back to top | Article view | comp.lang.php


csiph-web