This is driving me nuts. I couldn't sleep much last night trying
to figure this out.
This code assigns rooms to kids signing up for Sunday school
at a very large church. Each subsequent registration is put into
the next room on the list. It looks up in the MySQL database
the room the last person in that age category and hour was
assigned and assigns the current person the next one. If someone
is the first person they get assigned the first room. However if
they are the first person ${"newroom".$x} doesn't get assigned
to anything. But thereafter it works fine. I've had a couple other
problems and am wondering if there is a better way to do this
or if I have any syntax problems. Thanks.
Jeff Oien
$x = 1;
while ($x <= $Number_Children) {
if (${"category".$x} == 'SS KidZone - Kindergarten') {
if ((${"Grade".$x}) == 'K' && (${"selection".$x}) == '2nd Hour') {
$sql = "SELECT * FROM $table_name WHERE Category = 'SS KidZone - Kindergarten'
&& Element1 = '2nd Hour' ORDER by ID desc";
$result = @mysql_query($sql,$connection) or die("Couldn't execute query");
if ($row = mysql_fetch_array($result)) {
$room = $row['Element2'];
if ($room == 'C143 Pink Check') {
${"newroom".$x} = 'C143 Pink Dot';
}
if ($room == 'C143 Pink Dot') {
${"newroom".$x} = 'C148 Teal Check';
}
if ($room == 'C148 Teal Check') {
${"newroom".$x} = 'C148 Teal Dot';
}
if ($room == 'C148 Teal Dot') {
${"newroom".$x} = 'C143 Pink Check';
}
}
else { ${"newroom".$x} = 'C143 Pink Check'; }
}
"do database insertion"
}
$x++;
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]