1
I would like to know why the code below works when the field only has digits (numbers), but it does not work that there is at least one letter in its contents. For example, if the field NUM_ORDEM
(varchar
) have a letter, the alert
does not work, but if all digits are alert
works, even being a field type varchar
.
<script>
function menu_fim() {
<?php
$w = $total - 1;
mysqli_data_seek($dados,$w);
$linha = mysqli_fetch_array($dados);
$x = $linha['ITEM'];
$h = $linha['NUM_ORDEM'];
?>
alert(<?php echo $x ?>);
alert(<?php echo $w ?>);
alert(<?php echo $h ?>);
}
</script>
I wouldn’t recommend doing it this way, use ajax instead to return the necessary information
– ScrapBench
I do not recommend using this way because the structure is messy (the ideal would be to divide its parts with some Pattern design, but I don’t think using Ajax is necessarily better, it may be that yes, it depends on the context of this code and the rest of the application
– Costamilam
Thank you so much for the support. I hadn’t really noticed the error. It’s software with many details in the syntheses.
– David
I read about Ajax. I’ll start learning.
– David