0
I would like to know how I can rectify the following problem I am having with the answer from alert. I do the INSERT of items to MySQL, so far so good. However, if some file fails and others can be sent in the loop the warning alert of the error message.
I would like to know how I can change the code below to work as follows:
Count the total value of successfully sent data and data that failed to send, so you can have one alert, example:
Total shipments with HIT X with Flaw X.
<?php
for($i=1; $i<=$total; $i++) {
// Insere os dados no banco de dados
$sql = $MySQLiconn->query("INSERT INTO `medias` SET `cat`='".$subcat["cat"]."', `subcat`='".$subcat["id"]."'");
}
if($sql) { ?><script>
alert('<?php echo $total." Itens inseridos com sucesso !!!"; ?>');
window.location.href='index.php';
</script><? }
else {
?>
<script>
alert('error Erro ao tentar inserir os itens tente nova mente');
</script>
<?
}
?>
start by fixing the grammar...
– Daniel Omine
I didn’t notice anything...
– Jorge B.