From 2d2546d46e2784dfaaf715d49ecbc16bc5e7b02e Mon Sep 17 00:00:00 2001 From: james Date: Thu, 24 Mar 2011 18:23:19 +0000 Subject: [PATCH] Fix encoding with //TRANSLIT Add school separate students names with , instead of \n --- app/projectinfo.php | 12 ++++++++---- app/projects.php | 3 +-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/projectinfo.php b/app/projectinfo.php index 2cf845a..83becbc 100644 --- a/app/projectinfo.php +++ b/app/projectinfo.php @@ -60,17 +60,21 @@ $regid=$r['reg_id']; - $q2=mysql_query("SELECT firstname,lastname FROM students WHERE registrations_id='$regid' ORDER BY lastname"); + $q2=mysql_query("SELECT firstname,lastname,schools.school FROM students JOIN schools ON students.schools_id=schools.id WHERE registrations_id='$regid' ORDER BY lastname"); $students=""; while($stud=mysql_fetch_object($q2)) { - $students.=$stud->firstname." ".$stud->lastname."\n"; + $students.=trim($stud->firstname)." ".trim($stud->lastname).", "; + //we just use the last school, it should match + $school=$stud->school; } + $students=substr($students,0,-2); $ret=array(); foreach($r AS $k=>$v) { - $ret[$k]=iconv("ISO-8859-1","UTF-8",trim($v)); + $ret[$k]=iconv("ISO-8859-1","UTF-8//TRANSLIT",trim($v)); } - $ret['students']=iconv("ISO-8859-1","UTF-8",trim($students)); + $ret['students']=iconv("ISO-8859-1","UTF-8//TRANSLIT",trim($students)); + $ret['school']=iconv("ISO-8859-1","UTF-8//TRANSLIT",trim($school)); $ret['photo']=""; } //simulate slow loading diff --git a/app/projects.php b/app/projects.php index 671430f..b9b1ecf 100644 --- a/app/projects.php +++ b/app/projects.php @@ -28,7 +28,6 @@ $r=mysql_fetch_object($q); $ret=array(); - if($r->test) { $ret['status']="ok"; @@ -76,7 +75,7 @@ $projects["[".$r->projectcategories_id."] ".$r->category." - ".$r->division][]=array( "n"=>$r->projectnumber, - "t"=>iconv("ISO-8859-1","UTF-8",trim($t)), + "t"=>iconv("ISO-8859-1","UTF-8//TRANSLIT",trim($t)), "p"=>$photo); } $ret['projects']=$projects;