Ciao a tutti
ho una tabella così composta:
Id | a | b | c | d |......con 50 campi
con due form vorrei estrarre il valore dell' Id 10 nel campo 45 come posso fare?
Sono riuscito a fare la selezione per l'id ma non quella per il campo. Vi posto il codice.
Codice PHP:
<div align="left"></div>
<form method= "post" action="2test.php">
<td width="150"><div align="center" class="style8">[b]<font size="2">ID</font> </div></td>
<td width="150"><div align="center" class="style8">[b]<font size="2">PROVE</font></div></td>
<tr>
<td><div align="center">
<input type= "text" name="Id" size="20">
</div></td>
<td><div align="center">
<input type= "text" name="Prova" size="20">
</div></td>
</tr>
<tr><input type="submit" name="Submit" value="CERCA" /></tr>
<hr width="900">
<?php
$Id = $_REQUEST["Id"];
$Prova = $_REQUEST["Prova"];
?>
<table width="870" border= "1" align="center">
<tr>
<td width="50" bgcolor="#E1EBBB"><div align="center"><font color="#000066">[b]ID [/b]</font></div></td>
<td width="200" bgcolor="#E1EBBB"><div align="center"><font color="#000066">[b]PROVA[/b]</font></div></td>
</tr>
<?php
$db = mysql_connect("localhost","root","");
mysql_select_db("test", $db);
function getQuery($Id, $Prova) {
$query = "SELECT * FROM salti WHERE ";
if (!empty($Id)) {
$query .= "Id LIKE '$Id' AND ";
}
$query .= "1 = 1";
return $query;
}
$result = mysql_query(getQuery($Id, $Prova), $db) or die ("Errore: ".mysql_error());
while($myrow=mysql_fetch_array($result))
echo <<<EOF
<td>[url="apri_dettagli.php?ID=$myrow[Id]"]$myrow[Id][/url]</td>
<td>$myrow[Prova]</td>
</tr>
EOF;
?>
Grazie