here is the full page code sorry its bit long but i have no clue where i went wrong
all i get when i run this is the page with its background and an empty text area

basicly i am trying to get the info from a table in my database and display them in an array into a text area

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Untitled Page</title>
<style type="text/css">
body
{
   background-color: #FFFFFF;
   background-image: url(images/backgroundlou.jpg);
   background-repeat: no-repeat;
   color: #000000;
}
a    
{    
   color: #0000FF;    
   text-decoration: underline;    
}    
a:visited    
{    
   color: #800080;    
}    
a:active    
{    
   color: #FF0000;    
}    
a:hover    
{    
   color: #0000FF;    
   text-decoration: underline;    
}    
#TextArea1
{
   border: 1px #C0C0C0 solid;
   background-color: #FFFFFF;
   color :#000000;
   font-family: Arial;
   font-size: 13px;    
   text-align: left;    
}    
</style>    
</head>    
<body>
<?php
// information pour la connection à le DB
$host = 'localhost';
$user = 'userd';
$pass = 'nopass';
$db = 'dbname';

// connection à la DB
$link = mysql_connect ($host,$user,$pass) or die ('Erreur : '.mysql_error() ) ;
mysql_select_db($db) or die ('Erreur :'.mysql_error()) ;

// requête SQL qui compte le nombre total d'enregistrements dans la table et qui
//récupère tous les enregistrements
$select = 'SELECT nom,continent,coord FROM test';
$result = mysql_query($select,$link) or die ('Erreur : '.mysql_error() );
$total = mysql_num_rows($result);    

// if result we display.
if($total) {    
echo '<textarea name="TextArea1" id="TextArea1" style="position:absolute;left:379px;top:190px;width:592px;height:266px;z-index:0;" rows="15" cols="93"> "\n";
        // première ligne on affiche les titres prénom et surnom dans 2 colonnes
       echo '<table>';
        echo '<tr>';
        echo '<td><b><u>Continent</u></b></td>';
        echo '<td> ><b><u>Coord</u></b></td>';
          echo '<td><b><u>Player</u></b></td>';
        echo '</tr>'."\n";
    // lecture et affichage des résultats sur 2 colonnes, 1 résultat par ligne.    
    while($row = mysql_fetch_array($result)) {
        echo '<tr>';
        echo '<td>'.$row['continent'].'</td>';
        echo '<td>'.$row['coord'].'</td>';
          echo '<td>'.$row['nom'].'</td>';
        echo '</tr>'."\n";
    }
    echo '</table>'."\n";
    }
else echo 'Pas d\'enregistrements dans cette table...';

// on libère le résultat
mysql_free_result($result);
?>
</body>
</html>

A text area cannot hold HTML content (the table), unless you escape it. What are you trying to achieve?

The <textarea> tag should be be ended with </textarea> end tag. Anything between these two tags gets displayed, but as a plain text. I believe the html code (the table in your case) will be displayed just as plain text and not formatted as a table.

i am trying to format the way its displayed in the text area i dont want to just have the raw data in there

Then you might want to use a rich text editor like TinyMCE. It converts your textareas (or other elements) to WYSIWYG editor so users can draw tables, use lists, change fonts, colors etc.

no i dont want my user to change the text area i want to format it but i guess ill have to find another way

Member Avatar for diafol

Do you really need a textarea if you don't want anybody to edit it?

You could create a div with a white background to make it look like a textarea if you really need to.

i wanted to use a text area cause i use a wysiwyg web builder for the site and wanted the text from the database to show up exactly where i wanted it but i needed to have it in a table so i ended up redoing the whole page manually instead

Member Avatar for diafol

I can't see why you didn't use a wysiwyg editor then - Like TinyMCE, CKEditor or Spaw2 or myriad others. broj1 suggested as much.

found a way to solve my probleme i was able to insert my code in the html page and make the table appear where i wanted

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.