Visualizzazione dei risultati da 1 a 10 su 10

Discussione: update where id

  1. #1
    Utente di HTML.it
    Registrato dal
    Oct 2007
    Messaggi
    257

    update where id

    vorrei fare un update solo dove l'id è uguale ad una variabile
    $mod ="update appartamenti SET .......

    si può fare?

    se metto where mi da errore

  2. #2
    Posta la query che stai provando e l'errore che ottieni.

  3. #3
    Utente di HTML.it
    Registrato dal
    Oct 2007
    Messaggi
    257
    $mod ="update appartamenti SET titolo='$titolo' "
    non c'è errore il fatto è che mi aggiorna tutti i record della tabella anzicchè solo quelli dove $id=$_POST['id'];

  4. #4

    Re: update where id

    Originariamente inviato da antoce
    se metto where mi da errore
    Posta la query che stai provando e l'errore che ottieni.

  5. #5
    Utente di HTML.it L'avatar di Pastore12
    Registrato dal
    Oct 2008
    Messaggi
    1,051
    $mod ="update appartamenti SET titolo='$titolo' where id=$_POST['id']"
    "Ethics are to me something private. Whenever you use it as an argument for why somebody_else should do something, you’re no longer being ethical, you’re just being a sanctimonious dick-head"
    Linus Torvalds

  6. #6
    Utente di HTML.it L'avatar di Pastore12
    Registrato dal
    Oct 2008
    Messaggi
    1,051
    Ho indovinato?
    "Ethics are to me something private. Whenever you use it as an argument for why somebody_else should do something, you’re no longer being ethical, you’re just being a sanctimonious dick-head"
    Linus Torvalds

  7. #7
    Utente di HTML.it
    Registrato dal
    Oct 2007
    Messaggi
    257
    la notazione giusta è where id='$id'
    così come me lo hai dato va in errore

  8. #8
    Originariamente inviato da Pastore12
    Ho indovinato?
    Si, hai indovinato il modo per generare un Parse Error ....

    http://www.php.net/manual/en/language.types.string.php

  9. #9
    Utente di HTML.it
    Registrato dal
    Oct 2007
    Messaggi
    257
    Comunque grazie Pastore12

  10. #10
    Utente di HTML.it L'avatar di Pastore12
    Registrato dal
    Oct 2008
    Messaggi
    1,051
    scusate... ho fato copia incolla senza guardare le virgolette...
    "Ethics are to me something private. Whenever you use it as an argument for why somebody_else should do something, you’re no longer being ethical, you’re just being a sanctimonious dick-head"
    Linus Torvalds

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.