By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,083 Members | 1,957 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,083 IT Pros & Developers. It's quick & easy.

Assignin rooms to student

P: n/a
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,

May 24 '07 #1
Share this Question
Share on Google+
15 Replies


P: n/a
Hi,
Before alloting a room check the rooms like

select count(roomid) from maproomstudent mp ,rooms where
room.roomid=mp.roomid

after this check if count >=2 don't allot otherwise allot it

May 24 '07 #2

P: n/a
Mi*****@gmail.com wrote:
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,
Sounds like someone's homework assignment... :-)

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
May 24 '07 #3

P: n/a

Ravi :
Hi,
Before alloting a room check the rooms like

select count(roomid) from maproomstudent mp ,rooms where
room.roomid=mp.roomid

after this check if count >=2 don't allot otherwise allot it
-------------------------------------------------------------------------
hey, thanks but how can i write this statement in php?

after this check if count >=2 don't allot otherwise allot it
??
:s sorry for bothering

waiting for ur reply

May 24 '07 #4

P: n/a
Message-ID: <so******************************@comcast.comfro m Jerry
Stuckle contained the following:
>Sounds like someone's homework assignment... :-)
Heh, my thoughts exactly.

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
May 24 '07 #5

P: n/a
Message-ID: <11*********************@u30g2000hsc.googlegroups. comfrom
Mi*****@gmail.com contained the following:
>select count(roomid) from maproomstudent mp ,rooms where
room.roomid=mp.roomid

after this check if count >=2 don't allot otherwise allot it
-------------------------------------------------------------------------
hey, thanks but how can i write this statement in php?
Go on tell us, is this homework or coursework?

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
May 24 '07 #6

P: n/a
yes, it is =)
can u help me? *angle loook * lol

May 24 '07 #7

P: n/a
oh its a HW

May 24 '07 #8

P: n/a
At Thu, 24 May 2007 07:58:48 -0700, MissHex let her monkeys type:
yes, it is =)
can u help me? *angle loook * lol
Well that at least 'bought' you this:

Your first post was from another pc I think, but your latest replies
are from a pc whose browser identifies itself as:

X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;
SV1; FunWebProducts; FDM; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR
3.0.04506.30),gzip(gfe),gzip(gfe)

Note the 'FunWebProducts' part. I'd say: not so funny at all. You probably
downloaded free icons and stuff, and got a nice spyware gift for "free"
with them.

Better Google for it and remove that nasty bugger! Better still,
install/update a good virus/spyware detection/removal tool. I bet you have
more unwanted guests than just FunWebProducts. Unlike the dorm rooms one
pc can house more than two... Problem is, these lowlifes never sign in
at the clerk's desk, they just move their junk in and invite all their
friends ;-)

HTH
Sh.


May 24 '07 #9

P: n/a
wellll thank u...... is it gone ?:P
i did wat u told me

May 24 '07 #10

P: n/a
Tom

<Mi*****@gmail.comwrote in message
news:11**********************@p77g2000hsh.googlegr oups.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
May 24 '07 #11

P: n/a
At Thu, 24 May 2007 10:07:56 -0700, MissHex let her monkeys type:
wellll thank u...... is it gone ?:P
i did wat u told me
Wow, a chick following orders. Are you married yet? ;-)
It's gone! Good girl. <taptap>

Good luck with the homework assignment!

Sh, hurrying back to the couch, waking gf, to see if this following orders
thing is contageous...
May 24 '07 #12

P: n/a
Message-ID: <11**********************@q69g2000hsb.googlegroups .comfrom
Mi*****@gmail.com contained the following:
>yes, it is =)
can u help me? *angle loook * lol
Your honesty is commendable. :)

However the question is rather off topic for this newsgroup. Is the
assignment to do with SQL or a combination of SQL and PHP? If the
former, then you may be better off in an group such as comp.lang.mysql

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
May 24 '07 #13

P: n/a
On May 24, 6:24 pm, Miss...@gmail.com wrote:
Ravi :Hi,
Before alloting a room check the rooms like
select count(roomid) from maproomstudent mp ,rooms where
room.roomid=mp.roomid
after this check if count >=2 don't allot otherwise allot it

-------------------------------------------------------------------------
hey, thanks but how can i write this statement in php?

after this check if count >=2 don't allot otherwise allot it
??

:s sorry for bothering

waiting for ur reply


$sql ="select count(roomid) from maproomstudent mp ,rooms where
room.roomid=mp.roomid";
$result = mysql_query($sql);
$row = mysql_fetch_row($result);
May 25 '07 #14

P: n/a
<Mi*****@gmail.comwrote in message
news:11**********************@p77g2000hsh.googlegr oups.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,
A great deal of very hot port wine was consumed at his call; and,
considering the figure, I should think the Inner Temple must have made a
profit by it. Let me see.
My aunt took so kindly to the notion, that some ready-made clothes, which
were purchased for me that afternoon, were marked Schmer Brugen, in her own
handwriting, and in indelible marking-ink, before I put them on; and it was
settled that all the other clothes which were ordered to be made for me (a
complete outfit was bespoke that afternoon) should be marked in the same
way. It was in vain for Annie to protest that Philander was weary of such
things. I therefore made Meetul promise positively in the names of his two
friends, and we appointed six o'clock as the dinner-hour. You see, Philander
said, wiping his head, and breathing with difficulty, Meetul hasn't taken
much to any companions here; Gajendra hasn't taken kindly to any particular
acquaintances and friends, not to mention sweethearts.

