westmatrix99 Posted August 2, 2007 Share Posted August 2, 2007 How do I break up this: <?php echo ($row_rsabout['about']); ?> into seperate tables like the nl2br option in PHP <?php echo nl2br("LINE ONE\n LINE TWO"); ?> Cheers West Quote Link to comment https://forums.phpfreaks.com/topic/63027-solved-how-do-i-break-up-using-nl2br/ Share on other sites More sharing options...
Vizor Posted August 2, 2007 Share Posted August 2, 2007 explode()? Quote Link to comment https://forums.phpfreaks.com/topic/63027-solved-how-do-i-break-up-using-nl2br/#findComment-313878 Share on other sites More sharing options...
westmatrix99 Posted August 2, 2007 Author Share Posted August 2, 2007 Explode what? Quote Link to comment https://forums.phpfreaks.com/topic/63027-solved-how-do-i-break-up-using-nl2br/#findComment-313880 Share on other sites More sharing options...
mrjcfreak Posted August 2, 2007 Share Posted August 2, 2007 Please can you explain what you're trying to do. The nl2br function doesn't add tables, it merely replaces \n with \n<br />. Which functions you need would depend on what $row_rsabout['about'] is: is it a string? An array? An object? xml? Quote Link to comment https://forums.phpfreaks.com/topic/63027-solved-how-do-i-break-up-using-nl2br/#findComment-313881 Share on other sites More sharing options...
HaLo2FrEeEk Posted August 2, 2007 Share Posted August 2, 2007 What is contained in $row_rsabout['about']? What data? Are there \n's or < br />'s? Well, whatever, you can use explode like the guy above said to break a line up into array values by using key strings, for example, this string: $string = "Hello world, I am the coolest program ever!"; if applied into the explode function like so: $array = explode(" ", $string); Would look like this upon doing print_r($array): Array ( [0] => Hello [1] => world, [2] => I [3] => am [4] => the [5] => coolest [6] => program [7] => ever! ) It would break the string up by spaces. Make sense? Quote Link to comment https://forums.phpfreaks.com/topic/63027-solved-how-do-i-break-up-using-nl2br/#findComment-313884 Share on other sites More sharing options...
westmatrix99 Posted August 2, 2007 Author Share Posted August 2, 2007 I have a table called about with: ID => INT about => TEXT I need the record <?php echo ($row_rsabout['about']); ?> to be broken up in different tables as I have on my page. So if I have three tables then the record must span across all three. Hope that makes more sense? Quote Link to comment https://forums.phpfreaks.com/topic/63027-solved-how-do-i-break-up-using-nl2br/#findComment-313885 Share on other sites More sharing options...
mrjcfreak Posted August 2, 2007 Share Posted August 2, 2007 Nope. Please can you post your entire script. Also; are you talking about producing a HTML table? Quote Link to comment https://forums.phpfreaks.com/topic/63027-solved-how-do-i-break-up-using-nl2br/#findComment-313890 Share on other sites More sharing options...
wildteen88 Posted August 2, 2007 Share Posted August 2, 2007 How is the tables laid out. Could you provide some example html or a simple image of what you mean. Quote Link to comment https://forums.phpfreaks.com/topic/63027-solved-how-do-i-break-up-using-nl2br/#findComment-313892 Share on other sites More sharing options...
westmatrix99 Posted August 2, 2007 Author Share Posted August 2, 2007 Here is the link to the HTML no Database yet to show you what it looks like. http://www.mantisdesign.co.za/aidapersianclairvoyant/ Quote Link to comment https://forums.phpfreaks.com/topic/63027-solved-how-do-i-break-up-using-nl2br/#findComment-313901 Share on other sites More sharing options...
wildteen88 Posted August 2, 2007 Share Posted August 2, 2007 OK... and where do you want the data to be shown when you get it from the database? Can you highlight it on the page. Quote Link to comment https://forums.phpfreaks.com/topic/63027-solved-how-do-i-break-up-using-nl2br/#findComment-313909 Share on other sites More sharing options...
westmatrix99 Posted August 2, 2007 Author Share Posted August 2, 2007 Ok each table is broken up already using the normal or standard HMTL table option The data is in each table but not from the database. I would need the data from the database table to be broken up into the different tables. The home page is fine, it's the others that I will have this problem with. Table1 Data from the same record Table2 rest of the data from the same record My option that will work but is irritating: The other option is to have the administration panel have the different textboxes for each table of data. That way the records would be seperated easier Quote Link to comment https://forums.phpfreaks.com/topic/63027-solved-how-do-i-break-up-using-nl2br/#findComment-313915 Share on other sites More sharing options...
westmatrix99 Posted August 2, 2007 Author Share Posted August 2, 2007 I hope that makes sense? All I would like to do is break up the text as needed dynamically as per table needed? Cheers West Quote Link to comment https://forums.phpfreaks.com/topic/63027-solved-how-do-i-break-up-using-nl2br/#findComment-313924 Share on other sites More sharing options...
wildteen88 Posted August 2, 2007 Share Posted August 2, 2007 Oh you want to create the HTML for that page from the database. How is the $row_rsabout['about'] created what data does it hold. It might be helpful if you could post more code. Quote Link to comment https://forums.phpfreaks.com/topic/63027-solved-how-do-i-break-up-using-nl2br/#findComment-313926 Share on other sites More sharing options...
westmatrix99 Posted August 2, 2007 Author Share Posted August 2, 2007 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>TEST BREAK UP</title> </head> <body> <p>TABLE1</p> <table width="300" border="0" cellspacing="0" cellpadding="2"> <tr> <td><?php echo nl2br($row_rsabout['AboutUs']); ?></td> </tr> <tr> <td> </td> </tr> </table> <p>TABLE2</p> <table width="300" border="0" cellspacing="0" cellpadding="2"> <tr> <td><?php echo nl2br($row_rsabout['AboutUs']); ?></td> </tr> <tr> <td> </td> </tr> </table> <p>TABLE3</p> <table width="300" border="0" cellspacing="0" cellpadding="2"> <tr> <td><?php echo nl2br($row_rsabout['AboutUs']); ?></td> </tr> <tr> <td> </td> </tr> </table> <p>THE END</p> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/63027-solved-how-do-i-break-up-using-nl2br/#findComment-313931 Share on other sites More sharing options...
westmatrix99 Posted August 2, 2007 Author Share Posted August 2, 2007 Oh you want to create the HTML for that page from the database. How is the $row_rsabout['about'] created what data does it hold. It might be helpful if you could post more code. The record "about" just holds demo data. Quote Link to comment https://forums.phpfreaks.com/topic/63027-solved-how-do-i-break-up-using-nl2br/#findComment-313932 Share on other sites More sharing options...
westmatrix99 Posted August 2, 2007 Author Share Posted August 2, 2007 Oh you want to create the HTML for that page from the database. How is the $row_rsabout['about'] created what data does it hold. It might be helpful if you could post more code. The record "about" just holds demo data. mysql_select_db($database_cnaida, $cnaida); $query_rsabout = "SELECT * FROM tblabout"; $rsabout = mysql_query($query_rsabout, $cnaida) or die(mysql_error()); $row_rsabout = mysql_fetch_assoc($rsabout); $totalRows_rsabout = mysql_num_rows($rsabout); Quote Link to comment https://forums.phpfreaks.com/topic/63027-solved-how-do-i-break-up-using-nl2br/#findComment-313935 Share on other sites More sharing options...
wildteen88 Posted August 2, 2007 Share Posted August 2, 2007 Oh you want to create the HTML for that page from the database. How is the $row_rsabout['about'] created what data does it hold. It might be helpful if you could post more code. The record "about" just holds demo data. By code I ment the code you currently have for pulling AboutUs outof the database. You'll need to use tihs code: <table width="300" border="0" cellspacing="0" cellpadding="2"> <tr> <td><?php echo nl2br($row_rsabout['AboutUs']); ?></td> </tr> <tr> <td> </td> </tr> </table> Within a while loop when you have ran your sql query. Quote Link to comment https://forums.phpfreaks.com/topic/63027-solved-how-do-i-break-up-using-nl2br/#findComment-313982 Share on other sites More sharing options...
westmatrix99 Posted August 2, 2007 Author Share Posted August 2, 2007 Thanks will play around. Cheers West Quote Link to comment https://forums.phpfreaks.com/topic/63027-solved-how-do-i-break-up-using-nl2br/#findComment-314049 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.