IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

PHP & Base de données Discussion :

Unable to jump to row 0 on MySQL result [MySQL]


Sujet :

PHP & Base de données

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Inscrit en
    Octobre 2008
    Messages
    125
    Détails du profil
    Informations forums :
    Inscription : Octobre 2008
    Messages : 125
    Par défaut Unable to jump to row 0 on MySQL result
    voila un de mes souçis car il y'en a plusieurs quand on va sur la page les membres et que l'on clique sur un des membres la page profil s'affiche jusque la c'est normal mais c'est ensuite quand l'on veux voir la photo du membre rien ne va plus ! voila l'erreur :Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in /home/renccas/public_html/portrait.php on line 39je vous laisse le code de la page profil
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
       <head>
           <title>bienvenue</title>
           <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
       </head>
     
       <body>
    <div align="center"> 
    <table border="1" width="90%">
        <tr>
     
            <td width="100%" colspan="3" align="center"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="468" height="60">
            <param name="movie" value="tmpl056_34901163c215f2.swf">
            <param name="quality" value="high">
            <embed src="tmpl056_34901163c215f2.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="468" height="60" ></embed>
           </object> </td>
     
        </tr>
     
        <tr>
     
            <td width="20%" align="center"><a href="inscri.php">inscription</a><br/><a href="connect.php">connection</a><br/><!-- Code HTML service Compteur live de Hawa Tools -->
    <script type="text/javascript" src="http://www.hawatools.com/service-cpt-live/compteur.php?id_membre=10262&id=2303&visible=1"></script>
    <noscript>
    <a href="http://www.hawatools.com" target="_blank" title="Services gratuits pour webmasters">Compteur gratuit</a>
    </noscript>
    <!-- Code HTML service Compteur live de Hawa Tools --></td>
     
            <td width="60%" align="center"><?php
    mysql_connect("xxxxxx", "xxxxxx", "xxxxxxx"); // Connexion à MySQL
    mysql_select_db("xxxxxxxxxx"); // Sélection de la base 
     
    $sql = "SELECT * FROM inscri WHERE id = '$id'";
    $qry = mysql_query($sql);
     
     
     
    {
    ?>
    <div align="center"><?php echo "son pseudo : " . mysql_result($qry, 0, 'pseudo') . "<br />";?>  
    <?php echo "sa région : " . mysql_result($qry, 0, 'région') . "<br />";?>
    <?php echo "son département : " . mysql_result($qry, 0, 'dep') . "<br />";?>
    <?php echo "sa ville : " . mysql_result($qry, 0, 'ville') . "<br />";?>
    <?php echo "son age : " . mysql_result($qry, 0, 'age') . "<br />";?>
    <?php echo "sa taille : " . mysql_result($qry, 0, 'taille') . "cm<br />";?>
    <a href="portrait.php">sa photo</a></div>
     
     
     
    <?php
    }
     
    mysql_close(); // Déconnexion de MySQL
    ?></td>
     
     
        </tr>
    	<tr>
    	</tr>
     
     
        <tr>
     
            <td width="100%" colspan="3" align="center"></td>
     
        </tr>
     
     
    </table> 
    </div> 
     
       </body>
    </html>
    et celle de la page portrait.php
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
       <head>
           <title>pics</title>
           <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
       </head>
     
       <body>
    <div align="center"> 
    <table border="1" width="90%">
        <tr>
     
            <td width="100%" colspan="3" align="center"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="468" height="60">
            <param name="movie" value="tmpl056_34901163c215f2.swf">
            <param name="quality" value="high">
            <embed src="tmpl056_34901163c215f2.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="468" height="60" ></embed>
           </object> </td>
     
        </tr>
     
        <tr>
     
            <td width="20%" align="center"><a href="index.php">acceuil</a><br/><a href="connect.php">connection</a><br/><!-- Code HTML service Compteur live de Hawa Tools -->
    <script type="text/javascript" src="http://www.hawatools.com/service-cpt-live/compteur.php?id_membre=10262&id=2303&visible=1"></script>
    <noscript>
    <a href="http://www.hawatools.com" target="_blank" title="Services gratuits pour webmasters">Compteur gratuit</a>
    </noscript>
    <!-- Code HTML service Compteur live de Hawa Tools --></td>
     
            <td width="60%" align="center"><?php
    mysql_connect("xxxxxxxx", "xxxxxx", "xxxxxx");
    mysql_select_db("xxxxxxxxxxxx");
    $reponse = mysql_query("SELECT * FROM inscri");
    //récupération de l'id passé en paramètre
      $id = $_REQUEST['id'] ;
      $sql = "SELECT * FROM inscri WHERE id = '" . $id . "'";
      $qry = mysql_query($sql) or die(mysql_error() . '<br :>SQL : ' . $sql);
     
      $avatar = mysql_result($qry, 0, 'avatar');
    //affichage de la photo.
     echo "<img src='" . $avatar ."'/>";
     mysql_close(); // Déconnexion de MySQL
    ?></td>
     
     
        </tr>
    	<tr>
    	</tr>
     
     
        <tr>
     
            <td width="100%" colspan="3" align="center"></td>
     
        </tr>
     
     
    </table> 
    </div> 
     
       </body>
    </html>
    est ce quelqu'un pourrais m'aider a résoudre ce souçi ?

  2. #2
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Par défaut
    $id n'est pas défini dans ta premiere page.
    Pour la deuxieme, est-ce tu as bien un champ de formulaire qui renvoit "id" vers cette page ?

    Prend l'habitude de debugger tes requetes quand tu es en developpement :
    ie :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    $reponse = mysql_query("SELECT * FROM inscri") or die(mysql_error));
    Si j'etais toi, j'utiliserais les fonction mysql_fetch_* plutot que mysql_result, c'est quand même plus facile a manipuler.
    N'oubliez pas de consulter les FAQ PHP et les cours et tutoriels PHP

  3. #3
    Membre confirmé
    Inscrit en
    Octobre 2008
    Messages
    125
    Détails du profil
    Informations forums :
    Inscription : Octobre 2008
    Messages : 125
    Par défaut je cale encore
    pourrais tu m'expliquer plus en détail pour l'id ! merçi d'avance

  4. #4
    Membre confirmé Avatar de mjs21
    Homme Profil pro
    Développeur Web
    Inscrit en
    Juin 2008
    Messages
    85
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 36
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Juin 2008
    Messages : 85
    Par défaut
    Moi je ferais :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
       <head>
           <title>bienvenue</title>
           <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
       </head>
     
       <body>
    <div align="center"> 
    <table border="1" width="90%">
        <tr>
     
            <td width="100%" colspan="3" align="center"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="468" height="60">
            <param name="movie" value="tmpl056_34901163c215f2.swf">
            <param name="quality" value="high">
            <embed src="tmpl056_34901163c215f2.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="468" height="60" ></embed>
           </object> </td>
     
        </tr>
     
        <tr>
     
            <td width="20%" align="center"><a href="inscri.php">inscription</a><br/><a href="connect.php">connection</a><br/><!-- Code HTML service Compteur live de Hawa Tools -->
    <script type="text/javascript" src="http://www.hawatools.com/service-cpt-live/compteur.php?id_membre=10262&id=2303&visible=1"></script>
    <noscript>
    <a href="http://www.hawatools.com" target="_blank" title="Services gratuits pour webmasters">Compteur gratuit</a>
    </noscript>
    <!-- Code HTML service Compteur live de Hawa Tools --></td>
     
            <td width="60%" align="center"><?php
    mysql_connect("xxxxxx", "xxxxxx", "xxxxxxx"); // Connexion à MySQL
    mysql_select_db("xxxxxxxxxx"); // Sélection de la base 
     
    $sql = "SELECT * FROM inscri;"; // WHERE id = '$id'"; ????????? Il sort d'ou ?
    $qry = mysql_query($sql);
     
     
     
    {
    ?>
    <div align="center"><?php echo "son pseudo : " . mysql_result($qry, 0, 'pseudo') . "<br />";?>  
    <?php echo "sa région : " . mysql_result($qry, 0, 'région') . "<br />";?>
    <?php echo "son département : " . mysql_result($qry, 0, 'dep') . "<br />";?>
    <?php echo "sa ville : " . mysql_result($qry, 0, 'ville') . "<br />";?>
    <?php echo "son age : " . mysql_result($qry, 0, 'age') . "<br />";?>
    <?php echo "sa taille : " . mysql_result($qry, 0, 'taille') . "cm<br />";?>
    <a href="portrait.php?id=<?php echo mysql_result($qry, 0, 'id'); ?>">sa photo</a></div>
     
    	 
       
    <?php
    }
     
    mysql_close(); // Déconnexion de MySQL
    ?></td>
     
     
        </tr>
    	<tr>
    	</tr>
     
     
        <tr>
     
            <td width="100%" colspan="3" align="center"></td>
     
        </tr>
     
     
    </table> 
    </div> 
     
       </body>
    </html>
    et

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
       <head>
           <title>pics</title>
           <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
       </head>
     
       <body>
    <div align="center"> 
    <table border="1" width="90%">
        <tr>
     
            <td width="100%" colspan="3" align="center"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="468" height="60">
            <param name="movie" value="tmpl056_34901163c215f2.swf">
            <param name="quality" value="high">
            <embed src="tmpl056_34901163c215f2.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="468" height="60" ></embed>
           </object> </td>
     
        </tr>
     
        <tr>
     
            <td width="20%" align="center"><a href="index.php">acceuil</a><br/><a href="connect.php">connection</a><br/><!-- Code HTML service Compteur live de Hawa Tools -->
    <script type="text/javascript" src="http://www.hawatools.com/service-cpt-live/compteur.php?id_membre=10262&id=2303&visible=1"></script>
    <noscript>
    <a href="http://www.hawatools.com" target="_blank" title="Services gratuits pour webmasters">Compteur gratuit</a>
    </noscript>
    <!-- Code HTML service Compteur live de Hawa Tools --></td>
     
            <td width="60%" align="center"><?php
    mysql_connect("xxxxxxxx", "xxxxxx", "xxxxxx");
    mysql_select_db("xxxxxxxxxxxx");
    $reponse = mysql_query("SELECT * FROM inscri");
    //récupération de l'id passé en paramètre
      $id = $_GET['id'];
      $sql = "SELECT * FROM inscri WHERE id = '" . $id . "'";
      $qry = mysql_query($sql) or die(mysql_error() . '<br :>SQL : ' . $sql);
     
      $avatar = mysql_result($qry, 0, 'avatar');
    //affichage de la photo.
     echo "<img src='" . $avatar ."'/>";
     mysql_close(); // Déconnexion de MySQL
    ?></td>
     
     
        </tr>
    	<tr>
    	</tr>
     
     
        <tr>
     
            <td width="100%" colspan="3" align="center"></td>
     
        </tr>
     
     
    </table> 
    </div> 
     
       </body>
    </html>
    Mais c'est vrai que les mysql_result ..

  5. #5
    Membre confirmé
    Inscrit en
    Octobre 2008
    Messages
    125
    Détails du profil
    Informations forums :
    Inscription : Octobre 2008
    Messages : 125
    Par défaut
    merçi pour ta réponse mjs21 c'est cool

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [MySQL] Unable to jump to row 0 on MySQL result index 8
    Par biddal dans le forum PHP & Base de données
    Réponses: 1
    Dernier message: 13/03/2008, 18h08
  2. [MySQL] Unable to jump to row 0 on MySQL result
    Par miltonis dans le forum PHP & Base de données
    Réponses: 2
    Dernier message: 02/03/2008, 20h42
  3. [MySQL] erreur : Unable to jump to row 0 avec mysql_result
    Par stomerfull dans le forum PHP & Base de données
    Réponses: 1
    Dernier message: 20/02/2008, 12h22
  4. [MySQL] Unable to jump to row 0 on MySql ?
    Par loady dans le forum PHP & Base de données
    Réponses: 3
    Dernier message: 13/11/2006, 17h25
  5. Réponses: 2
    Dernier message: 18/01/2006, 16h33

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo