Hello and welcome to our community! Is this your first visit?
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
    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:

      <ul class="nostart">
                <select name="select" class="textfields" id="Speciality">
                  <option id="0">-- Select Speciality --</option>
                      $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 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'

    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. #2
    Regular Coder
    Join Date
    Nov 2012
    Thanked 13 Times in 13 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
    WHERE enseignant
    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='
    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