# Database and textarea help :(

**URL:** <https://forum.kirupa.com/t/database-and-textarea-help/228204>\
**Category:** programming\
**Created:** [June 6, 2007, 4:30am UTC](https://forum.kirupa.com/t/database-and-textarea-help/228204 "2007-06-06T04:30:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robin105](https://avatars.discourse-cdn.com/v4/letter/r/5e9695/32.png) [@Robin105](https://forum.kirupa.com/u/Robin105)\
**Post date:** [June 6, 2007, 4:30am UTC](https://forum.kirupa.com/t/database-and-textarea-help/228204/1 "2007-06-06T04:30:34Z")

</div>

I am trying to make a editable website, so I was making the textarea to edit the database …  
But its not working :’( heres the script :’(

```auto
<html><head></head><body>

<form action="Editnote.php" method="post">
<textarea name="newdata" rows="10" WRAP=HARD cols="50" width="95" height="300px" style="width:95%;height:300px">
<?php
    //NEW
    $con = mysql_connect("localhost",YYY","ZZZ");
    if (!$con)
    {
    die('Could not connect: ' . mysql_error());
    }

    mysql_select_db("32711", $con);

    $result = mysql_query("SELECT * FROM Robin105editor");

    while($row = mysql_fetch_array($result))
    {
    echo $row['Notepad'];
    }
    mysql_close($con);
    ?>
</textarea>
<br>

<textarea name="olddata" rows="10" cols="10" >
    <?php
    //NEW
    $con = mysql_connect("localhost","YYY","ZZZ");
    if (!$con)
    {
    die('Could not connect: ' . mysql_error());
    }

    mysql_select_db("32711", $con);

    $result = mysql_query("SELECT * FROM Robin105editor");

    while($row = mysql_fetch_array($result))
    {
    echo $row['Notepad'];
    }
    mysql_close($con);
    ?>
    </textarea>
<input type="submit">
</form>
</body></html>

```

Heres Editnote.php

```auto
    <html><head></head><body>
 
  <?php
  $old = $_POST['olddata'];
  $new = $_POST['newdata'];

 $con = mysql_connect("localhost","YYY","ZZZ");
 if (!$con) {
    die('Could not connect: ' . mysql_error());
  }
    
 mysql_select_db("32711", $con);
 
 mysql_query("UPDATE `Robin105editor` SET `Notepad`='$new' WHERE `Notepad`='$old'");
  
 mysql_close($con);
 ?>
 
 </body></html>

```
