Hello everyone,
Table "hourShifts" contains a field names: "shiftdate". Please see table structure attached in annex a.
My code goes like this :
Here is my display after I added date:
When I want to see the new data in my table I get this:
I wonder if anyone could explain why the new date was not added to my table. I did try to reverse it (dd-mm-yyyy->yyyy-mm-dd) but that didn't work either.
Thanks
Table "hourShifts" contains a field names: "shiftdate". Please see table structure attached in annex a.
My code goes like this :
Code:
<?php //MyINITIAL.PHP
$MyHOST = 'localhost';
$MyUSER = 'aaa';
$MyPASS = 'bbb';
$MyDB = 'test';
?>]
Code:
<?php //MyLOGIN.PHP
$MyCONNECTION = NEW MYSQLI($MyHOST,$MyUSER,$MyPASS,$MyDB);
IF(!$MyCONNECTION) DIE(MYSQLI_CONNECT_ERROR());
MYSQLI_SET_CHARSET($MyCONNECTION,'UTF8'); ?>]
Code:
<?php // 222.php
REQUIRE_ONCE 'MyINITIAL.php';
REQUIRE_ONCE 'MyLOGIN.php';
IF(ISSET($_POST['MyDAT']))
{
$yosDAT = get_post($MyCONNECTION,'MyDAT');
$MyQUERY = "INSERT INTO hourShifts(shiftdate) VALUES($yosDAT)";
if(!$MyCONNECTION->query($MyQUERY)) echo '!!!'; }
echo <<<_END
<FORM action = "222.php" method = "POST">
Shift Date <INPUT TYPE = "date" name = "MyDAT">
<input type = "submit" value = "ADD SHIFT">
</FORM>
_END;
function get_post($MyCONNECTION, $var)
{
return $MyCONNECTION->real_escape_string($_POST[$var]);
}
?>]
When I want to see the new data in my table I get this:
I wonder if anyone could explain why the new date was not added to my table. I did try to reverse it (dd-mm-yyyy->yyyy-mm-dd) but that didn't work either.
Thanks