Populate an Array from MySQL
Posted: Sun Dec 19, 2004 9:58 am
Here's what I am trying (rather unsuccessfully!) to do:
I have a database, called "Students" which has these fields: "Lastname", "Firstname", "GradeLevel", and "Subject". In my php script, I do a query: "SELECT * FROM Students WHERE GradeLevel = 7"; and if a do a row count, it returns 88 rows (that's good!) I want to "walk thru the array", but show me the fields in the array. So, the first one might be "Adams Brian 7 Math" and the next one might be "Angeluz Teresa 7 Science" and etc. I need this because my plan is that once a teacher enters their grade, I would present them with a web page that would say "Enter Grades for " [first kid] and they would do so. By pressing "Next", it would write the data to another table, and then say "Enter Grades for " [second kid], etc. until done.
I have no trouble with the query, or INSERTING data into the 2nd table. The problem appears to be my array! Can someone help?
Thanks.
I have a database, called "Students" which has these fields: "Lastname", "Firstname", "GradeLevel", and "Subject". In my php script, I do a query: "SELECT * FROM Students WHERE GradeLevel = 7"; and if a do a row count, it returns 88 rows (that's good!) I want to "walk thru the array", but show me the fields in the array. So, the first one might be "Adams Brian 7 Math" and the next one might be "Angeluz Teresa 7 Science" and etc. I need this because my plan is that once a teacher enters their grade, I would present them with a web page that would say "Enter Grades for " [first kid] and they would do so. By pressing "Next", it would write the data to another table, and then say "Enter Grades for " [second kid], etc. until done.
I have no trouble with the query, or INSERTING data into the 2nd table. The problem appears to be my array! Can someone help?
Thanks.