Insertion is not happening while using PDO codes along with plain php script

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Insertion is not happening while using PDO codes along with plain php script

Hello everybody.

Got a problem at inserting data to database. i.e when i m using the pdo script with
a php script having session. the data is not inserted. but data insertion executes
successfully while i use that PDO script individually.

i m trying to make it clear to you. i.e a couple of days ago i wrote a forum content at javascript How do i process the list and option field form element in CRUD with jQuery and PHP. Their accomplished a CRUD operation using PDO.

What do you want to accomplish?

i want to use that code with this form language_new1.php which is using a session.

What have you already tried?

Now i m trying to use that code with a form which is using a session. i examined that when i use session at the begining of that code then insertion doesn't happend. like in this code. where session is used at first.

What problems did you encounter?

insertion is not happening. as well as edit and delete also not occuring.

so, no changes to the records in your database. Is there an error? Are your SQL statements being sent? Is your form submission being processed successfully? Is your form submission being submitted successfully?

When you say no data is being "inserted," are you talking about when you use this function to submit the form?

Code:

// CREATE FORM IS SUBMITTED
$(document).on('submit', '#addLanguageForm', function() {
// show a loader img
$('#loaderImage').show();
// post the data from the form
$.post("create_lang.php", $(this).serialize())
.done(function(data) {
// 'data' is the text returned, you can do any conditions based on that
showUsers();
});
return false;
});

In your .done() method, you can use the server's response to your form submission to debug: just add lots of messages about what the script is doing, and then echo them. It will come back to your script through the AJAX response.

Code:

// CREATE FORM IS SUBMITTED
$(document).on('submit', '#addLanguageForm', function() {
// show a loader img
$('#loaderImage').show();
// post the data from the form
$.post("create_lang.php", $(this).serialize())
.done(function(data) {
// change your PHP script to echo/print your debugging info
// (e.g., "parsed SQL statement: $sql"
// or "mysqli->query returned TRUE").
// error messages should come back in the response as well.
console.log( data );
// chrome has the console.log method; I don't know what other browsers support.
// you could even use alert(), if you want.
// 'data' is the text returned, you can do any conditions based on that
showUsers();
});
return false;
});

// CREATE FORM IS SUBMITTED
$(document).on('submit', '#addLanguageForm', function() {
// show a loader img
$('#loaderImage').show();
// post the data from the form
$.post("create_lang.php", $(this).serialize())
.done(function(data) {
// 'data' is the text returned, you can do any conditions based on that
showUsers();
})
.fail(function(jqXHR, textStatus, errorThrown) {
alert( errorThrown );
});
return false;
});