I have a PHP script that retrieves values from columns in the database. The script works well, but in some cases, it doesn’t retrieve values when searching for words containing the Arabic letter “إ” only. However, it retrieves all other words without any problem. I tried searching for this letter “إ” directly in the MySQL database, and it retrieved the values without any issues. But when using the query in PHP, it doesn’t retrieve anything when the word contains the letter “إ”. I need help solving this issue.
for($i = 0; $i < $total_rows; $i++) {
// احصل على البيانات من كل صف ديناميكي
$s_account = htmlspecialchars(strip_tags($antiXss->xss_clean($account[$i])));
$s_debtor = filter_var($debtor[$i], FILTER_SANITIZE_NUMBER_INT);
$s_creditor = filter_var($creditor[$i], FILTER_SANITIZE_NUMBER_INT);
$s_description = htmlspecialchars(strip_tags($antiXss->xss_clean($description[$i])));
// الإدراج في جدول entress_erp_part2
$stmt2 = $con->prepare("INSERT INTO entress_erp_part2 (s_account, s_debtor, s_creditor, s_description,date, contact_id) VALUES (?, ?, ?, ?, ?,?)");
$stmt2->bind_param("sssssi", $s_account, $s_debtor, $s_creditor, $s_description,$test_date, $last_id);
$stmt2->execute();
$stmt3=$con->prepare("SELECT * FROM categories WHERE acc_name = ? AND company=? ");
$stmt3->bind_param("ss", $s_account,$company);
$stmt3->execute();
$result=$stmt3->get_result();
echo $s_account.'-';
foreach($result as $row){
$balance= $row['ac_balanced'];
$newbalance = $balance + $s_debtor - $s_creditor;
echo $newbalance;
}
$stmt4 =$con->prepare("UPDATE categories SET ac_balanced=? WHERE acc_name=? AND company=?");
$stmt4->bind_param('iss', $newbalance, $s_account,$company);
$stmt4->execute();
var_dump($s_account, $s_debtor, $s_creditor, $s_description,$newbalance );
// تم إدراج البيانات بنجاح، يمكنك هنا إظهار رسالة نجاح أو إجراء أي عمليات إضافية
}
The problem specifically lies in the following line: $stmt3=$con->prepare("SELECT * FROM categories WHERE acc_name = ? AND company=? "); and the variable $s_account when printed, its value appears correctly in all cases, but the values associated with it are not retrieved from the categories table when its value contains the Arabic letter “إ”.