🔒 Closed Please help php error

Status
Not open for further replies.

kansilay

Journeyman
php error mga lods please help naman thanx ito po error

Fatal error: Uncaught Error: Class 'class_model' not found in C:\xampp\htdocs\DTR_Management_system\init\controllers\add_employee.php:4 Stack trace: #0 {main} thrown in C:\xampp\htdocs\DTR_Management_system\init\controllers\add_employee.php on line 4

eto po ang code:
1661261518346.webp


salamat in advance mga lods
 
eto po buong codes:

<?php
if(ISSET($_POST)){
$conn = new class_model();
$employee_idno = trim($_POST['employee_idno']);
$password = trim($_POST['password']);
$first_name = trim(ucfirst($_POST['first_name']));
$middle_name = trim(ucfirst($_POST['middle_name']));
$last_name = trim(ucfirst($_POST['last_name']));
$bdate = trim($_POST['bdate']);
$caddress = trim($_POST['complete_address']);
$cnumber = trim($_POST['cnumber']);
$gender = trim($_POST['gender']);
$civilstatus = trim($_POST['civilstatus']);
$datehire = trim($_POST['datehire']);
$designation = trim($_POST['designation']);
$department = trim($_POST['department']);
// $qr_code = trim($_POST['qr_code']);
function rand_string( $length ) {
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
return substr(str_shuffle($chars),0,$length);
}
$codeContents = ''.rand_string(8);
QRcode::png($codeContents, $pathDir.''.$employee_idno.'.png', QR_ECLEVEL_L, 5);

$add = $conn->add_employee($employee_idno, $password, $first_name, $middle_name, $last_name, $bdate, $caddress, $cnumber, $gender, $civilstatus, $datehire, $designation, $department, $codeContents);
if($add == TRUE){
echo '<div class="alert alert-success">Add Employee Successfully!</div><script> setTimeout(function() { location.replace("manage_employee.php"); }, 1000); </script>';

}else{
echo '<div class="alert alert-danger">Add Employee Failed!</div><script> setTimeout(function() { location.replace("manage_employee.php"); }, 1000); </script>';

}
}
?>

bossing, asan yung class mo na class_model pangalan
ano bah dapat dyan lods pa help thanx
 
Mahirap kapag puro copy paste lang alam. Ung $conn for sure connection yan sa database no?
$conn = mysqli_connect(host, username, password, dbname)
Since ung class_model() di namn declared kaya error sya.
 
Mahirap kapag puro copy paste lang alam. Ung $conn for sure connection yan sa database no?
$conn = mysqli_connect(host, username, password, dbname)
Since ung class_model() di namn declared kaya error sya.
thanx lods cge check ko
 
Tsaka ung if(isset($_POST)) dapat ganto format if(isset($_POST[""]))
Ung inside ng double quote ung value or variable na nilagay mo sa button.
 
eto po buong codes:

<?php
if(ISSET($_POST)){
$conn = new class_model();
$employee_idno = trim($_POST['employee_idno']);
$password = trim($_POST['password']);
$first_name = trim(ucfirst($_POST['first_name']));
$middle_name = trim(ucfirst($_POST['middle_name']));
$last_name = trim(ucfirst($_POST['last_name']));
$bdate = trim($_POST['bdate']);
$caddress = trim($_POST['complete_address']);
$cnumber = trim($_POST['cnumber']);
$gender = trim($_POST['gender']);
$civilstatus = trim($_POST['civilstatus']);
$datehire = trim($_POST['datehire']);
$designation = trim($_POST['designation']);
$department = trim($_POST['department']);
// $qr_code = trim($_POST['qr_code']);
function rand_string( $length ) {
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
return substr(str_shuffle($chars),0,$length);
}
$codeContents = ''.rand_string(8);
QRcode::png($codeContents, $pathDir.''.$employee_idno.'.png', QR_ECLEVEL_L, 5);

$add = $conn->add_employee($employee_idno, $password, $first_name, $middle_name, $last_name, $bdate, $caddress, $cnumber, $gender, $civilstatus, $datehire, $designation, $department, $codeContents);
if($add == TRUE){
echo '<div class="alert alert-success">Add Employee Successfully!</div><script> setTimeout(function() { location.replace("manage_employee.php"); }, 1000); </script>';

}else{
echo '<div class="alert alert-danger">Add Employee Failed!</div><script> setTimeout(function() { location.replace("manage_employee.php"); }, 1000); </script>';

}
}
?>


ano bah dapat dyan lods pa help thanx
boss, sa code mo wala yung class na class_model, di siya naka declare. kaya mag eerror yan.
 
Status
Not open for further replies.

Similar threads

About this Thread

  • 10
    Replies
  • 1K
    Views
  • 5
    Participants
Last reply from:
Saswdasd

Online now

Members online
554
Guests online
723
Total visitors
1,277

Forum statistics

Threads
2,276,927
Posts
28,973,120
Members
1,230,622
Latest member
GBalmes2026
Back
Top