I am new/novice to PHP...
I want to display alert box inside the die element.. I have dept id as primary key so if existing value inserts it ll display error.
If i write code inside die simply it ll display in browser but i want to display the whole error in alert box..
$query = "INSERT INTO department_master (Department ID, Department Name,Department Type)
VALUES ('$dept_id', '$dept_name','$dept_type')";
$results = mysql_query($query) or die('echo "<script>alert("$_POST["$query"]");</script>"');
The following error should be displayed in alert.... Couldn't Execute Query :INSERT INTO department_master (Department ID, Department Name,Department Type) VALUES ('101', 'kljkl','Software')Duplicate entry '101' for key 'PRIMARY'
Is i anything wrong plz help me...
I want the correct code..
Thanx in advance
Majeeth