answersLogoWhite

0


Best Answer

<?php

// Connect to the database

$link = mysql_connect('localhost', 'mysql_user', 'mysql_password') or die('Could not connect: ' . mysql_error());

mysql_select_db('foo', $link) or die('Can\'t use foo : ' . mysql_error());

// Retrieve the content

$sql = "SELECT my_info FROM my_table WHERE id = '42';

$result = mysql_query($sql,$link);

// Now assign a value

$row = mysql_fetch_assoc($result);

// "Wrap" the result in a textarea

echo '<textarea name="bob" rows="10" cols="40">';

echo $row["my_info"];

echo '</textarea>';

?>

... this will work for a single value retrieved from a single row. For a more in depth look at retrieving values from a DB visit:

http://au2.php.net/manual/en/function.mysql-query.php

For a complete textarea reference, visit:

http://www.w3schools.com/tags/tag_textarea.asp

Hope that helps

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

AnswerBot

3w ago

You can retrieve data from a database and display it in a textarea using PHP by executing a query to fetch the data from the database, then echoing the retrieved data within the value attribute of the textarea element. Make sure to properly sanitize the data to prevent SQL injection or other security vulnerabilities.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you retrieve data stored in the database into the textarea using PHP?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Information Science

How do you retrieve data stored in the database into the textarea using ASP?

To retrieve data stored in a database and display it in a textarea using ASP, you can use a server-side script to query the database and fetch the data. Then, you can populate the value of the textarea with the retrieved data by echoing it within the textarea tag during the rendering of the page.


How do you store and retrieve a picture in sybase database?

To store a picture in a Sybase database, you can use a BLOB (Binary Large Object) data type column in a table. You can insert the picture into this column using SQL commands or through an application that interacts with the database. To retrieve the picture, you can query the column where the picture is stored and then display or use the binary data as needed.


What is the purpose of a query in a database?

The purpose of a query in a database is to retrieve specific information that meets certain criteria. Queries allow users to search, filter, and extract data from databases based on their requirements, enabling them to retrieve only the relevant information they need.


What is the purpose of the SLQ database?

SQL (Structured Query Language) is a programming language used in database management to manipulate and retrieve information. Its purpose is to interact with relational databases, allowing users to create, modify, query, and manage data efficiently. SQL is widely used in various applications and systems to store and retrieve data in a structured manner.


What is database searching?

Database searching is the process of querying a database to retrieve specific information. It involves formulating a search query using keywords or filters, and then executing the query to retrieve relevant data. This is commonly used in various fields, such as research, business, and information retrieval.

Related questions

How do you retrieve data stored in the database into the textarea using ASP?

To retrieve data stored in a database and display it in a textarea using ASP, you can use a server-side script to query the database and fetch the data. Then, you can populate the value of the textarea with the retrieved data by echoing it within the textarea tag during the rendering of the page.


How do you retrieve the data from database?

To retrieve data rfrom a mysql database you first need to connect to the database using the mysql connection string(mysql_connect) after that, it's just a matter of executing a query of "SELECT `field1`, `field2` FROM `tablename`" Obviously replacing field 1 and 2 with the fields you want to replace and tablename with the table the data is stored


How do you store and retrieve a picture in sybase database?

To store a picture in a Sybase database, you can use a BLOB (Binary Large Object) data type column in a table. You can insert the picture into this column using SQL commands or through an application that interacts with the database. To retrieve the picture, you can query the column where the picture is stored and then display or use the binary data as needed.


What is the purpose of a query in a database?

The purpose of a query in a database is to retrieve specific information that meets certain criteria. Queries allow users to search, filter, and extract data from databases based on their requirements, enabling them to retrieve only the relevant information they need.


What is the purpose of the SLQ database?

SQL (Structured Query Language) is a programming language used in database management to manipulate and retrieve information. Its purpose is to interact with relational databases, allowing users to create, modify, query, and manage data efficiently. SQL is widely used in various applications and systems to store and retrieve data in a structured manner.


How do you save voice in database access?

I don't know but i need that information about how to store a voice as input for sql server 2005 and retrieve that using current input of voice.., I mean how two compare a already stored voice in database with given new input voice..,


What software tool can be used to create a database add change and delete data in the database sort and retrieve data and create forms and reports using the data in the database?

datebase management system


How do you print using the Rollmaster software?

First you have to retrieve the data from the database by using the 'records view', 'Query' or 'report' menus. Then select print.


What is database searching?

Database searching is the process of querying a database to retrieve specific information. It involves formulating a search query using keywords or filters, and then executing the query to retrieve relevant data. This is commonly used in various fields, such as research, business, and information retrieval.


What is database query?

A database "query" is basically a "question" that you ask the database. The results of the query is the information that is returned by the database management system. Queries are usually constructed using SQL (structured query language) which resembles a high-level programming language.


How to display contents of txt file on webpage using javascript?

Insert this code into HTML &lt;textarea name="textfield" cols="30" rows="30"&gt;YOUR txt file &lt;/textarea&gt;


How do you store pdf file to database using PHP?

Files cannot be directly stored in a MySQL database. However, a path to the file or the contents of the file can.