Jump to content

[SOLVED] Database Display


maliary

Recommended Posts

 

 

Hi guys,

 

I've the following information that I retrive from the database :

 

1.The little fox jumped over a green hedge.2.The hare ate fish.3.The little fox jumped over a green hedge

4.Alligator jumped  a green hedge.5.The little fox jumped over a green hedge

 

How would I display it thus :

1.The little fox jumped over a green hedge

2.The hare ate fish

3.The little fox jumped over a green hedge

4.Alligator jumped  a green hedge.

5.The little fox jumped over a green hedge

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/59783-solved-database-display/
Share on other sites

or

<?php
$string = "1.The little fox jumped over a green hedge.2.The hare ate fish.3.The little fox jumped over a green hedge4.Alligator jumped  a green hedge.5.The little fox jumped over a green hedge";
print $result = preg_replace('/(?<=.+)(\d\.)/i', "\r\n\$1", $string);
?>

Ok,

 

        The notes field in the database is of datatype text.

 

          $depts = $db->Execute("SELECT * FROM test_find WHERE job_id='$batch_nr'");               

          while($row= $depts->FetchRow()){

 

          $notes = $row['notes'];       

            }

 

    <td><?php echo $notes; ?></td>

  This gives the following out put :

 

1.The little fox jumped over a green hedge.2.The hare ate fish.3.The little fox jumped over a green hedge

4.Alligator jumped  a green hedge.5.The little fox jumped over a green hedge

 

 

try

<?php
          $depts = $db->Execute("SELECT * FROM test_find WHERE job_id='$batch_nr'");                 
          while($row= $depts->FetchRow()){

          $notes = $row['notes']."<br>";         
             }
?>
    <td><?php echo $notes; ?></td> 

This should be fine..

 

define "jumbled up"..

 

try

<?php
          $depts = $db->Execute("SELECT * FROM test_find WHERE job_id='$batch_nr'");                 
          while($row= $depts->FetchRow()){

          $notes = $row['notes']."<br>";         
             }
?>
    <td><?php echo $notes; ?></td> 

 

 

maybe a more complete code!?

 

ie the full table setup (HTML table)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.