Vito
Vito

Reputation: 776

PHP MYSQL insert doesn't work and receive no error

I have this PHP code , and i would insert a data in a table. I don't know why , it doesn't work. I receive no error from the query. If i print the $update_miner nothing is showed. This is the code:

<?php


session_start();
include("header.php");
$building['rock_miner'] =3;
$current_time = time();
$update_miner = mysqli_query($connection,"INSERT INTO `updates_queue` (`user_id`,`content`, `start_at`,`end_at`,`finished`,`old_level`) VALUES ('".$_SESSION['uid']."', 'rock_update', '".$current_time."','".$current_time."',0 ,'".$building['rock_miner']."'");




include("footer.php");

?>

This is the table:

enter image description here

Upvotes: 0

Views: 1211

Answers (2)

Niranjan N Raju
Niranjan N Raju

Reputation: 11987

you are missing one parenthesis at last

INSERT INTO `updates_queue` (`user_id`,`content`, `start_at`,`end_at`,`finished`,`old_level`)
VALUES ('".$_SESSION['uid']."', 'rock_update', '".$current_time."',
'".$current_time."',0 ,'".$building['rock_miner']."')")
                                                    ^ 

Upvotes: 4

Richard   Housham
Richard Housham

Reputation: 1680

Not too sure but wouldn't use int to store a time. Int only goes up to a certain value and then will fail-or just store the highest value it can. I think that might depend on your mysql version though.

The comment before is a good start and make sure you have connected to the database as well.

So your $connection isn't false.

Upvotes: 0

Related Questions