473,320 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

pear DB converting ' to &#039 - how to convert back?

I have tested my logic flow and determined that the conversion from what is
given to the
$db->prepare() statement and what is stored in the database iteslf goes
from:

"I'm helpful"
to
"I'm helpful"

is converted by pear's DB. I am using $db->prepare() statement. When I do
a print_r() of $db after the prepare(), it does display:
...., field2 = 'I'm helpful', field3=....

but what ends up in the database is:
"I'm helpful"

I'm using PHP 4.3 and have tried html_entity_decode() and others
unsuccessfully.

Any ideas?

Jan 8 '07 #1
3 1908
you are lucky that its even doing that, my tests give me an sql error
when i do that sort of syntax.

What you could be doing is using something along the lines of
mysql_secape_stiring().
http://us3.php.net/manual/en/functio...ape-string.php

the DB Module may be the culprit, but idk. Seems kinda weird that you
would get that imo.

Jan 9 '07 #2
On Mon, 08 Jan 2007 13:20:34 -0500, Paul wrote:
I have tested my logic flow and determined that the conversion from what is
given to the
$db->prepare() statement and what is stored in the database iteslf goes
from:

"I'm helpful"
to
"I'm helpful"

is converted by pear's DB. I am using $db->prepare() statement. When I do
a print_r() of $db after the prepare(), it does display:
...., field2 = 'I'm helpful', field3=....

but what ends up in the database is:
"I'm helpful"

I'm using PHP 4.3 and have tried html_entity_decode() and others
unsuccessfully.

Any ideas?
That certainly doesn't seem like something DB would or should do. Can you
tell me exactly what version of PHP and DB you have installed, please,
along with the DB driver you're using (pgsql, oci8, etc)?

Thanks,

Adam (PEAR DB maintainer)

Jan 9 '07 #3
In article <8X*******************@bignews1.bellsouth.net>, Paul
<lo*@invalid.comwrote:
I have tested my logic flow and determined that the conversion from what is
given to the
$db->prepare() statement and what is stored in the database iteslf goes
from:

"I'm helpful"
to
"I'm helpful"

is converted by pear's DB. I am using $db->prepare() statement. When I do
a print_r() of $db after the prepare(), it does display:
...., field2 = 'I'm helpful', field3=....

but what ends up in the database is:
"I'm helpful"

I'm using PHP 4.3 and have tried html_entity_decode() and others
unsuccessfully.

Any ideas?
Maybe something like this?

<?php
$encoded = "hello
world";
echo preg_replace('/&#(\d+);/e','chr(\1)', $encoded);
?>

--
Koncept <<
"The snake that cannot shed its skin perishes. So do the spirits who are
prevented from changing their opinions; they cease to be a spirit." -Nietzsche
Jan 9 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: hunterb | last post by:
I have a file which has no BOM and contains mostly single byte chars. There are numerous double byte chars (Japanese) which appear throughout. I need to take the resulting Unicode and store it in a...
3
by: Caesar Augustus | last post by:
Hello Tom, Long time listener, first time caller... I have been working with vb code to automate a salary increase process that not only rounds to the nearest penny but also rounds to the...
0
by: gauravkhanna | last post by:
Hi All I need some help for the below problem: Scenario We need to send large binary files (audio file of about 10 MB or so) from the client machine (.Net Windows based application, located...
2
by: Matt | last post by:
I'm pulling a few records from a table and writing them to a databound dropdown. I use: if ispostback = false then bindcontrols() end if to make sure that it retains the selected value...
1
by: John | last post by:
Hi I am using and access datetime field to store both date & time. How can I split it into date & time after reading the field and then combine the date & time back into datetime when storing...
5
by: Mark | last post by:
I have a field that has been formatted using the vb.net FormatCurrency method. Now, I need to get the amount back into a regular field so I can use it for calculations. Is there an easy way to...
3
dotneto
by: dotneto | last post by:
Hi, There is a strange behaviour with ie7 and browsing history. In a page (aspx), the user can download a file. If he navigates back from that page, the page is lost(from browsing history), an...
1
by: nerurmon | last post by:
Hi, i am new in Visual Studio 2005. I want to connect with my database which in access 2000. i want to know the connection string by using ADOBD.Connection and another thing is i make a...
2
by: KYG | last post by:
Hi , I'm trying to design and build a web app (my first C++ app) using the WT C++ web toolkit. Been looking for a way to read an MS Word doc into a 'stream?' and manipulate (search, copy/ delete...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.