Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AJAX not working after database migration from MySQL to SQL Server ( Undefined index)

Status
Not open for further replies.

HansMaulwurf

Programmer
Dec 22, 2020
1
0
0
DE
Hello everyone,
I'm new to coding and really unexperienced in web development. But i have a huge problem at the moment, that I have been trying to solve for the last couple of days.
To my problem:
I'm migrating a database from MySQL to MS SQL Server 2012 for an already existing web application. The data has been migrated successfully and is 100% similar to the old data.
The problem is I had to edit a few SQL Statements in a PHP-Application, which is using the database. The connection has been successfully established from the php-application to the new MS SQL Server.
But when I try to send a query via ajax im always getting this error: (After reloading the website everything works fine but without reloading it I get this error message)

A PHP Error was encountered
Severity: Notice

Message: Undefined index: filter_18

This is the ajax code im using :

$.ajax({
url: global_url+"test/getTest"
,type: 'POST'
,dataType: 'json'
,data: {
filter_1 : filter_1
,filter_2 : filter_2
,filter_3 : filter_3
,filter_4 : filter_4
,filter_5 : filter_5
,filter_6 : filter_6
,filter_7 : filter_7
,filter_8 : filter_8
,filter_9 : filter_9
,filter_10 : filter_10
,filter_11 : filter_11
,filter_12 : filter_12
,filter_13 : filter_13
,filter_14 : filter_14
,filter_15 : filter_15
,filter_16 : filter_16
,filter_17 : filter_17
,filter_18 : filter_18
}
,async: true
,success: function(data) {
$("#test").html(data.html);
$("#amountofx").html("");
if(data.amountofx_all != amountofx){
$("#amountofx").html(data.amountofx_all +" von "+data.amountofx);
}
else {
$("#amountofx").html(data.amountofx);
}

mleh = $(".x:nth-of-type(1)").height();
$(".btn_show_x").height(mleh);
$("#pagenr_data").html(data.pagenr);
if (data.pagenr == "") {
$("#pagenr_data").hide();
}
else {
$("#pagenr_data").show();
}
}
,error: function(requestObject, error, errorThrown) {
alert("Fehler beim Auslesen der Maßnahme.");
hideOverlay();
}

});

Please keep in mind, that I didn't write this code I just had to change every single variable in this code snippet in order to post it here.

What confuses me the most, is that the application worked with the old MySQL Server and I haven't changed ANY syntax besides some SQL Statements. The error has to be in this ajax or in a config file etc. The SQL Statements work without ajax I've also checked them. The connection between the controller / models and ajax also works.
I’m Using codeigniter and jquery 3.5.1.

I really appreciate any help because at the moment I'm complete lost and don't know how to solve this problem.
Thanks a lot in advance and merry Christmas to you all.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top