473,396 Members | 1,858 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,396 software developers and data experts.

how to make it appear in mulit line like as in database

1
I used

Expand|Select|Wrap|Line Numbers
  1. <textarea name="question" class="input" width="250"></textarea>
to add data in sql. i used multi line , in database also data is stored in multi line only.

Then i used
Expand|Select|Wrap|Line Numbers
  1. $question=$row['1'];
  2. echo "<tr><td colspan='5'>",$row[1],"</td></tr>
to display the data but the data is displaying in single line.

How do I make it appear in multiple lines like as in database?
Jul 27 '12 #1
9 1887
Claus Mygind
571 512MB
well for one thing you need to use periods . instead of comma , to concatenate your string like this:

wrong way
echo "<tr><td colspan='5'>",$row['1'],"</td></tr>";

right way
echo "<tr><td colspan='5'>".$row['1']."</td></tr>";

also how much text are you displaying. Here you are spanning 5 columns. Is the text you are streaming out longer than the width of the 5 columns?
Jul 27 '12 #2
computerfox
276 100+
Are you trying to print out all the data returned by mysql?

What I normall do is:

Expand|Select|Wrap|Line Numbers
  1.  
  2. <?php
  3.   $getter=mysql_query();  //Query to grab all needed data
  4.   while($info=mysql_fetch_assoc($getter)){
  5.          //Print data
  6.          //At this point, you can break the php and just use regular HTML
  7.         //Note: when you want to print the data, you have to re-enter PHP
  8.        //Note: you never HAVE to stay in pure PHP
  9.  }
  10.  
  11. ?>
  12.  
Jul 30 '12 #3
Dormilich
8,658 Expert Mod 8TB
wrong way
echo "<tr><td colspan='5'>",$row['1'],"</td></tr>";
that’s actually a right way, works as well as concatenation.


//Note: you never HAVE to stay in pure PHP
but you should. breaking in and out of one language is bound to create confusion very very fast.
Jul 30 '12 #4
wrong way
echo "<tr><td colspan='5'>",$row['1'],"</td></tr>";
Claus Mygind why wrong this way?

This is true in fact the use of...
Jul 30 '12 #5
Claus Mygind
571 512MB
Murat Bastas - Then what is the correct answer to dhivya question?
Jul 31 '12 #6
Dormilich
8,658 Expert Mod 8TB
Although I’m not Murat Bastas, I hazard a guess at nl2br().
Jul 31 '12 #7
Php - Wordwrap() function , You need this.

Claus Mygind, my answer to that right?
Jul 31 '12 #8
nl2br function will work.
Jul 31 '12 #9
Dormilich
8,658 Expert Mod 8TB
well, it seems like the line breaks are already there, they just don’t behave like they are assumed to do (because they follow the specification).

@Murat: you don’t need to quote me every time.
Jul 31 '12 #10

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

Similar topics

1
by: smilnet | last post by:
I want to Make a Draw Line Contrls,Please Help me Thanks!
4
by: Digital Fart | last post by:
howto make a connection to database available in my classes. What is the best practice when i want to write classes that need a connection to the database? Do i make a conn variable in my...
2
by: Jeronimo Bertran | last post by:
Hi, I have a database record with a very large number of fields that need to be entered so I need to write a data entry site using asp.net that will divide the fields into multiple pages. Once...
1
by: Marc Eggenberger | last post by:
Hi there .. I have the following scenario. I have a Webservice which is running under Win2003/IIS6 with .Net1.1 The Service itselfs connects to a database which is a SQL 2000 on a Server in...
2
by: RC | last post by:
By default PHP always supports MySQL. But all our database servers are PostgreSQL or Informix. Order for me get PHP supports other than MySQL. I need download PHP source codes and compiled it...
1
by: MMA | last post by:
Can an WBA/XBAP directly make a call to database server or does it need to go through the WS? Thanks in Advanec
1
by: Dave Programmer | last post by:
In a Makefile, I have something like the following: # makefile start X = "default_x" Y = "default_y" targA: dosomething -x $(X) -y $(Y)
2
by: Brian Kendig | last post by:
I'm trying to make a web page with a restaurant menu on it. Each line on the menu is the name of a dish (left-justified) and that dish's price (right-justified), with a dotted line between them....
2
by: puT3 | last post by:
Hi, anyone can help me? My problem is data from Form of Asp does not appear in access database when i open the database. Why does this happen? My table name:Cuba ID PK Nama Umur
48
by: Scott Deming | last post by:
Ok here's the deal. I'm in Afghanistan and attempting to create an Access database for my pilot's to debrief on when they come back from a mission. Included fields would be things like names,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
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...
0
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,...

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.