Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Apr 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Query for a Drop List don't echo out !

    I am trying to make the query work in my php script ,that allow me to echo all speciality related to the user sing in,but it doesn't give me nothing this is my query : there's Table"affecte" tha has a link between Table"enseignat" and "groupe" and in Table "groupe" there's link to Table "speciality" this images of every table

    like you see in the script and every time I click on the list it don't give me nothing first of all I've tried this one:

    Code:
      <ul class="nostart">
                <select name="select" class="textfields" id="Speciality">
                  <option id="0">-- Select Speciality --</option>
                  <?php
      
                      $getallSpeciality = mysql_query("select Nom_Specialite from specialite where enseignant.Id_enseignant=''+mail+'''   and enseignant.`Id_Enseignant`=affecte.`Id_Enseignant` and affecte.`Id_Groupe`=groupe.`Id_Groupe` and specialite.`Id_Specialite`=groupe.`Id_Specialite`;");
                      while($viewallSpeciality = mysql_fetch_array($getallSpeciality)){
                      ?>
                      <option id="<?php echo $viewallSpeciality['Id_Specialite']; ?>">
                     <?php echo $viewallSpeciality['Nom_specialite'] ?></option>
                     <?php } ?>
               </select>
             </ul>
    select Nom_Specialite from specialite,enseignant,affecte,groupe where enseignant.mail_enseignant=''+mail+''' and enseignant.`Id_Enseignant`=affecte.`Id_Enseignant` and affecte.`Id_Groupe`=groupe.`Id_Groupe` and specialite.`Id_Specialite`=groupe.`Id_Specialite`;
    UPDATE evaluation SET Td='11' WHERE Matricule='1'

    www2.0zz0.com/2014/04/28/01/167085039.jpg
    www2.0zz0.com/2014/04/28/01/793102561.jpg
    www2.0zz0.com/2014/04/28/01/324938650.jpg
    i want to displaye speciality that linked to enseignant ! ,and if tried SELECT * FROM specialite it giving all the speciality ,but what I am trying to do is to echo for every enseignant "user" his speciality ,my login.php is in a separate file and this code is from my note-on.php ,I will very grateful for any help thanks in advance !

  • #2
    Regular Coder
    Join Date
    Nov 2012
    Posts
    115
    Thanks
    7
    Thanked 12 Times in 12 Posts
    Hi Machine.Gamer,

    I think there's an error in your query, mainly with your quotes and chaining character and variable character.

    PHP Code:
    SELECT Nom_Specialite 
    FROM specialite
    ,enseignant,affecte,groupe 
    WHERE enseignant
    .mail_enseignant=''+mail+''' 
    AND enseignant.`Id_Enseignant`=affecte.`Id_Enseignant` 
    AND affecte.`Id_Groupe`=groupe.`Id_Groupe` 
    AND specialite.`Id_Specialite`=groupe.`Id_Specialite`;

    UPDATE evaluation 
    SET Td='
    11
    WHERE Matricule='

    As you can see in the syntax highlighting, something's not right. Check your single and double quotes, and keep in mind that chaining things in PHP happens with a dot, rather than a plus sign. So

    PHP Code:
    WHERE enseignant.mail_enseignant=''+mail+'' 
    should be

    PHP Code:
    WHERE enseignant.mail_enseignant=".$mail." 
    And keep in mind that variable names in PHP are always preceded by a dollar sign, so mail should be $mail


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •