Why doesn't mysql allow *apostrophies* into fields?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: Why doesn't mysql allow *apostrophies* into fields?

Post by simonmlewis »

Yes, it's the last time.

It's collated, then used the output into the mysql query.

Just odd that it works on the test page, but not here.

There is no other part to it, except for when $price is used in the update query.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: Why doesn't mysql allow *apostrophies* into fields?

Post by simonmlewis »

The field type is an INT.
I've replaced it with your code, but still it isn't altering anything.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: Why doesn't mysql allow *apostrophies* into fields?

Post by simonmlewis »

Ok.... it did work, sort of.
I had an escape string that killed it.

But now it is rounding it up.

13997.56 becomes 13998.

:cry:
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: Why doesn't mysql allow *apostrophies* into fields?

Post by simonmlewis »

Bingo - thx.

Never knew about float 8,2.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: Why doesn't mysql allow *apostrophies* into fields?

Post by Weirdan »

For prices and other values involving money I'd recommend decimal - it's exact format and calculations involving it do not tend to loose precision (unlike float).
Post Reply