473,785 Members | 2,798 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Memo multi lines replacement of 13 10 to \r\n

4 New Member
Hi,
How do I save multi lines to a mysql memo field replacing char 13 char 10
to '\r\n' instead ?. Example the memo is saved as 'string1<13><10 >string2'
instead of 'string1\r\nstr ing2'

The reason behind is to populate the mysql memo field to a html form field using a php module called from html as this:

<?
$s=trim($wg['MYSQL_MEMOFIEL D]);
echo "<script language='javas cript'>window.p arent.document. all['memo_fld'].innerText=".$s .";</script>";
?>

javascript aborts: unterminated string constant.

Is there is a better way to do the same please let me know. This code is called from a form button to fetch a table record.

Thanks in advanced.
Feb 10 '07 #1
2 2525
ronverdonk
4,258 Recognized Expert Specialist
In PHP you can replace strings using e.g. the preg_replace or the str_replace functions.
str_replace
(PHP 4, PHP 5)

str_replace — Replace all occurrences of the search string with the replacement string

Description
mixed str_replace ( mixed $search, mixed $replace, mixed $subject [, int &$count] )

This function returns a string or an array with all occurrences of search in subject replaced with the given replace value. If you don't need fancy replacing rules (like regular expressions), you should always use this function instead of ereg_replace() or preg_replace().

As of PHP 4.0.5, every parameter in str_replace() can be an array.
In this case it is easier (to code) the str_replace() to get what you want. So to replace the '13' and '10' literals you can use the following command:

[php]$output_string = str_replace(arr ay("13", "10"), array("\n", "\r"), $input_string);[/php]
Ronald :cool:
Feb 10 '07 #2
medaps
4 New Member
Thanks again.
It worked
Jose
Feb 10 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
6499
by: Jim Plante | last post by:
I have a memo field in a MS Access table. The contents of the field may look like this: 1. This is number one 2. This is number 2 3. Skipping lines is fun if your #3 But when I write it out to my web page using my ASP code {something like: rsJobs.Fields("notes") }
2
2329
by: Vincent Lau | last post by:
Hello, I'm new on ASP and Access. I stored several lines of information in a Access memo field. I use follow ASP response.write statement to display contain of the memo field. Response.Write sa1("job_detail") However, all the lines are mixed into one line. How can I show it in the original format?
8
17704
by: May | last post by:
Hi, My question is: How to concat values from several lines (the same column) to only one value. For example: We have table SGMENT with one column: NAME (varchar2(50)). We would like to have as a query result the concatenation of names. I mean, for example: SGMENT
1
3058
by: alexsg | last post by:
A little while ago Ron P kindly responded to my inquiry on how to copy the first line of memo field into a text field, using a query: left(,instr(1,,vbCrLf)-1) This is great, but I would like to do this on a form, so that the person entering the memo can use a button to paste the 1st line to a title (text) field. I'm having trouble setting up the code to do this. I'd also appreciate some ideas on how to get the 2nd and 3rd lines...
3
10018
by: Gillian Steele | last post by:
I'm trying to import data into a memo field by running an append query. The data is to be imported as if it was entered with separate lines in the memo field. I have tried inserting chr(13)s into the string that is being appended into the memo field but when appended, the data displays with a square box in place of a carriage return/line feed. I would like to import the data so that data is displayed in separate lines within the memo...
9
5740
by: RMC | last post by:
Hello, I'm looking for a way to parse/format a memo field within a report. The Access 2000 database (application) has an equipment table that holds a memo field. Within the report, the memo field is printed within the detailed area. The problem is, the apllication is not setup properly, thus the users are entering data within the memo field as: location1 1/1/2005 1/1/2006
3
20649
by: tjuiowa | last post by:
Hi I am trying to import a text file into a MS Access database. The first 11 lines of the text file are in a different format, so i would like to skip those lines and start at line 12. is there a quick and easy way to skip lines using VB in Access. Here is a sample of my text file: SDS 2.2 AD Results 1.0 Filename PlateID Assay Type
4
4346
by: Charles | last post by:
Hello, I'm trying to find a good program to use for editing memo fields in Access 2003. I'd love to use Notepad or Wordpad, but the only option I'm really finding is a program called Total Access Memo. All I'm looking to do is have a field for notes, and be able to add/edit the text - and be able to use the return key to add more lines, etc.without jumping to the next record. Can Access do this natively? TIA,
1
3380
by: todWulff | last post by:
Good day folks. Let me open with the statement that I am not a C++/C programmer. The environment that I am programming in is ARMbasic, an embedded BASIC targeted toward ARM-based micro-controllers. So why am I posting herein? Well, the ARMbasic environment makes use of a tool borrowed from your folk's environment - CPP. The build details are: C:\Program Files\Coridium>cpp --version cpp (GCC) 3.2.3 (mingw special 20030504-1) Copyright...
0
9481
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10336
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10155
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10095
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9953
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8978
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6741
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4054
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2881
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.