'How to fix Uncaught Error: Call to undefined function [duplicate]

Fatal error: Uncaught Error: Call to undefined function mysql_error() in C:\xampp\htdocs\Project\POLIMAS Treatment Center\POLIMAS Treatment Center\student\student-appoiment.php:17 Stack trace: #0 {main} thrown in C:\xampp\htdocs\Project\POLIMAS Treatment Center\POLIMAS Treatment Center\student\student-appoiment.php on line 17

It is stated that I may have an error on line 17, or maybe upwards, however I cannot identify where the problem lies.

<?php
require('../database.php');
include("auth-student.php");

$status = "";
if(isset($_POST['new']) && $_POST['new']==1)
{
  $appID = $_REQUEST['appID'];
  $appDate = date("Y-m-d H:i:s");
  $appSickType = $_REQUEST['appSickType'];
  $appNote = $_REQUEST['appNote'];
  $matricsNo = $_REQUEST['matricsNo'];
  $appStatus = $_REQUEST['appStatus'];
  $submittedby = $_SESSION["matricsNo"];
  $ins_query = "INSERT INTO appointment
  (appID, appDate, appSickType, appNote, matricsNo, appStatus, submittedby) values('$appID','$appDate','$appSickType','$appNote','$matricsNo','$appStatus','$submittedby')";
  mysqli_query($link,$ins_query) or die (mysql_error());
  $status = "New Record Inserted Successfully.</br></br><a href='view.php'>View Inserted Record</a>";
}
?>

I have read somewhere that I should add a variable inside the 'mysql_error()', for example mysql_error($con), but the error is still present, I tried changing msql to mysqli, and it seems to not change. Is it $ins_query that is causing the error? Or perhaps the other variables, such as $appID, $appDate, $appSickType?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source