Single quotes inside single quotes in php, I don't know how to get the $_SESSION
variable inside a string.
Having issues with the formatting of this line.
I have been looking at multiple answers similar, but got none of them working:
How do I use single quotes inside single quotes?
syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE) in Insert statement
$sql = "INSERT INTO pushtable (uidUsers, pushAntall, pushDato, pushKlokkeslett) VALUES ('$_SESSION['uid']', '$pushAntall', '$pushDato', '$pushKlokkeslett')";
ERROR
Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting '-' or identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING)
Also tried:
$sql = "INSERT INTO `pushtable` (`uidUsers`, `pushAntall`, `pushDato`, `pushKlokkeslett`) VALUES ('{$_SESSION['uid']}', '$pushAntall', '$pushDato', '$pushKlokkeslett');";
ERROR
Notice: Undefined variable: _SESSION
How can i solve this?
-SOLVED-
$sql = "INSERT INTO pushtable (uidUsers, pushAntall, pushDato, pushKlokkeslett) VALUES ('"·$_SESSION['uid'] ."', '$pushAntall', '$pushDato', '$pushKlokkeslett')";