problema update sql

Bruce5000

Utente Attivo
14 Ott 2007
106
0
0
Ciao, ho questo script php, il mio problema è che non riesco a far aggiornare il database con update.
Potete aiutarmi?
Codice:
<?php
session_start();
ob_start();
include ("../connessione.php");
include ("funzioni.php");

if (isset($_SESSION['password']))
{
include("../connessione.php");

$userid=1;
if (isset($_GET['userid'])){
  $userid=$_GET['userid'];
}
$queryUtente=mysql_query("select * from webs_user where userID = ".$userid);
$utente=mysql_fetch_array($queryUtente);

<form name="post" action="veragestione.php?pagina=gestionenewsletter&paginanewsletter=nuovanewsletter" method="post" enctype="multipart/form-data"  onSubmit="return chkFormular()">
<input type="hidden" name="userid" value="<?=$userid?>">

<table align="left" width="200">
<tr bgcolor="#003366">
<td class="tahbol" width="120" align="center">Username</td>
<td class="tahbol" width="120" align="center">Nickname</td>
</tr>
<?php
$utenti=mysql_query("select * from webs_user order by nickname");
$giri=0;
while ($utente=mysql_fetch_array($utenti))
{
$giri++;

?>
<tr bgcolor="#e9e7e7">
<td class="tahnormal" width="120" align="left"><?php echo $utente['username']; ?></td>
<input type="hidden" name="<?=$utente['username']; ?>" value="<?=$utente['username']; ?>">
<td class="tahnormal" width="120"  align="left"><?php echo $utente['nickname']; ?></td>
<td class="tahnormal"><input type="checkbox" value="utente<?=$utente['userID']; ?>" name="utente<?=$utente['userID']; ?>"/></td>

</tr>
<?php
  
  }
?>


</table>

<table width="600px" border="0" cellspacing="1" cellpadding="2" class="tahbol" align="right">
    <tr bgcolor="#003366"> 
      <td align="center" class="tahbolb">INVIO NUOVA NEWSLETTER</td>
    </tr>
    
    <tr> 
      <td>
      </td>
    </tr>
    
    
    <tr>
      <td>
        <hr noshade size="1" color="#666666">
      </td>
    </tr>
    
    <tr>
      <td colspan="3">
        <table width="600px" border="0" cellspacing="0" cellpadding="2"  align="center">
          <tr> 
            <td align="center"><b>Rubrica: </b> 
            <select name="rubrica">
            <option value="logonewsletter" selected>Newsletter</option>
            <option value="logotnc">Redazione</option>
            </select>
              <b>
              Carica immagine
              </b>
              <input type="file" name="imgnewsletter" class="formbutton">
              <!--<b>
                Allineamento
              </b>
              <select name="alignimg">
              <option value="left" selected>Left</option>
              <option value="center">Center</option>
              <option value="right">Right</option>
              </select> 
     -->
            </td>
          </tr>
          <!--
          <tr>
              <td align="center"><b>Dimensioni: </b>
              larghezza <input type="text" name="larg" size="3">
              altezza <input type="text" name="alt" size="3">
              </td>
          </tr>
              -->      
          <tr>
            <td align="center">
            <hr noshade size="1" color="#666666">
            </td>
          </tr>
          
          <tr>
            <td align="left"><b>
              Titolo: 
    </b>
    </td>
  </tr>
    <tr>
     <td>
              <input name="headline1" type="text" size="119" class="form_off" onFocus="this.className='form_on'" onBlur="this.className='form_off'">

            </td>
          </tr>
          <tr>
            <td align="left"><b>
              Descrizione: 
    </b>
    </td>
  </tr>          
          <tr> 
            <td align="center">
            <textarea name="message" rows="20" cols="90" class="form_off" onFocus="this.className='form_on'" onBlur="this.className='form_off'">inserisci testo</textarea>
              <br> 
            </td>
          </tr>
                       
          <tr> 
            <td colspan="5">
            <hr noshade size="1" color="#666666">
            </td>
          </tr>
          
          <tr align="center"> 
            <td colspan="2">            
           <input type="submit" name="invia" value="Invia">
            </td>
          </tr>
        </table>
    </td>
  </tr>
</table>
</form>
<?php

if (isset($_POST['invia'])) {
    $rubricanewsletter=$_POST['rubrica'];
    $titolonewsletter=$_POST['headline1'];
 $newsletter=$_POST['utente'.$utente['userID']];
 $username=$_POST[$utente['username']];
 if($_FILES['imgnewsletter']['name']!="") {
  $messaggio=immagine($_FILES['imgnewsletter'],140,140,366,196);
  if ($messaggio=="true") {
   $immagine=$_SESSION['nomeimmagine'];      
  }
  else $immagine="";
 } 
 else $immagine="";


    $testonewsletter=$_POST['message'];
    $datanewsletter=date('d-m-Y - H:i');
    $posizione="archivio";
 
    mysql_query("insert into newsletter (data,titolo,testo,immagine,logo)
    values ('$datanewsletter','$titolonewsletter','$testonewsletter','$immagine','$rubricanewsletter')"); 

 $sel = isset($newsletter) ? '1' : '0';
if($sel == '1'){
        mysql_query("update webs_user set invio_newsletter = '1' where username = ".$username);

?>
  <script type="text/javaScript">
 alert("Campo modificato!")
 </script>
<?php
}
   }
}
?>
 

Eliox

Utente Attivo
25 Feb 2005
4.390
3
0
prova:
PHP:
mysql_query("update webs_user set invio_newsletter = '1' where username = ".$username) or die (mysql_error());
e vedi che errore ti restituisce.
 
Discussioni simili
Autore Titolo Forum Risposte Data
K Problema form update PHP 2
M Problema su update di 3 tabelle PHP 1
G Problema update di un database PHP 0
N Problema funzione UPDATE PHP 9
C Problema con update di un file PHP 6
K Problema con update di un database in un ciclo Classic ASP 1
C Problema con Update di una tabella di un db PHP 3
A Problema con UPDATE table SET username = $_SESSION["username"] PHP 22
blips Problema con Update multiplo PHP 1
P problema con l'update della data PHP 30
P Problema con update PHP 93
R Problema con UPDATE su DB mysql MySQL 1
G problema con insert e update PHP 2
helpdesk queri update problema PHP 1
jan267 Problema con UPDATE Classic ASP 3
I Sto progettando nuovi siti utilizzando bootstrap e devo dire funziona bene, l'unico problema e la maschera -moz- HTML e CSS 0
O problema con dvr dahua xvr5116 IP Cam e Videosorveglianza 0
S Problema nel ciclare un json Javascript 0
G Problema con Xampp Web Server 1
andrea barletta Problema con miniature comandi Photoshop 0
I problema con alice Posta Elettronica 0
K Problema Inner join PHP 1
F firefox problema http Linux e Software 0
N Problema con position absolute e overflow HTML e CSS 4
E Problema jquery Success jQuery 2
L Problema con inner join PHP 11
K [php] Problema con inner join PHP 4
E problema selezione sfumata Photoshop 2
K [PHP] Problema con variabili concatenate. PHP 1
A Problema filtro fluidifica Photoshop Photoshop 1
H Problema Bordi Scontorno Photoshop 1
O problema con query PHP 4
R Problema installazione Realtek WiFi USB rtl8821 Reti LAN e Wireless 1
I problema con 2 account Posta Elettronica 1
L problema collegamento file css con html HTML e CSS 1
Y Problema percorso file in rete PHP 1
N Problema SEO "L'URL non si trova su Google" SEO e Posizionamento 4
E Problema accesso a file con app sviluppata con MIT APP INVENTOR 2 Sviluppo app per Android 0
P Problema acquisizione clienti Webdesign e Grafica 1
F NetBeans problema creazione progetto Java Windows e Software 0
M Problema con Try Catch PHP 0
C problema seo + cerco esperto SEO e Posizionamento 11
Sergio Unia Problema con gli eventi del mouse su una data table: Javascript 2
T PROBLEMA CON SESSIONI PHP 3
A Problema, non so, di scale() o transform, oppure altro? HTML e CSS 0
T ALTRO PROBLEMA CON ARRAY PHP PHP 1
R problema con else PHP 0
T PROBLEMA CON ARRAY PHP 8
L problema con query select PHP 2
R Problema query con ricerca id numerico PHP 2

Discussioni simili