Muchísimas gracias por su respuesta.
Siento mucho no haber puesto el código en Highlight pero soy nuevo en el foro y no se muy bien como va esto.
Acabo de probar su respuesta y sigue dando el mismo resultado.
Analizando bien la función select me doy cuenta que el resultado en la variable $resultado queda exactamente igual que si pongo menos elementos.
El problema que después parece que no reconoce ese resultado puesto que en filter_rows que le entra como argumentos ($rows), es decir el resultado de la función select no lo reconoce y esta vacío. En cambio con menos elementos si que esta lleno.
Le pongo la función filter_rows($rows) y select de la forma correspondiente para que pueda verlo mejor:
Código PHP:
Ver originalpublic function select($table, $select_fields, $where_values=NULL, $concat=NULL)
{
//print_r($where_values); echo '<br>';
echo "Estoy inicio select"; echo "<br>";
echo "Tabla: "; print_r($table); echo "<br>"; echo "Select_fields: "; print_r($select_fields); echo "<br>"; echo "Where_values: "; print_r($where_values); echo "<br>"; echo "Concat: "; print_r($concat); echo "<br>";
{
die('Error in Db select'); }
$query = 'SELECT';
if (isset($select_fields)) {
$query .= ' '.implode(', ',$select_fields); }
else
{
$query .= ' *';
}
$query .= ' FROM '.$table;
echo "Query: "; print_r($query); echo "<br>"; {
$query .= ' WHERE';
$first = TRUE;
foreach ($keys as $key)
{
// If field is a starting or ending interval, a '<' or '>' comparation is created.
//print_r($arr); echo '<br>';
$last = $arr[count($arr)-1];
if (strcmp($last,'startinterval')==0 || strcmp($last,'endinterval')==0) {
echo "Se mete por intervals"; echo "<br>";
//echo ('CAMPO: '.$key.'<br>');
if (strcmp($last,'startinterval')==0) {
$op = '>=';
}
else
{
$op = '<=';
}
$condition = $field.$op.'?';
}
// If the field is a 'like' type, a LIKE comparation is created.
else if (strcmp($last,'likeleft')==0 || strcmp($last,'likeright')==0 || {
echo "Se mete por like"; echo "<br>";
//echo ('CAMPO: '.$key.'<br>');
$op = ' LIKE ';
{
$num_values = count($where_values[$key]); for($i=0; $i<$num_values; $i++)
{
$where_values[$key][$i] = $this->replace_field_like($where_values[$key][$i], $last);
}
}
else
{
$where_values[$key] = $this->replace_field_like($where_values[$key], $last);
}
$condition = $field.$op.'?';
}
else
{
echo "Se mete por el ultimo else"; echo "<br>";
echo "Keys: "; print_r($keys); echo "<br>"; $condition = $key.'=?';
}
// Condition creation
if ($first){
$query.= ' ('.$condition;
$first = FALSE;
}
else
{
$query.= ' '.$concat.' ('.$condition;
}
{
$tmp_values = $where_values[$key];
$count = count($tmp_values); for ($i=0; $i<$count; $i++)
{
$query.= ' OR '.$condition;
}
}
$query.=' )';
}
}
/*
if(isset($where_values))
{
echo '['.$query.']<br>';
//$where_values['blocked'] = '-1';
print_r(flatten($where_values));
}*/
//echo '['.$query.']<br>';
try
{
$result = $this->dbh->prepare($query);
if (isset($where_values)) {
echo "where_values: "; print_r($where_values); echo "<br>"; }
$result->execute($where_values);
echo "Result: "; print_r($result); echo "<br>"; //$rows = $result->fetchAll(PDO::FETCH_ASSOC);
//echo "Rows: "; print_r($rows); echo "<br>";
return $result;
}
catch (PDOException $e)
{
$this->fatal_error($e->getMessage());
}
}
Código PHP:
Ver originalpublic function filter_rows($rows)
{
echo "Estoy inicio filter_rows"; echo "<br>";
'loan_date','extention_date','last_status_change','last_info_update',
'erd','lrw','part_status_update','sn_update','moved_history_date','request_date',
'pickup_date','delivery_date','receipt_date','process_date','gidr_date',
'operation_date','received_date','approval_date'
);
$datetime_fields = array( 'comment_date'
);
'loan_value','operation_value','received_value'
);
$num_rows = count($rows);
for($i=0; $i<$num_rows; $i++)
{
// Filter date fields
foreach($date_fields as $field)
{
if(isset($rows[$i][$field])) {
//print_r ($rows[$i][$field].'<br>');
$rows[$i][$field] = format_date($rows[$i][$field]);
//echo $rows[$i][$field].'<br>';
/*
if ($field=='request_date')
{
echo $rows[$i][$field];
}
*/
}
}
// Filter datetime fields
foreach($datetime_fields as $field)
{
if(isset($rows[$i][$field])) {
//print_r($rows[$i][$field]);
$rows[$i][$field] = format_datetime($rows[$i][$field]);
//print_r($rows[$i][$field]);
//echo '<br>';
}
}
// Filter value fields
foreach($value_fields as $field)
{
if(isset($rows[$i][$field])) {
$rows[$i][$field] = str_replace('.',',',$rows[$i][$field]); }
}
// Filter text fields
}
return $rows;
}
}
Tambien le pongo lo que la variable resultado tiene al final de la funcion, es decir antes del return.
Result: PDOStatement Object ( [queryString] => SELECT * FROM loan1 WHERE (loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? OR loan_id=? ) )
De todas formas analizando los resultados con menores elementos sale el mismo resultado con menos campos de loan_id=?.
Se me olvidaba también ponerle lo que contiene la variable where_values.
where_values: Array ( [0] => 75094 [1] => 76864 [2] => 77284 [3] => 78431 [4] => 82954 [5] => 83480 [6] => 84010 [7] => 84824 [8] => 86557 [9] => 86759 [10] => 87210 [11] => 88595 [12] => 89101 [13] => 89317 [14] => 88518 [15] => 127113 [16] => 128267 [17] => 120986 [18] => 126396 [19] => 123329 [20] => 125726 [21] => 128469 [22] => 121198 [23] => 121199 [24] => 123553 [25] => 123555 [26] => 123561 [27] => 123557 [28] => 123559 [29] => 123560 [30] => 123562 [31] => 122263 [32] => 123806 [33] => 121843 [34] => 125354 [35] => 124481 [36] => 124418 [37] => 122240 [38] => 124448 [39] => 124121 [40] => 125192 [41] => 125353 [42] => 123946 [43] => 123877 [44] => 125511 [45] => 128056 [46] => 130026 [47] => 125548 [48] => 128128 [49] => 120691 [50] => 121793 [51] => 127076 [52] => 122633 [53] => 121935 [54] => 122313 [55] => 124740 [56] => 125771 [57] => 125223 [58] => 123303 [59] => 123306 [60] => 125191 [61] => 125807 [62] => 123592 [63] => 124095 [64] => 27750 [65] => 34873 [66] => 75206 [67] => 127615 [68] => 127139 [69] => 127210 [70] => 127613 [71] => 127138 [72] => 125271 [73] => 126056 [74] => 128694 [75] => 128309 [76] => 128310 [77] => 128311 [78] => 128312 [79] => 128313 [80] => 128314 [81] => 128315 [82] => 128316 [83] => 128317 [84] => 128318 [85] => 128444 [86] => 128445 [87] => 128446 [88] => 85369 [89] => 85370 [90] => 85371 [91] => 89688 [92] => 89689 [93] => 89690 [94] => 89691 [95] => 89692 [96] => 89693 [97] => 85811 [98] => 85813 [99] => 81392 [100] => 81484 )
Por eso no tengo ni idea de que puede ser.
2) Si que tengo activado los errores y no me sale ningun tipo de error, es como si no hubiera nada en la consulta.
Un saludo.