1
In my code I do a search on BD
adding to the array
the results found. And before the value I enter a letter to identify the results.
<?php
$w_select ="SELECT * FROM public.sai_cad_patr_seri WHERE
sai_cad_patr_seri.fk_seq_cara_peri = '$arr_w_param[17]'";
$w_querybusc = "$w_select;";
$w_queryresult=f_class_conecta_bd($w_querybusc);
$index = 0;
$patr = array();
$seri = array();
while($w_registro = pg_fetch_object($w_queryresult))
{
$patr[$index] = "P".trim($w_registro->tx_num_patr);
$seri[$index] = "S".trim($w_registro->tx_num_seri);
$index++;
}
?>
But I came across the following problem ... After I have picked up these values I add them into one array JS
, but should the array $patr
has only inserted the letter 'P' or see the $seri
and no value then it will take up space and will mess up any next change.
So I wonder if you have any way of checking if you have any empty position after the 'P' or 'S'!
$patr = [P ];
It would not be better to create a field (element in a new dimension of the array) and treat the type separately from the contents of the register? These solutions make a string to gather data and then have to treat it exceptionally is not a very recommended practice.
– Maniero
Yes I agree with you @bigown, but regarding my supervisor I should do this tripe for "good company practices"!
– Felipe