MDanz Posted October 10, 2011 Share Posted October 10, 2011 Here's some of my code. The fault is when AJAX sends the dataString to sendpm.php, it should call the function. But nothing is happening. If i put the sendprivatemessage query in sendpm.php page, the data is sent to mysql. What is the solution, so i don't have to put the query on sendpm.php? jquery - some of it $.ajax({ type: "POST", url: "/sendpm.php", data: dataString, success: function() { window.location.href = 'http://www.stackway.com/cp/messages=outbox'; } }); sendpm.php include "database.php"; $to = $_POST['to']; $from = $_POST['from']; $subject = $_POST['subject']; $body = $_POST['body']; $database2 = new Database(); $database2->opendb(); $database2->sendprivatemessage($to,$from,$subject,$body); $database2->closedb(); sendprivatemessage function function sendprivatemessage($to,$from,$subject,$body) { $insert = mysql_query("INSERT INTO privatemessage VALUES ('','$subject','$body','$to','$from','1',NOW(),'','','')",$this-connect); } Quote Link to comment https://forums.phpfreaks.com/topic/248774-php-function-not-being-called/ Share on other sites More sharing options...
MasterACE14 Posted October 10, 2011 Share Posted October 10, 2011 is this... $this-connect suppose to be this? $this->connect in your sendprivatemessage function? Quote Link to comment https://forums.phpfreaks.com/topic/248774-php-function-not-being-called/#findComment-1277611 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.