3 messages in com.mysql.lists.perlProgramming Question
FromSent OnAttachments
Douglas S. Davis04 Oct 2005 08:37 
Rhesa Rozendaal04 Oct 2005 08:47 
Christopher Pryce04 Oct 2005 08:58 
Subject:Programming Question
From:Douglas S. Davis (dsda@haverford.edu)
Date:10/04/2005 08:37:21 AM
List:com.mysql.lists.perl

Hi,

I'm writing a Perl program to create a web page that allows faculty at the college where I work to propose new courses using a web form. At one point during the filling out of the form, the faculty member must propose a course number to be used (like "101" for English 101). I have a link that the faculty member can click that runs a javascript routine that looks at the department choice made earlier in the form and then opens a new window to display the available course numbers--those not already in use by other courses in their specified department.

The javascript just runs a Perl program to create the window and the Perl program queries a MySQL table to get all of the currently in use numbers in the specified department. I then need to compare the results of the query with the list of all possible numbers (100 - 499) to determine which of the possible numbers are *not* in use, and then display the available numbers in the new window for the faculty member to choose from.

My problem (and I am sure it must be simple to do) is that I can't figure out how to compare the list of possible numbers (100 - 499) with the list of already in use numbers returned by my query. I've tried various loops and while statements all to no avail. Usually what I get is that for *each* number in the result set of my query, it prints out all of the numbers from 100 - 499.

Can anyone point me in the right direction. So in other words, when I do my fetchrow() on the MySQL table, how can I take the results and compare them to the 100 - 499 set of numbers.

I'm *not* a great Perl programmer, so if you can explain clearly in the most basic (not necessarily the most efficient or technically impressive) way, I'd really appreciate it!

Douglas