Visualizzazione dei risultati da 1 a 4 su 4

Discussione: errore mysql

  1. #1

    errore mysql

    ottengo questo errore:
    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 '' at line 1

    il database è configurato bene, e questo stesso script funziona benissimo su di un'altra tabella dove al posto di alb c'è song...
    cosa sbaglio??

    Codice PHP:
    <html>
    <head>
    <title>Voto</title>
    </head>
    <body>

    <?
    // --------------------------------------------- PART 1 -------------------------------------

    //PLEASE CHANGE THESE VALUES !!

    $dbhost "xxx"// DB HOST
    $dbusername "xxx"// USERNAME
    $dbpass "xxx"// USER PASSWORD
    $dbname "xxx"// DB NAME
    //PLEASE CHANGE THESE VALUES !!


    $connection mysql_connect($dbhost$dbusername$dbpass);
    $SelectedDB mysql_select_db($dbname);


    $query mysql_query ("SELECT alb_rating, alb_num_votes FROM alb  WHERE uid=$alb_id") or die (mysql_error());


    while(list(
    $alb_rating$alb_num_votes)= mysql_fetch_array($query))
    {

    $new_count = ($alb_num_votes 1);

    $song_rating2 = ($alb_rating $alb_num_votes);

    $new_rating = (($rating $alb_rating2) / ($new_count));

    $new_rating2 number_format($new_rating2'.''');


    $update_rating mysql_query("UPDATE alb SET
    alb_rating='
    $new_rating2',alb_num_votes='$new_count' WHERE uid=$alb_id");


    echo 
    "<div align=\"center\"><font face=\"verdana\" size=\"1\">[b]


    Grazie per il voto!</p>


    L\'album ha ora una valutazione di:
    $new_rating2 su 5</p>
    <p align=\"center\"><a href=\"javascript:history.back();\"><< Torna</a>"
    ;
    }
    ?>
    </body>
    </html>

  2. #2
    E' semplice a me era capitato con un campo che avevo chiamato desc e le query si incasinavano (non mi ero accorto immediatamente della cosa!)

    credo che il tuo problema sia relativo proprio a questo, cambia i nomi dei campi e prova.
    File Reality.sys corrupted. Reboot universe (Y/N)? Y_

  3. #3
    ho cambiato i nomi dei campi...
    alb_rating --> voto
    alb_num_ratings --> voti

    ma non è cambiato niente...

  4. #4
    errore mio, scusate.
    alb_id non veniva passato correttamente.
    grazie comunque!

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.