i'm trying to extract the value of a field and print its into a textarea.
i have some articles into DB .
i extract the titles of the articles:
Code: Select all
<?php
include("dbconnect.php");
$query = "SELECT titolo_studio FROM studi ";
$result = mysql_query($query) or die(mysql_error());
while(list($data) = mysql_fetch_row($result)) {
echo "
<a href="lista_campi.php?id_studio=$data">$data</a>
";
}
?>Code: Select all
<?php
$name = $_GET['id_studio'];
$connect = mysql_connect('localhost', 'root', '');
$fields = mysql_list_fields("glocal", "studi", $connect);
$column = mysql_num_fields($fields);
for ($i = 6; $i < $column; $i++) {
$campo=mysql_field_name($fields, $i);
echo "<a href='change_dati.php?id_studio=$name&campo=$campo'>$campo<br />\n";
}
?>but it doesn't work. i have textarea, but just a "<br />" inside.
Code: Select all
<?php
include("dbconnect.php");
$table = "studi";
$result = mysql_query("SELECT '" . $_REQUEST["campo"] . "' FROM $table")or die(mysql_error());
for ($i=0; $i<mysql_num_rows($result); $i++)
?>
<br><input type='text' name='<? echo "text".$i ?>' value='<? echo mysql_result($result,$i,$campo) ?>'>thanks!