Page 1 of 1

Getting started with items in stock

Posted: Wed Sep 10, 2008 9:48 pm
by SabreT
Hi all,

I'm pretty new to php + sql, at the level where I'm getting things to work by experimenting. I was hoping someone could point me in the right direction of something I wanna do:

I'm working on an administration tool for a music school, where teachers can set dates for their one-to-one lessons. In short selecting a date for a lesson from a dynamic list populated with sql values. When the teacher assigns a lesson to a student, then (obviously) it won't be avaliable for other students. From this I want to make a display page of all avaliable lessons for front-end users of the school webpage to pick from. (However, nothing is meant to happen when front-end users pick lessons, other than an email to an admin)

I realize this might be a big deal. But any tips, and any hints in the right direction is valuable.

Thanks!

Sabre

Re: Getting started with items in stock

Posted: Thu Sep 11, 2008 12:34 pm
by mabwi
The straightforward way to do this is have an assignedstudent column in your schedule table, with a default value of zero. When the admin sets an appointment, it sets that column to the student id (a foreign key to the student table).

Then you can just adjust your query when building the schedule to be

"SELECT * FROM schedules WHERE assignedstudent = 0"

But not *, obviously, just what you need. This probably isn't the "best" way of going about this, but it's easy, it works, and it's not a sin against computer science.

Re: Getting started with items in stock

Posted: Sat Sep 13, 2008 9:48 pm
by SabreT
Thanks mate!
You really pushed me in the right direction, and I got it working :)

Cheers!