Re: textarea and mysql query

From: Date: Mon, 18 Mar 2002 19:25:11 +0000
Subject: Re: textarea and mysql query
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-17743@lists.php.net to get a copy of this message
"jas" <jlgerfen@hotmail.com> wrote in message news:20020318184729.98395.qmail@pb1.pair.com... > I need some help with a query to place the results within a text area... > here is the code and so far every time I try it out all that happens is it > displays the textbox but not the results of the query. > <form name="wel_area" method="post" action="index_confirm.php3 target="box"> > <?php > $record = mysql_fetch_array(@mysql_query("SELECT wel_area FROM > cm_index",$dbh)); > echo "<textarea name='wel_area' > value='{$record['wel_area']}' cols='25' > rows='8'></textarea><br><input type='submit' > name='save' > value='save'><br>\n"; > ?> > </form> > Any help would be great. > Jas > If the "wel_area" is a TEXT field in the database, why the array treatment. I have a database that contains several TEXT fields that I can call up and edit. To do that I bring the data into a textarea. Here's part of my code: The SQL query: $sql = "SELECT subj, body, info, fname, lname, title, city, other, record_date, status, batch, modified_by FROM $table_name WHERE id = '$id' "; The results are read into variables: while ($row = mysql_fetch_array($result)) { $subj = $row['subj']; $body = $row['body']; $info = $row['info']; $fname = $row['fname']; $lname = $row['lname']; $title = $row['title']; $city = $row['city']; $other = $row['other']; $record_date = $row['record_date']; $status = $row['status']; $batch = $row['batch']; $modified_by = $row['modified_by']; } #end while In the body of the HTML section I have areas such as this: <td> <textarea cols="60" rows="20" name="body" wrap="soft"> <? echo "$body"; ?></textarea> </td> This creates an editable TEXTAREA that can then be UPDATEd in the database. John Hughes

« previous php.db (#17743) next »