E' da qualche giorno che sto cercando di risolvere un problema...,...
devo aggiornare il record di una tabella mysql,... in base alle check box selezionate...
E' da qualche giorno che sto cercando di risolvere un problema...,...
devo aggiornare il record di una tabella mysql,... in base alle check box selezionate...
http://www.vincentandfrank.tk
si ma qual'è il tuo problema specifico?
prova a postare del codice![]()
Allora questo è il codice che uso nella pagina per fare la lista...
<?
include ('config.php');
include ('autenticato.php');
$query= "select ID,COD,NOME,COGNOME from tabella1 where startup ='0' and incarico='0' order by ID";
$result= mysql_query($query);
$numfields = mysql_num_fields($result);
echo "<center><form id='prensete' method='post' action='segna_presente.php'><table>\n<tr><td/><td>CODICE</TD><TD>NOME</TD><TD>COGNOME</TD></TR>";
//for ($i=0; $i < $numfields; $i++)
// {
// echo '<th>'.mysql_field_name($result, $i).'</th>';
// }
// echo "</tr>\n";
while ($row = mysql_fetch_row($result))
{
$conta++;
echo "<tr><td><input type='checkbox' name='chk".$row[0]."' value='1'></td><td>".$row[1]."</td><td>".$row[2]."</td><td>".$row[3]."</td></tr>";
}
echo "</table><input type='submit' value='Presenti'></form></center>\n";
?>
questa e la pagina segna_presente.php mi da errore nella line 6
<?
$conta=$_POST['presenti'];
for (i = 1; i <= $conta; i+=1) {
$ckbox.$i = $_POST['chk'.$i];
if($ckbox.$i == 1) {
$sql = "UPDATE tabella SET STARTUP = '1' WHERE ID ='$i'";
$result= mysql_query($sql);
}
}
?>
http://www.vincentandfrank.tk
mi da quest'errore
Parse error: syntax error, unexpected '=', expecting ';' in /home/visualba/public_html/ODC_CONTROLLO NOMITATiVI/segna_presente.php on line 6
http://www.vincentandfrank.tk
for (i = 1; i <= $conta; i+=1) {
i non è una variabile cosi..
for ($i = 1; $i <= $conta; $i+=1) {
ok adesso funziona... ma nn mi fa l'update nella tabella...
http://www.vincentandfrank.tk
Ho sostituito il codice precendente con questo
<?
include ("config.php");
$conta=$_POST['presenti'];
echo $conta;
for ($i = 1; $i <= $conta; $i+=1) {
$ckbox.$i = $_POST['chk'.$i];
if($ckbox.$i == 1) {
echo "
".$ckbox.$i;
$sql = "UPDATE odc SET STARTUP = '1' WHERE ID ='$i'";
$result= mysql_query($sql);
}
}
?>
adesso mi da quest'errore
Fatal error: Maximum execution time of 30 seconds exceeded in /home/visualba/public_html/ODC_CONTROLLO NOMITATiVI/segna_presente.php on line 12
http://www.vincentandfrank.tk