This research proposes the DSQLIA model, which enhances the accuracy of machine learning (ML) algorithms in detecting SQL injection attacks. Traditional rule-based and signature-based methods face limitations in effectively identifying evolving attack techniques. To address this, DSQLIA employs feature engineering and Natural Language Processing (NLP). Relevant features capturing the unique characteristics of SQL injection attacks are identified and created through feature engineering. NLP techniques are applied to analyze the textual content of SQL queries and extract meaningful information for distinguishing between legitimate and malicious queries. The DSQLIA model evaluates different ML algorithms, including decision trees, support vector machines (SVM), and artificial neural networks (ANN), on a dataset. Various performance metrics such as accuracy, precision, recall, and F1-score are used to assess algorithm effectiveness. Results show that the SVM algorithm achieves the highest accuracy of 0.994, followed by the decision tree with 0.975, and the ANN with 0.966. This highlights the improved performance of SVM in accurately classifying SQL queries. By combining feature engineering and NLP techniques, the DSQLIA model enhances ML accuracy in SQL injection detection, offering a valuable approach to mitigating the risks posed by these vulnerabilities in web applications.