Current location: Hot Scripts Forums » Programming Languages » PHP » data problem


data problem

Reply
  #1 (permalink)  
Old 10-16-06, 05:13 AM
jonnekke jonnekke is offline
Code Guru
 
Join Date: Oct 2005
Location: holland!
Posts: 706
Thanks: 0
Thanked 0 Times in 0 Posts
data problem

Hi there,

got a data problem..
my data looks like:

Code:
this is the data 01. with the following line in it: we're having fun.
When this code is read by my php scrip only this part is visible:

Code:
this is the data 01. with the following line in it: we
I tried to solve it with:

PHP Code:

$begin ereg_replace('"',"'",$begin);

        
$begin ereg_replace('& # 3 9 ;',"'",$begin); 
($ # 3 9 ; is written with out the spaces off course..)

But that ain't working..
Reply With Quote
  #2 (permalink)  
Old 10-16-06, 05:16 AM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
did you try the function addslashes ?
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks

Reply With Quote
  #3 (permalink)  
Old 10-16-06, 06:58 AM
nova912's Avatar
nova912 nova912 is offline
Code Guru
 
Join Date: Sep 2004
Location: Traverse City, MI, USA
Posts: 821
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by jonnekke
Hi there,

got a data problem..
my data looks like:

Code:
this is the data 01. with the following line in it: we're having fun.
When this code is read by my php scrip only this part is visible:

Code:
this is the data 01. with the following line in it: we
I tried to solve it with:

PHP Code:

$begin ereg_replace('"',"'",$begin);

        
$begin ereg_replace('& # 3 9 ;',"'",$begin); 
($ # 3 9 ; is written with out the spaces off course..)

But that ain't working..
Maybe (and by PRCE is rusty) this will work for you... i think addslashes will fix this for you though.
PHP Code:

$begin preg_replace('(&)|(#)|(3)|(9)'"'"$begin); 

Reply With Quote
  #4 (permalink)  
Old 10-16-06, 05:31 PM
andersonwd andersonwd is offline
Newbie Coder
 
Join Date: May 2006
Location: Nashville, TN
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
I tried to solve it with:

PHP Code:

$begin ereg_replace('"',"'",$begin);

        
$begin ereg_replace('& # 3 9 ;',"'",$begin); 
($ # 3 9 ; is written with out the spaces off course..)

But that ain't working..
For a little less confusing code, you could use str_replace...

PHP Code:

$begin str_replace("\"","'",$begin); 

Or like the others have suggested, use addslashes:
PHP Code:

$begin addslashes($begin); 

__________________
Sherry
Nashville Web Development
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
datetime data type problem... Clark_Kent Database 2 10-07-06 11:16 AM
Problem getting data from DataGrid on update petersza ASP.NET 5 10-19-04 11:37 PM
problem printing mysql data by "x rows/page" abtimoteo PHP 1 07-30-04 07:55 PM


All times are GMT -5. The time now is 05:43 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.