You are here: Re: Assignin rooms to student « PHP Programming Language « IT news, forums, messages
Re: Assignin rooms to student

Posted by Tom on 05/24/07 17:36

<MissHex@gmail.com> wrote in message
news:1179993704.285514.217600@p77g2000hsh.googlegroups.com...
> Hello everyone,
>
> am building a housing system
> and i want to be able to seach the data base for empty rooms then
> assign no more than 2 students in each room
>
> i have a table Student that contains Student ID
> and a table Room that contains the room ID
> i built another table that contains the roomID and the StudentID
> but how can i limit the entries to the rooms to make no more than two?
> and also search if for empty spaces?
>
> thank you very much in advanced
>
> regards,
>

You can use "count" in your SQL query such as

SELECT count(RoomID), RoomID
FROM AnotherTable
WHERE StudentID IS NOT NULL
AND RoomID IS NOT NULL
GROUP BY RoomID;

That would at least give you the results, but would need to control the
limit in your PHP code.

Tom
--
Basic Accounts $5.95 / mo. or $39.95 / yr.
http://newsguy.com/overview.htm

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация