Hello and Thanks,
I am trying to create a teacher grade book for my school, I have a mysql database 'gradebook' and two tables 'students' and 'data' (mysql code below) to start, I am also using PHP. I have googled this to death and can't seem to come up with anything that I can understand; I have a two part question.
First Part:
How do I get the data arranged into a table like to one below:
| Test1 (100pts) | Test2(100pts) |
-----------------------------------------------------------------------------
Joe Edel | 100 | 80 |
-----------------------------------------------------------------------------
Angela Edel | 99 | 95 |
-----------------------------------------------------------------------------
Second Part:
Is there a term for the way/method I am extracting the data and arranging it (multi-diemsional array?). The reason I ask is that this type of query seems different at a fundamental level than a standard mysql query that most website use as an example.
Thanks,
Joe
-- phpMyAdmin SQL Dump
-- version 2.11.7.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Dec 06, 2009 at 02:01 PM
-- Server version: 5.0.41
-- PHP Version: 5.2.6
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--
-- Database: `gradebook`
--
-- --------------------------------------------------------
--
-- Table structure for table `data`
--
CREATE TABLE `data` (
`id` int(11) NOT NULL auto_increment,
`student_id` int(11) default NULL,
`assignment_name` varchar(25) default NULL,
`points_possible` int(3) default NULL,
`points_earned` int(3) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
--
-- Dumping data for table `data`
--
INSERT INTO `data` VALUES(1, 1, 'test1', 100, 90);
INSERT INTO `data` VALUES(2, 1, 'test2', 100, 85);
INSERT INTO `data` VALUES(3, 2, 'test1', 100, 99);
INSERT INTO `data` VALUES(4, 2, 'test2', 100, 100);
-- --------------------------------------------------------
--
-- Table structure for table `students`
--
CREATE TABLE `students` (
`id` int(11) NOT NULL auto_increment,
`student_name` varchar(25) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
--
-- Dumping data for table `students`
--
INSERT INTO `students` VALUES(1, 'Joe Edel');
INSERT INTO `students` VALUES(2, 'Angela Edel');