Partage
  • Partager sur Facebook
  • Partager sur Twitter

Requête SQL qui ne marche pas

mysql_error n'indique rien

Anonyme
    19 février 2006 à 21:20:09

    Bonjour,


    Même un ami à moi n'a pas su le problème.
    Il pense que c'est le nom des tables mêmes si j'en doute.

    Ce qui ne marche pas, c'est les requêtes "UPDATE".

    Donc normalement tout marche, le nom des champs de tables, le nom des tables, $calcul marche impeccable, ainsi que mes autres requêtes SQL. Seulement UPDATE lui ne marche pas...


    EDIT : j'ai essayé de voir l'erreur avec or die(mysql_error()); mais il ne m'affiche rien

    <?php
    session_start();
    ?>
    <HTML>
    <HEAD>
    <SCRIPT LANGUAGE="JavaScript">
    if (parent.frames.length > 0)
    {
    window.top.location.href = location.href;
    }
                          </SCRIPT>
    <title>Chimbodae !</title>
    <?
    include("/usr/export/www/vhosts/funnetwork/hosting/chimbodae/css.php");
    ?>
    </HEAD>
    <center>    <p><?
    include("/usr/export/www/vhosts/funnetwork/hosting/chimbodae/haut.php");
    ?></p>
    </center>

    <p><?
    include("/usr/export/www/vhosts/funnetwork/hosting/chimbodae/menu.php");
    ?> </p>
    <center>
    <td valign="top" align="center">


    <?php
    mysql_connect("localhost", "chimbodae", "passSQL");
    mysql_select_db("chimbodae");

    $deja1 = mysql_query("SELECT * FROM avote_sond WHERE pseudo='" . $_SESSION['pseudo'] . "' AND id_sond='" . $_GET['id'] . "'");
    $deja = mysql_fetch_array($deja1);

    if ($deja['pseudo'] == NULL)
    {
    $vote1 = mysql_query("SELECT * FROM rep_sond WHERE id_sond='" . $_GET['id'] . "'") or die(mysql_error());
    $vote = mysql_fetch_array($vote1);
    echo $vote['1'];
    if ($_POST['reponse'] == 1)
    {
    $calcul = $vote['1'] + 1;
    mysql_query("UPDATE rep_sond SET 1='" . $calcul . "' WHERE id_sond='" . $_GET['id'] . "'");
    }
    elseif ($_POST['reponse'] == 2)
    {
    $calcul = $vote['2'] + 1;
    mysql_query("UPDATE rep_sond SET 2='" . $calcul . "' WHERE id_sond='" . $_GET['id'] . "'");
    }
    elseif ($_POST['reponse'] == 3)
    {
    $calcul = $vote['3'] + 1;
    mysql_query("UPDATE rep_sond SET 3='" . $calcul . "' WHERE id_sond='" . $_GET['id'] . "'");
    }
    elseif ($_POST['reponse'] == 4)
    {
    $calcul = $vote['4'] + 1;
    mysql_query("UPDATE rep_sond SET 4='" . $calcul . "' WHERE id_sond='" . $_GET['id'] . "'");
    }
    elseif ($_POST['reponse'] == 5)
    {
    $calcul = $vote['5'] + 1;
    mysql_query("UPDATE rep_sond SET 5='" . $calcul . "' WHERE id_sond='" . $_GET['id'] . "'");
    }
    elseif ($_POST['reponse'] == 6)
    {
    $calcul = $vote['6'] + 1;
    mysql_query("UPDATE rep_sond SET 6='" . $calcul . "' WHERE id_sond='" . $_GET['id'] . "'");
    }
    elseif ($_POST['reponse'] == 7)
    {
    $calcul = $vote['7'] + 1;
    mysql_query("UPDATE rep_sond SET 7='" . $calcul . "' WHERE id_sond='" . $_GET['id'] . "'");
    }
    elseif ($_POST['reponse'] == 8)
    {
    $calcul = $vote['8'] + 1;
    mysql_query("UPDATE rep_sond SET 8='" . $calcul . "' WHERE id_sond='" . $_GET['id'] . "'");
    }
    elseif ($_POST['reponse'] == 9)
    {
    $calcul = $vote['9'] + 1;
    mysql_query("UPDATE rep_sond SET 9='" . $calcul . "' WHERE id_sond='" . $_GET['id'] . "'");
    }
    elseif ($_POST['reponse'] == 10)
    {
    $calcul = $vote['10'] + 1;
    mysql_query("UPDATE rep_sond SET 10='" . $calcul . "' WHERE id_sond='" . $_GET['id'] . "'");
    }
    $text = "Vote effectué avec Succès :)";
    mysql_query("INSERT INTO avote_sond VALUES('" . $_SESSION['pseudo'] . "', '" . $_GET['id'] . "')");
    }
    else
    {
    $text = "T'as d'jà voté ! ";
    }
    ?>
    <table width="630" border="0" cellspacing="0" cellpadding="5">
    <br />

    <center><td valign="top" align="center"><p align="center"><table width="435" border="0" cellpadding="0" cellspacing="0">


                            <tr>
                <td width="13" height="13"><img src="http://chimbodae.ch.funpic.de/images/haut_gauche.gif" width="13" height="13"></td>
                <td height="13" bgcolor="#FFF4D5"> </td>
                <td width="13" height="13"><img src="http://chimbodae.ch.funpic.de/images/haut_droite.gif" width="13" height="13"></td>
            </tr>
            <tr>
                <td width="11" bgcolor="#FFF4D5"> </td>
                <td valign="top" bgcolor="#FFF4D5">
                    <table width="406" border="0" cellspacing="0" cellpadding="1">
                                    <tr>
                       
                       
                       
                       
                                        <td valign="top" width="404" height="18">
     
     
     
     
     
     
     
     
                                            <p align="center">

    <center><span class="titrebleu"></span></center>

    <?php echo $text; ?>
                                                                     
    <br /><br />
    <br /><br />
       
                                        </td>
                                    </tr>
                      <tr>
                       
                       
                      </tr>
                    </table>
                    </td>
                    <td width="11" bgcolor="#FFF4D5"> </td>
                  </tr>
            <tr>
                <td width="11" height="11"><img src="http://chimbodae.ch.funpic.de/images/bas_gauche.gif" width="13" height="13"></td>
                <td height="11" bgcolor="#FFF4D5"> </td>
                <td width="11" height="11"><img src="http://chimbodae.ch.funpic.de/images/bas_droite.gif" width="13" height="13"></td>
            </tr>
            <tr>
            </tr>

                    </table>

    </center>

    <p></p>
    <?
    include("/usr/export/www/vhosts/funnetwork/hosting/chimbodae/bas.php");
    ?>



    Ps:je sais que ça peut être mal codé (comme on m'a remarqué les if), mais ce que je demande est une aide.


    Merci d'avance
    • Partager sur Facebook
    • Partager sur Twitter
      19 février 2006 à 21:24:58

      au lieu de ça :
      mysql_query("UPDATE rep_sond SET 1='" . $calcul . "' WHERE id_sond='" . $_GET['id'] . "'");


      essaies ça (je ne suis pas sûr, mais bon) :
      mysql_query("UPDATE rep_sond SET 1=" . $calcul . " WHERE id_sond=" . $_GET['id'] . "");
      • Partager sur Facebook
      • Partager sur Twitter
      Anonyme
        19 février 2006 à 21:28:24

        Non Sitevolution...

        Ca ne marche pas mieux. ^^
        • Partager sur Facebook
        • Partager sur Twitter
          19 février 2006 à 21:35:14

          mysql_query('UPDATE rep_sond SET 1=\''.$calcul.'\' WHERE id_sond='.$_GET['id']);


          et comme ça?


          Sinon tout en haut de ton fichier essaye de rajouter :



          Il t'affichera peut etre plus d'erreurs ;)
          • Partager sur Facebook
          • Partager sur Twitter
          Anonyme
            19 février 2006 à 21:39:20

            Il y a des fonctions très sympathiques "Afficher plus d'erreurs"
            Comme quoi ils sont sadiques :lol:

            Ben plein d'erreur, mais aucune concernant mon cas, et la requête que tu m'as donnée ne marche pas plus non plus... :(
            • Partager sur Facebook
            • Partager sur Twitter

            Requête SQL qui ne marche pas

            × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
            × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
            • Editeur
            • Markdown