Navigazione

    Privacy - Termini e condizioni
    © 2020 Search On Media Group S.r.l.
    • Registrati
    • Accedi
    • CATEGORIES
    • Discussioni
    • Non letti
    • Recenti
    • Hashtags
    • Popolare
    • Utenti
    • Stream
    • Interest
    • Categories
    1. Home
    2. the.worm
    3. Post
    T

    the.worm

    @the.worm

    • Profilo
    • Chi segue 0
    • Da chi è seguito 0
    • Discussioni 1
    • Post 1
    • Migliore 0
    • Gruppi 0
    Iscrizione Ultimo Accesso
    0
    Reputazione
    1
    Post
    0
    Visite al profilo
    0
    Da chi è seguito
    0
    Chi segue
    User Newbie

    Post creati da the.worm

    • query per cancellare una riga da una tabella MySQL in PHP

      Ciao A Tutti:ciauz:,
      sono un 'novellino' :), vorrei sapere come creare una query di cancellazione per MySQL in php; riesco a fare la query di insert, ma non quella di DELETE.

      Questa la insert:

      $nome = $_REQUEST['frnome'];
      $cognome = $_REQUEST['frcognome'];
      $telefono = $_REQUEST['frtelefono'];

      $tToAdd = array('nome'=>$nome, 'cognome'=>$cognome, 'telefono' => $telefono);

      $sqlQuery = insertIntoDB('rubrica', $tToAdd);

      function insertIntoDB($table, $toAdd)
      {
      $fields = implode(array_keys($toAdd), ',');
      $values = "'".implode(array_values($toAdd), "','")."'";

      $q = 'INSERT INTO '.$table.' ('.$fields.') VALUES ('.$values.')';

      $res = mysql_query($q)OR die(mysql_error());

      return true;
      }

      ed ecco la delete

      $nome = $_REQUEST['tonome'];
      $cognome = $_REQUEST['tocognome'];

      $sqlQuery = deleteFromDB($table);

      function deleteFromDB($t)
      {
      $q = 'DELETE FROM '.$t.' WHERE nome = '. $nome.' AND cognome= '. $cognome.' LIMIT 1';

      $res = mysql_query($q)OR die(mysql_error());

      return true;
      }

      Praticamente prendo dei dati che sono inviati da un file Java e devo aggiornare una tabella su un DB. GRAZIE per l'aiuto

      postato in Coding
      T
      the.worm