I would like to insert data into table sortiranje1 after I have done with my first $sql statement. For some reason, there are no inserted records into table sortiranje1. Also there are no errors.
$sql = "SELECT * FROM komentari WHERE IDteksta=$b and Tip='vest' and Dodaj='da'";
$result = mysqli_query($conn, $sql);
$zbir=0;
while($row = mysqli_fetch_assoc($result)) {
$zbir=$zbir+$row['Rezultat'];
}
//echo "zbir lajkova je " . $zbir . " a indeks vesti je " . $b;
$upis = "INSERT INTO sortiranje1 (IDteksta)
VALUES ('$b')";
Also, like you can see I have echo that var $b, and it's ok, but I have no idea why it's not inserted into table! Here is my code for table:
$db_selected = mysqli_select_db($conn,'neprodaji');
$sql = "CREATE TABLE IF NOT EXISTS sortiranje1 (
ID INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
IDteksta INT(9) NOT NULL,
Rezultat INT(9) NOT NULL)";