Visualizzazione dei risultati da 1 a 9 su 9
  1. #1

    select con inner join...AIUTO!!!

    vorrei estrarre il campo email presente nella tabella utente, conoscendo l'username(attributo comune) presente nella tabella file_binari...sto impazzendo e nn trovo l'errore..
    questo è uno dei varii tentativi che ho fatto, se qlcn riesce ad aiutarmi lo loderò a vita



    Codice PHP:
    $new_username $_POST['username']; 

    $utente "SELECT email FROM file_binari INNER JOIN utente ON file_binari.$username = utente.$username";
    mysql_query($utente) or die (MYSQL_ERRNO()." ".MYSQL_ERROR()); 

  2. #2
    $utente = "SELECT email FROM file_binari INNER JOIN utente ON file_binari.$username = utente.$username
    mmh.. prova a concatenare lo username così:

    $utente = "SELECT email FROM file_binari INNER JOIN utente ON file_binari.".$username." = utente.".$username;

    poi magari mi sbaglio ^^
    Every Story Must Have An Ending...

  3. #3
    niente da fare da errore...

    1064 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 '= utente.' at line 1

  4. #4
    a mah.. aspetta.. ho capito forse.. al posto di $username mettici il nome del campo..
    sennò così ci scrivi l'username di ki è collegato..
    quindi la query dovrebbe funzionare così:

    SELECT email FROM file_binari INNER JOIN utente ON file_binari.username = utente.username

    sostituisci quelli sottolineati col nome del campo della tabella.
    Every Story Must Have An Ending...

  5. #5
    ma facendo così non gli specifico il nome dell'user del quale voglio avere la password..

    ps..come faccio per fare una stampa di prova?

    ps..cmq grazie

  6. #6
    per specificare l'utente devi fare un
    "SELECT....etc
    WHERE utente.username =$username";

    per scriverlo nella pagina fai così:

    $result=mysql_query($utente);
    while($rs=mysql_fetch_array($result)){
    echo $rs['email'];
    }
    Every Story Must Have An Ending...

  7. #7
    non va

    ho fatto una form nel menù principale dove posso scegliere se downlodare, visualizzare la foto..o vedere la mail dell'autore



    Codice PHP:
    echo'<form action="utente1.php" method="post"';
    echo 
    '<input type="submit" value="Vedi la mail" name="username">';
    echo 
    '</form>'

    e il file utente1.php

    Codice PHP:
    <?php
    include('config.php');
    mysql_select_db('negozio'$db);
            
    $new_username $_POST['username']; 

    $utente "SELECT email FROM file_binari INNER JOIN utente ON file_binari.username = utente.username WHERE utente.username =$new_username";

    mysql_query($utente) or die (MYSQL_ERRNO()." ".MYSQL_ERROR());

    $result=mysql_query($utente);
    while(
    $rs=mysql_fetch_array($result)){
    //echo 'la mail è:';
    echo $rs['email'];
    }


    ?>

    il risultatato è:

    1064 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 'la mail' at line 1
    cosa c'è che non va?????????????????caz

  8. #8
    ops ho fatto una stupidata io xchè associava il tasto a username..cmq nn riesco ugualmente

  9. #9
    Tutto risolto...
    ps..grazie Kitase

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.