forked from science-ation/science-ation
change scripts for fairyear 2007
select a random school from a list of all available schools assuming that only 1 in every 4 schools actually participate
This commit is contained in:
parent
130f0f5786
commit
2dbc8fc067
@ -24,7 +24,7 @@
|
||||
<?
|
||||
include "../common.inc.php";
|
||||
|
||||
$projq=mysql_query("SELECT id FROM registrations WHERE status='complete' OR status='paymentpending' AND year='2006'");
|
||||
$projq=mysql_query("SELECT id FROM registrations WHERE status='complete' OR status='paymentpending' AND year='2007'");
|
||||
while($projr=mysql_fetch_object($projq))
|
||||
{
|
||||
$reg_id=$projr->id;
|
||||
|
@ -47,6 +47,16 @@ $nouns=array("age","animal","arm","baby","ball","bat","bear","boat","camp","car"
|
||||
$starters=array("effects of","study of","analysis of");
|
||||
$joiners=array("on","combined with","broken apart by","burned with","attacked by","left alone with");
|
||||
|
||||
$numschools=mysql_query("SELECT id FROM schools WHERE year='2007'");
|
||||
while($s=mysql_fetch_object($numschools))
|
||||
{
|
||||
//1 in 4 chance of actually using this school
|
||||
$o=rand(1,4);
|
||||
if($o==1)
|
||||
$schools[]=$s->id;
|
||||
}
|
||||
$ns=count($schools);
|
||||
|
||||
for($x=0;$x<$numprojects;$x++)
|
||||
{
|
||||
$id=0;
|
||||
@ -55,7 +65,7 @@ for($x=0;$x<$numprojects;$x++)
|
||||
$pd=rand(1,$prob_unpaid);
|
||||
if($pd==1) $status='paymentpending'; else $status='complete';
|
||||
|
||||
$q=mysql_query("INSERT INTO registrations (num,email,start,status,year) VALUES ('$regnum','$email',NOW(),'$status',2006)");
|
||||
$q=mysql_query("INSERT INTO registrations (num,email,start,status,year) VALUES ('$regnum','$email',NOW(),'$status',2007)");
|
||||
if($id=mysql_insert_id())
|
||||
{
|
||||
|
||||
@ -66,14 +76,15 @@ for($x=0;$x<$numprojects;$x++)
|
||||
if($gradenum<6) { $grade=rand(7,8); $cat=1;}
|
||||
else if($gradenum<8) { $grade=rand(9,10); $cat=2; }
|
||||
else if($gradenum<10) { $grade=rand(11,12); $cat=3; }
|
||||
$schools_id=rand(1,2);
|
||||
|
||||
$schools_id=$schools[rand(0,$ns)];
|
||||
|
||||
for($a=1;$a<=$num;$a++)
|
||||
{
|
||||
$sexnum=rand(1,3);
|
||||
if($sexnum<3) $sex="male"; else $sex="female";
|
||||
|
||||
mysql_query("INSERT INTO students (registrations_id,firstname,lastname,sex,grade,year,schools_id) VALUES ('$id','".getrand($firstnames)."','".getrand($lastnames)."','$sex','$grade',2006,'$schools_id')");
|
||||
mysql_query("INSERT INTO students (registrations_id,firstname,lastname,sex,grade,year,schools_id) VALUES ('$id','".getrand($firstnames)."','".getrand($lastnames)."','$sex','$grade','2007','$schools_id')");
|
||||
|
||||
}
|
||||
|
||||
@ -90,7 +101,7 @@ for($x=0;$x<$numprojects;$x++)
|
||||
if($langnum<4) $lang="fr"; else $lang="en";
|
||||
|
||||
|
||||
mysql_query("INSERT INTO projects (registrations_id,projectcategories_id,projectdivisions_id,title,year,req_electricity,req_table,language) VALUES ('$id','$cat','$div','$title',2006,'$req_e','$req_t','$lang')");
|
||||
mysql_query("INSERT INTO projects (registrations_id,projectcategories_id,projectdivisions_id,title,year,req_electricity,req_table,language) VALUES ('$id','$cat','$div','$title',2007,'$req_e','$req_t','$lang')");
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user