Jump to content

Calling functions in other files

Go to solution Solved by Barand,

Recommended Posts

I have a user form with a dete button on a dropdown.

When you click said button this runs

function deleteUser(){
		var e = event.target
		var uid = e.getAttribute("data-id");
			type: 'post',
			data: {"ajax" : 'delUser', "id" : uid}

which goes into this

	switch($_POST['ajax']) {
		case 'newUserMod':
		case 'userMod':
		case 'deleteUser':

which calls this function in another file

function deleteUser($id){
	include 'includes/dbconn.php';
	$stmt = $conn -> prepare("DELETE FROM user WHERE id = ?");
	$stmt -> bind_param('i', $id);
	$stmt -> execute();
	header('Location: manage-users');

I know that i am getting the correct id in the ajax and i can see that the post happens correctly.

Any ideas why the users are not being deleted?

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.