Help please.

Can this be done in PHP??? :

(MySQL 3.22.51-nt and PHP 4.2.1)

I have two tables from which I am SELECTing fields from.  Both tables have an 
identical field by which I am INNER JOINing the tables.

 

My problem is this: Some of the fields repeat themselves.

Yes, I used the word DISTINCT.

Since IN subSELECTs are not supported in version 3.22.51-nt, I cannot seem to get my 
desired results.

 

More about my problem:

I need to display all classes for SP03.  Since there are some class subjects that have 
multiple classes in the semester, the class subject names are repeating themselves for 
each class.

 

Is there a way in PHP to solve this problem without upgrading to MySQL 4.07? 

 

Here is some of my coding on this problem (Don't laugh, I am a beginner):

 

$query="SELECT DISTINCT a.course_name, a.descr, b.course_number,

                                                b.day, b.hour, b.location_id, 
b.course_date,

                                                b.instructor_id, b.price

                                                                                       
         

                                FROM $course_master_tablename a

                                                INNER JOIN $course_details_tablename b

                                                ON a.course_name = b.course_name

                                                WHERE semester_id = 'FA02' and 
b.class_id = 'Taxes'

                                                ORDER BY course_name";

                                                                                       
                                 

       $result = mysql_query($query);

       if(!$result) error_message(sql_error());

               while($query_data = mysql_fetch_array($result)) {

                            

               $headername = $query_data["course_name"];

               $headerdescr = $query_data["descr"];                                    
               

               $coursenum = $query_data["course_number"];

               $weekday = $query_data["day"];

               $hourtime = $query_data["hour"];

               $location = $query_data["location_id"];

               $coursedate = $query_data["course_date"];

               $instructor = $query_data["instructor_id"];

               $priceof = $query_data["price"];

               .THEN I DISPLAY THE FIELDS IN A FORM



               }

Reply via email to