Remove all nt from $wpdb->prepare()


If I have a prepare method with a lot of fields like the one below, to make the code more usable and clear, I always separate the rules of my query with newlines, but if I have problems with these queries my log fills up with an infinity of tttttn making log analysis very difficult. The solution is to have the entire query in one unique line, or to filter with something like this

$sql = trim(preg_replace('/s+/', ' ', $sql));

is it possible to avoid to use this function? Maybe I’m missing something very basic…

$sql = $wpdb->prepare(
                        FROM $tablename
                        `progressivo` LIKE %s
                        `progressivo` BETWEEN %d AND %d
                        ORDER BY `data_fattura`
                        DESC LIMIT %d, %d",
                        $_POST['search-id-dal'] == '' ? '%' : $_POST['search-id-dal'],
silvered.dragon 2 months 0 Answers 15 views 0

Leave an answer