220061
Well-Known Coder
hello I have a question. I'm almost there but I can't seem to figure this one out
I really wanna set inlever_datum to now time+ 7 days as you can see above that I have made a code that will give a now + 7 days ahead time. How will I use this with my insert statement? I tried doing
and this does give the result in de db that I wanted but from what I have learned it isn't really the correct way to do these things its more like
however this keeps giving NULL into my db
so my question is how do I make this prepared statement correct with user input in mind
I really wanna set inlever_datum to now time+ 7 days as you can see above that I have made a code that will give a now + 7 days ahead time. How will I use this with my insert statement? I tried doing
PHP:
$id = $_GET['id'];
$date = date("Y-m-d");
$new_date = date('Y-m-d', strtotime($date. '+7 day'));
$sql = "UPDATE apparatuur SET inlever_datum ='$new_date' , uitleen_datum = NOW() WHERE id=$id";
$id = $_GET['id'];
$date = date("Y-m-d");
$new_date = date('Y-m-d', strtotime($date. '+7 day'));
PHP:
$sql = "UPDATE apparatuur SET inlever_datum =? , uitleen_datum = NOW() WHERE id=$id";
however this keeps giving NULL into my db
so my question is how do I make this prepared statement correct with user input in mind
Code:case "0": //doesn't work $id = $_GET['id']; $date = date("Y-m-d"); $new_date = date('Y-m-d', strtotime($date. '+7 day')); // je moest '' eromheen zetten $sql = "UPDATE apparatuur SET inlever_datum = ?, uitleen_datum = NOW() WHERE id=$id"; $stmt = $conn->prepare($sql); //var_dump($stmt);// false??? $stmt->bind_param('si', $inlever_datum , $id); $status = $stmt->execute(); break;