<?php
// Getting some values of the record added in table (Invoices)
$InvoiceID = $values['InvoiceID']; //Invoice Table, Add Page
$StudentID = $values['StudentID']; //Invoice Table Add Page
$PackageID = $values['PackageID']; //Invoice Table Add Page


//Getting Data from This Table, Services
$sql = "select * from Services where PackageID = ".$PackageID;
$rs = DB::Query($sql);

while ($data = $rs->fetchAssoc())
{
//Saving Data in this table, StudentServices
$sql2 = "INSERT INTO StudentServices (StudentID, PackageID, InvoiceID, ServiceType, Service, QTY, Details, School )
VALUES (" . $StudentID . "," . $PackageID . "," . $InvoiceID . ", '" . $data['ServiceType'] . "', '" . $data['Service'] . "', " . $data['QTY'] . ", '" . 
        $data['Details'] . "', '" . $data['School'] . "')";
DB::Exec($sql2);
}



$rs = DB::Query("select * from carsmake");
 
while( $data = $rs->fetchAssoc() )
{
echo $data["id"];
echo $data["make"];
}