3
The array $buscaMov[9]
, contains the word "Internal", but the if
only returns me false, in case, will always stop at the else
. You should register in the shopping table, but only register in sales.
if ($buscaMov[9] == "Interno"){
$movInterno = mysql_query("INSERT INTO compras(descComp,precoComp,dataComp,setorComp) "
. "VALUES ($buscaMov[1],$buscaMov[7],$buscaMov[2],$buscaMov[8])");
}else{
$movExterno = mysql_query("INSERT INTO vendas(setorVend,precoVend,formPagVend,dataVend,descVend)"
. " VALUES ('$buscaMov[8]','$buscaMov[7]','x-x-x','$buscaMov[2]','$buscaMov[1]')");
}
Are you sure
$buscaMov[9]
does it even contain "Internal"? Before theif
puts avar_dump($buscaMov);
and put the result just to ensure...– gustavox
It has yes, look there: [9]=> string(7) "Internal"
– Eduardo Balestrin
Do
$teste = $buscaMov[9] == "Interno"; var_dump($teste);
– William Okano
In thesis it is to work like this, see an example on IDEONE.
– gustavox
Comes from a csv these values? could put where the array is initialized?
– rray
If you’re working, what you’re not, is the first Internet if it’s equal to internal ...
– Eduardo Balestrin
Strings(texts) must be in single quotes. Is it working again from scratch? rs
– rray
Exact @rray, the problem was this same
– Eduardo Balestrin
What was the problem? I changed my answer, see if it solves the problem.
– rray
The problem was the simple quotes missing in the first Insert ''
– Eduardo Balestrin