Getting started with items in stock

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
SabreT
Forum Newbie
Posts: 2
Joined: Wed Sep 10, 2008 9:38 pm

Getting started with items in stock

Post 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
mabwi
Forum Commoner
Posts: 27
Joined: Wed Aug 01, 2007 4:51 pm

Re: Getting started with items in stock

Post 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.
SabreT
Forum Newbie
Posts: 2
Joined: Wed Sep 10, 2008 9:38 pm

Re: Getting started with items in stock

Post by SabreT »

Thanks mate!
You really pushed me in the right direction, and I got it working :)

Cheers!
Post Reply