Visualizzazione dei risultati da 1 a 4 su 4

Discussione: Errore Query...

  1. #1
    Utente di HTML.it L'avatar di Nazza97
    Registrato dal
    Apr 2012
    Messaggi
    200

    Errore Query...

    Cosa c'è di sbagliato qui?

    $rsh = mysql_query("SELECT to,from,id,message FROM chat WHERE from='$email' AND to='$email' ORDER BY id DESC");


    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'to,from,id,message FROM chat WHERE from='xxxx' AND to='xxxx' at line 1
    Nazza

  2. #2
    Ciao,

    prova così:

    Codice PHP:
    <?php
              $rsh 
    mysql_query("SELECT
              to,
              from,
              id,
              message
              FROM
              chat
              WHERE
              from = ('
    $email')
              AND to = ('
    $email')
              ORDER BY id DESC"
    ); ?>

  3. #3
    Utente di HTML.it L'avatar di boots
    Registrato dal
    Oct 2012
    Messaggi
    1,626
    Il problema è che hai chiamato un campo (from) come la parola chiave FROM

    prova a fare così:

    codice:
    $rsh = mysql_query("SELECT chat.to,chat.from,chat.id,chat.message FROM chat WHERE chat.from='$email' AND chat.to='$email' ORDER BY id DESC");

  4. #4
    Utente di HTML.it L'avatar di Nazza97
    Registrato dal
    Apr 2012
    Messaggi
    200
    Originariamente inviato da boots
    Il problema è che hai chiamato un campo (from) come la parola chiave FROM

    prova a fare così:

    codice:
    $rsh = mysql_query("SELECT chat.to,chat.from,chat.id,chat.message FROM chat WHERE chat.from='$email' AND chat.to='$email' ORDER BY id DESC");
    Ho risolto subito perchè ci avevo pensato anche io a questo e infatti ho dovuto cambiare i campi in un altro nome.. Grazie lo stesso
    Nazza

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 © 2024 vBulletin Solutions, Inc. All rights reserved.