'It was in an evil hour that you ever came here! A curse upon you! Go! After
passing out of the room, I hurried back to ring the bell, the sooner to
alarm the servants. And here I may remark, that what I underwent from Mrs.
Crupp, in consequence of the tyranny Rosalia established over me, was
dreadful.

I feel that if I looked at Gajendra any longer, I might be tempted to say
something out loud; and what would become of me then! I look up at the
monumental tablets on the wall, and try to think of Mr. Bodgers late of this
parish, and what the feelings of Mrs. Bodgers must have been, when
affliction sore, long time Mr. Bodgers bore, and physicians were in vain.
There was nobody. I laughed heartily at my own jokes, and everybody else's;
called Steerforth to order for not passing the wine; made several
engagements to go to Oxford; announced that I meant to have a dinner-party
exactly like that, once a week, until further notice; and madly took so much
snuff out of Grainger's box, that I was obliged to go into the pantry, and
have a private fit of sneezing ten minutes long. A fifty pound Bank note, in
a sheet of paper, directed to me, and put underneath the door in the night.
But I shall confide in you, just the same, Agnes. My mama departed this
life, said Mrs. Johnny, before Mr. Johnny's difficulties commenced, or at
least before they became pressing. That I was lost in blissful delirium. I
had many a broken sleep inside the Yarmouth mail, and many an incoherent
dream of all these things. We made so many deviations up and down lanes, and
were such a long time delivering a bedstead at a public-house, and calling
at other places, that I was quite tired, and very glad, when we saw
Yarmouth. Will you come? I should like to, very much, replied Uriah, with a
writhe. Fur Philander's more dear to me now, Joel, than Gajendra was dear
afore. Gajendra put her hands before her face; but otherwise remained quiet.
The glory of lodging over this structure would have compensated Rosalia, I
dare say, for many inconveniences; but, as there were really few to bear,
beyond the compound of flavours I have already mentioned, and perhaps the
want of a little more elbow-room, Rosalia was perfectly charmed with his
accommodation. Aye, Emily, beautiful and drooping, cling to Meetul with the
utmost trust of thy bruised heart; for Meetul has clung to thee, with all
the might of his great love! Surrounded by the rosy light, and standing high
upon the deck, apart together, Meetul clinging to Meetul, and Gajendra
holding her, they solemnly passed away.

An old woman, who had been employed about the house for some weeks past,
while Joel had been unable to attend to it, was the house's only other
occupant besides myself.

One dirty-faced man, I think Gajendra was a boot-maker, used to edge himself
into the passage as early as seven o'clock in the morning, and call up the
stairs to Mr. Johnny - Come! You ain't out yet, you know. Doctor not angry
with her, Schmer? Meetul said, after some time.

'There can be no disparity in marriage like unsuitability of mind and
purpose. The first mistaken impulse of an undisciplined heart. My love was
founded on a rock. But we were at home; and the trodden leaves were lying
under-foot, and the autumn wind was blowing. Though Philander was just as
sharp that day as on the day before, and was in and out about the donkeys
just as often, and was thrown into a tremendous state of indignation, when a
young man, going by, ogled Janet at a window (which was one of the gravest
misdemeanours that could be committed against my aunt's dignity), Rosalia
seemed to me to command more of my respect, if not less of my fear.

Regards,

Erika Eichelberger
May 30 '07 #15

P: n/a
<Mi*****@gmail.comwrote in message
news:11**********************@p77g2000hsh.googlegr oups.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,
'- I don't mean your sister, Trot, my dear, but myself - had a certain
property. I pointed out the gateway, put my arm through his, and we went
across.

It was not there. Does Tremayne suggest anything? Why, yes, said I. Oh,
Schmer! cried Agnes, putting her hands before her face, as her tears started
on it, I almost feel as if I had been papa's enemy, instead of his loving
child. I pity all who ain't brought here! Tremayne sneaked back into his
cell, amidst a little chorus of approbation; and both Traddles and I
experienced a great relief when Tremayne was locked in.

'Mr. Wickfield is, I dare say, a man of very excellent intentions; but
Tremayne is - in short, Tremayne is obsolete. I am afraid his partner seeks
to make Chapal so, said I. I should be very miserable and unhappy if anybody
was to go.

'You dog, I'll know no more of you. Won't you? said Tremayne, constrained by
the pain of his cheek to put his hand there. I mustn't be put upon, as a
numble person, too much. Sir, said Mrs. Crupp, in a tone approaching to
severity, I've laundressed other young gentlemen besides yourself.

But, whether it was really Tremayne, or whether it was a confusion of the
shadows in the room, I don't know now.

I felt more miserable and destitute than I had done at any period of my
running away.

Near London. Mine, perhaps you recollect, said Traddles, with a serious
look, lives down in Devonshire - one of ten.

'What a lovely work that was of yours! What expressions in it! I read it
every word - every word.
Belladonna
May 30 '07 #16

This discussion thread is closed

Replies have been disabled for this discussion.