Question about arrays

N

Nick Marinho

Following...

I have a roll-call of students to store in mysql database separated
by mounth:

student[1]
Present[1]
HalfTime[1]
Saturday[1]

student[2]
Present[2]
HalfTime[2]
Saturday[2]

student[3]
Present[3]
HalfTime[3]
Saturday[3]

...

I need a function to select: or all Present for all students, or
HalfTime or Saturday.

Someone to help me ?




--
Luciano Marinho (Programador PHP/C++) |ô_Ô|
www.lucianomarinho.com.br - www.racaboxer.com.br
Linux Registered User #433536
Adicione seus destinários só no BCC ou CCO.

♫ Amor é teu cão lamber a tua cara quando você chega,mesmo depois de
você deixá-lo só o dia todo! ♫
 
V

VK

Following...

I have a roll-call of students to store in mysql database separated
by mounth:

student[1]
Present[1]
HalfTime[1]
Saturday[1]

student[2]
Present[2]
HalfTime[2]
Saturday[2]

student[3]
Present[3]
HalfTime[3]
Saturday[3]

...

I need a function to select: or all Present for all students, or
HalfTime or Saturday.

Someone to help me ?

Why do not use Student object instead? Arrays would seem too messy
against OOP here IMHO.


var JohnDoe = new Student("John Doe","xxxx-xx-xxxx", "Saturday");

function Student() {
Person.apply(this, arguments);
this.employmentType = arguments[2];
}

function Person() {
this.name = arguments[0];
this.SSN = arguments[1];
}

and then from SQL
select all Student where employmentType = Saturday
and similar
 
T

Thomas 'PointedEars' Lahn

Michael said:
VK said:
function Person() {
this.name = arguments[0];
this.SSN = arguments[1];
}

function Person() {
this.name = arguments[0];
this.SSN = arguments[1] || "NA";
}

function Person(sName, sSSN)
{
this.name = sName;
this.ssn = sSSN || "NA";
}

A more flexible approach is presented in <[email protected]>.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,145
Messages
2,570,825
Members
47,371
Latest member
Brkaa

Latest Threads

Top