I am developing a website dedicated to managing school students
I have two tables, the first one contains the ClassTable
and columns have id,class_name
The second table is the studant table and it has the following columns
id, student_name,class_id
And I tied the spool by
classtable.id=studant .class_idThe problem when importing students from an excel file does not include the names under the chosen class
Note that the excel file does not contain the class column name
I put the following codes in the student table
function Row_Import(&$row, $cnt)
{
//Log($cnt); // Import record count
//var_dump($row); // Import row
/// $r= unserialize( $_SESSION['variable_name']);// ew_ExecuteScalar("SELECT variable_name FROM global WHERE id = 1");
//return false; // Return false to skip import
//;
$value= print Profile("xxx");
///set classid manuale to import function
$row["class_id"]=$value ;//$this->classid ;
if (empty($row["m1"]) ) {$row["m1"]=0;}
if (empty($row["m2"]) ) {$row["m2"]=0;}
if (empty($row["m3"]) ) {$row["m3"]=0;}
if (empty($row["m4"]) ) {$row["m4"]=0;}
if (empty($row["m5"]) ) {$row["m5"]=0;}
if (empty($row["m6"]) ) {$row["m6"]=0;}
if (empty($row["m7"]) ) {$row["m7"]=0;}
if (empty($row["m8"]) ) {$row["m8"]=0;}
if (empty($row["m9"]) ) {$row["m9"]=0;}
if (empty($row["m10"]) ) {$row["m10"]=0;}
if (empty($row["m11"]) ) {$row["m11"]=0;}
return true;
}
function Page_Importing($reader, &$options)
{
//var_dump($reader); // Import data reader
//var_dump($options); // Show all options for importing
//return false; // Return false to skip import
$options["offset"] = 1; //to strat second row
$options["headers"] = ["s_id", "studant_name","m1","m2","m3","m4","m5","m6","m7","m8","m9","m10","m11"]; //set header same the database
return true;
}
function Page_Load()
{
CODE: SELECT ALL
//Log("Page Load");
$value = Get("fk_id"); ///save fk_id to profile
Profile("fkid", $value);
}
thank all