FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » function for preserving special characters?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: solved [message #186107 is a reply to message #186105] Sat, 14 June 2014 01:39 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 6/13/2014 8:48 PM, richard wrote:
> On Fri, 13 Jun 2014 19:43:52 -0400, Jerry Stuckle wrote:
>
>> 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(dot)1exa9x5yqxi59$(dot)dlg(at)40tude(dot)net>, richard
>>>> > <noreply(at)example(dot)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.
>
> Jerry, you have stepped down to evan's level for sure.

Not at all. You're the one arguing from a position of ignorance (and
incompetence).

> this is a string: "It's Late".
> this is a variable string: $x="It's Late".
>
> The variable is nothing more than a shortcut.

No, the variable is MUCH MORE than a shortcut. But you don't understand
that.

> The variable allows us to use the same information over and over and at
> numerous places. We don't have to use a variable but it is there.
> It is cvalled a variable because the content can change as desired.
>

Congratulations - you can read the dictionary (don't know if you can
understand it, though).

But you're just proving your stupidity over and over again, arguing
something about which you know nothing.

>
> I'm done with you here, asswipe.
>

Thanks you!


--
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Oracle Wallet and PHP issue.
Next Topic: What is the purpose of "&" in this code?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Dec 11 22:56:46 GMT 2024

Total time taken to generate the page: 0.05532 seconds