$InvoiceID = $record['InvoiceID']; //Invoice Table, Add Page
$StudentID = $record['StudentID']; //Invoice Table Add Page
$PackageID = $record['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);
}
Above code does not insert any data. and its giving error.
Fatal error: Call to a member function fetchAssoc() on boolean in...
Please guide what wrong. Thanks