Jim Lucas <[EMAIL PROTECTED]> wrote in message
012301c16d3a$6def13c0$96def5cc@bendcom">news:012301c16d3a$6def13c0$96def5cc@bendcom...
> Here are a few pointers to make it run just a little faster also.
>
> don't extract the entire $GLOBALS array. just use the $var that you need.
> function GetData($Query)
> {
> return(mysql_query($Query, $GLOBALS[db_conn]));
> }
The problem with this approach is that I do not know ahead of time which
GLOBALS
I will need (other than $db_conn). For instance, once query may depend of
the $ClassID
and $Attendance variables while another depends on the $StudentID and $Grade
variables
>
> why are you using a define to set an SQL query string?
I am using define to set SQL query strings because there are a limited
number (30 or so)
of queries used by the application, but they are used in different contexts.
So, for example,
I may have:
"SELECT FirstName, LastName, Grade, Attendance FROM Students, Classes
WHERE Students.StudentID = Classes.StudentID AND ClassID = $Class"
defined as StudentsByClass. I can then pass the function the constant and
use it in
different situations. For example:
PrintMenu("Students",GetData(StudentsByClass));
will print a menu of student names whereas:
PrintAttendance(GetData(StudentsByClass));
would print an attendance report
Fred
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]