Good morning.
I created an edit_task page that allows the user to edit tasks for the
database. I entered some text and used some hard returns.
Put when I went to view the tasks (using a PHP script if it matters),
the hard returns didn't "take." None of em. All of the text is
jumbled together.
Well I checked within the MySQL database just now (before uploading
this message) and noticed the Hard Returns show in the database (at
least while using phpMyAdmin).
Must have something to do with PHP? Where did I go wrong???
Thanks.
--Ward 9 1441
ward@ wrote: Good morning.
I created an edit_task page that allows the user to edit tasks for the database. I entered some text and used some hard returns.
Put when I went to view the tasks (using a PHP script if it matters), the hard returns didn't "take." None of em. All of the text is jumbled together.
Well I checked within the MySQL database just now (before uploading this message) and noticed the Hard Returns show in the database (at least while using phpMyAdmin).
Must have something to do with PHP? Where did I go wrong???
Thanks.
--Ward
What are you using to view the data? A browser or a terminal session?
If a browser, are your 'hard returns' coded as <br> or <br/>?
If a terminal session, are your 'hard returns' coded as \r\n or just \n?
-david-
David, thank you for asking.
I'm using MSIE 6.x to view.
I'm not sure if we're on the same page. I know about using <BR> and
<br/> within the browser (if we're talking about the same thing) but
it's the output from the database that isn't working. Somehere
between the database and output using PHP I loose the hard returns.
For example, if I was to enter...
Topic A
Now is the time for all men
to come to the aid of their nation.
That's who it would show up in the database, but trying to output it
into my page it'll look like...
Topic A Now is the time for all men to
come to the aid of their nation.
I hope that helps.
Ward
On Wed, 01 Mar 2006 09:05:09 -0500, David Haynes
<da***********@ sympatico.ca> wrote: ward@ wrote: Good morning.
I created an edit_task page that allows the user to edit tasks for the database. I entered some text and used some hard returns.
Put when I went to view the tasks (using a PHP script if it matters), the hard returns didn't "take." None of em. All of the text is jumbled together.
Well I checked within the MySQL database just now (before uploading this message) and noticed the Hard Returns show in the database (at least while using phpMyAdmin).
Must have something to do with PHP? Where did I go wrong???
Thanks.
--Ward What are you using to view the data? A browser or a terminal session? If a browser, are your 'hard returns' coded as <br> or <br/>? If a terminal session, are your 'hard returns' coded as \r\n or just \n?
-david-
ward@ wrote: Good morning.
I created an edit_task page that allows the user to edit tasks for the database. I entered some text and used some hard returns.
Put when I went to view the tasks (using a PHP script if it matters), the hard returns didn't "take." None of em. All of the text is jumbled together.
Well I checked within the MySQL database just now (before uploading this message) and noticed the Hard Returns show in the database (at least while using phpMyAdmin).
Must have something to do with PHP? Where did I go wrong???
Thanks.
--Ward
before printing the results from the DB, you should call nl2br() (
NewLine To Break )
print nl2br( $result['text'] );
More info at http://php.net/nl2br
Frizzle.
ward@ wrote: David, thank you for asking.
I'm using MSIE 6.x to view.
I'm not sure if we're on the same page. I know about using <BR> and <br/> within the browser (if we're talking about the same thing) but it's the output from the database that isn't working. Somehere between the database and output using PHP I loose the hard returns.
For example, if I was to enter...
Topic A
Now is the time for all men
to come to the aid of their nation.
That's who it would show up in the database, but trying to output it into my page it'll look like...
Topic A Now is the time for all men to come to the aid of their nation.
I hope that helps.
Ward
On Wed, 01 Mar 2006 09:05:09 -0500, David Haynes <da***********@ sympatico.ca> wrote:
ward@ wrote:
Good morning.
I created an edit_task page that allows the user to edit tasks for the database. I entered some text and used some hard returns.
Put when I went to view the tasks (using a PHP script if it matters), the hard returns didn't "take." None of em. All of the text is jumbled together.
Well I checked within the MySQL database just now (before uploading this message) and noticed the Hard Returns show in the database (at least while using phpMyAdmin).
Must have something to do with PHP? Where did I go wrong???
Thanks.
--Ward
What are you using to view the data? A browser or a terminal session? If a browser, are your 'hard returns' coded as <br> or <br/>? If a terminal session, are your 'hard returns' coded as \r\n or just \n?
-david-
Ward,
Look at the source code for your page. You'll see your newlines there.
And the browser is completely free to ignore them.
If you want newline characters, you need to use <br>. Check out nl2br().
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attgl obal.net
=============== ===
On 1 Mar 2006 06:22:40 -0800, "frizzle" <ph********@gma il.com> wrote: before printing the results from the DB, you should call nl2br() ( NewLine To Break )
print nl2br( $result['text'] );
More info at http://php.net/nl2br
Frizzle.
I'll visit the link, thanks.
I looked at the source of the output page. And the breaks are there
including new lines and spaces between new lines.
BTW, what are the technical terms for...
Topic A
This is topic A <--- new line but no space (I guess like <BR>)
and
Topic A
<--- new line and space (I guess like <p>)
This is topic A.
So I guess a question is, what is stored to represent a new line AND a
new line with a space.
I guess it's \n for a new line but is it \n\n for a space?
Ok, the next question is, where do I call this function?
On $result from $result = mysql_query ($query); // Run the query.
or
somewhere within this statement...
$bg = '#eeeeee'; // Set the background color.
while ($row = mysql_fetch_arr ay($result, MYSQL_ASSOC)) {
$bg = ($bg=='#eeeeee' ? '#ffffff' : '#eeeeee'); // Switch the
background color.
echo '<tr valign="top" bgcolor="' . $bg . '">
<td align="left"><a href="edit_task _v5.php?id=' .
$row['task_id'] . '">Edit</a></td>
<td align="left">' . $row['task_task_no'] . '</td>
<td align="left">' . $row['icaotask_no'] . '</td>
<td align="left">' . $row['task_usaction'] . '</td>
</tr>
';
Thanks.
Ward
As for an update...
Through trial-and-error, I've determined the following don't work...
Attempt 1:
nl2br($result) = mysql_query ($query); // Run the query.
Attempt 2:
$result = mysql_query ($query); // Run the query.
$result = nl2br($result)
Attempt 3:
$bg = '#eeeeee'; // Set the background color.
while ($row = mysql_fetch_arr ay($result, MYSQL_ASSOC)) {
$bg = ($bg=='#eeeeee' ? '#ffffff' : '#eeeeee'); // Switch the
background color.
echo nl2br( '<tr valign="top" bgcolor="' . $bg . '">
<td align="left"><a href=edit_task. php?id=' .
$row['task_id'] . '">Edit</a></td>
<td align="left">' . $row['task_task_no'] . '</td>
<td align="left">' . $row['icaotask_no'] . '</td>
<td align="left">' . $row['task_usaction'] . '</td>
</tr>
');
Now, attempt 3 kind of worked. It did insert the \n but it almost
doubled the size of the table. IOW, instead of 13 rows (the correct
number of rows), it stated the table off with 12 empty rows
(alternating between the two color shades) and then displayed the 13
correct rows.
Perhaps this was the proper placement of nl2br but there is something
in the other code that screwed up the presentation???
Thanks.
Ward
ward@ wrote: As for an update...
Through trial-and-error, I've determined the following don't work...
Attempt 1:
nl2br($result) = mysql_query ($query); // Run the query.
Attempt 2:
$result = mysql_query ($query); // Run the query. $result = nl2br($result)
Attempt 3:
$bg = '#eeeeee'; // Set the background color. while ($row = mysql_fetch_arr ay($result, MYSQL_ASSOC)) { $bg = ($bg=='#eeeeee' ? '#ffffff' : '#eeeeee'); // Switch the background color. echo nl2br( '<tr valign="top" bgcolor="' . $bg . '"> <td align="left"><a href=edit_task. php?id=' . $row['task_id'] . '">Edit</a></td> <td align="left">' . $row['task_task_no'] . '</td> <td align="left">' . $row['icaotask_no'] . '</td> <td align="left">' . $row['task_usaction'] . '</td>
</tr> ');
Now, attempt 3 kind of worked. It did insert the \n but it almost doubled the size of the table. IOW, instead of 13 rows (the correct number of rows), it stated the table off with 12 empty rows (alternating between the two color shades) and then displayed the 13 correct rows.
Perhaps this was the proper placement of nl2br but there is something in the other code that screwed up the presentation???
Thanks.
Ward
Ward,
Just use nl2br() on the data from the database which has newlines not
the entire table, i.e.
echo '<tr valign="top" bgcolor="' . $bg . '">
<td align="left"><a href=edit_task. php?id=' .
$row['task_id'] . '">Edit</a></td>
<td align="left">' . $row['task_task_no'] . '</td>
<td align="left">' . $row['icaotask_no'] . '</td>
<td align="left">' . nl2br($row['task_usaction']) . '</td>
</tr>';
if only $row['task_usaction'] has the newlines.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attgl obal.net
=============== ===
On Wed, 01 Mar 2006 11:40:45 -0500, Jerry Stuckle
<js*******@attg lobal.net> wrote:
Jerry, thank you.
I don't know why I didn't try that.
I get wrapped around the axle and don't see the trees from the forest.
IOW, I forgot that $row['task_usaction'] is the variable.
Anyhow, thanks again. Looks like I need to learn the very basics of
programming.
I may have another challange if you wish to take a looksee. It is
more complicated than this.
--Ward Ward,
Just use nl2br() on the data from the database which has newlines not the entire table, i.e.
echo '<tr valign="top" bgcolor="' . $bg . '"> <td align="left"><a href=edit_task. php?id=' . $row['task_id'] . '">Edit</a></td> <td align="left">' . $row['task_task_no'] . '</td> <td align="left">' . $row['icaotask_no'] . '</td> <td align="left">' . nl2br($row['task_usaction']) . '</td> </tr>';
if only $row['task_usaction'] has the newlines.
Just one point Ward, it is a good idea to use <br> or even better to
use <br />, that way your page is XHTML compliant. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ken |
last post by:
Hello,
I am trying to learn how to build a localizable windows application
and am having trouble getting alternate languages to display when if
stop hardcoding the culture settings. The line where I hard code the
CurrentUICulture is in the form's constructor and is like:
Thread.CurrentThread.CurrentUICulture = new CultureInfo("pt-BR");
When this line is present, the form displays in Portuguese.
|
by: Edwinah63 |
last post by:
Hi Everyone,
All the very best for 2004!!
i need urgent help with this problem, the users are about to skin me
alive!!
we have an access front end with linked to sql server 2k tables.
when a user tries to insert a record into one of the tables it
|
by: Markus Dehmann |
last post by:
My app reads some text files at runtime. The problem is where to find them.
In my project, we agreed to rather not define own environment variables.
But then, it's hard to know at runtime where the files are because that
changes with a "make install".
I kind of solved this by letting the Makefile generate a header file that
contains string variables with path information. The Makefile writes the
values into that header file. The only...
|
by: Xah Lee |
last post by:
The Harm of hard-wrapping Lines
20050222
Computing Folks of the industry:
please spread the debunking of the truncating line business of the
fucking unix-loving fuckheads, as outlines here:
http://xahlee.org/UnixResource_dir/writ/truncate_line.html
|
by: Brett |
last post by:
If I have many hard coded values such as file paths, file names, timeouts,
etc, where is the best place to define them? Meaning, in the case something
needs changing for example, rather than running down all the subs or
functions that may contain these values, I'd like one place to change them
and have that changed reflected in the subs or functions that use those
values. I'd like to avoid globals; keeping the values private to only those...
| |
by: william |
last post by:
My question is: Specific memory block where my pointer pointing to
changed strangely, seemingly that no statement changed it.
Here are two examples I got:
***********1*****************
I was about to read from a floppy image and build a tree for all the
directories and files.
My question is only about a small portion where I had debugging
problem, and I marked the place below at two places using
"<======================"(you can try to...
|
by: Rotsey |
last post by:
Hi,
I am writing an app that scans hard drives and logs info
about every fine on the drive.
The first iteration of my code used a class and a generic list
to store the data and rhis took 13min on my 60 GB drive.
I wanted it to be quicker.
|
by: Jared |
last post by:
Consider the following two functionally identical example queries:
Query 1:
DECLARE @Name VARCHAR(32)
SET @Name = 'Bob'
SELECT * FROM Employees
WHERE = CASE WHEN @Name IS NULL THEN ELSE @Name END
Query 2:
|
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...
|
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...
|
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...
| |
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
|
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...
| |