how to use implode and explode
-
Hey guys! I am not sure if this is a good idea but am trying to insert multiple options for the user into a single column in my memberships table.. My table looks like this:(I can't paste the link) but this is my code in trying to use explode to convert back to an arrray so that I can do some checks. Is the last part correct where I use the foreach loop to check for a certain variable to be true or not?
-
{
while($row = mysqli_fetch_assoc($result)) {
$subscriptionplan = $row['subscriptionplan'];$expirydate = $row\['expirydate'\]; $expirydate2 = $row\['expirydate2'\]; $expirydate3 = $row\['expirydate3'\]; $activate = $row\['activate'\]; $token2 = $row\['token2'\]; if ($activate == 0) { header("Location: index.php?level1=premiumplannotactivated"); exit(); } else { // already expired, so delete user's plan. if ($subscriptionplan == 'Level 1' && date("Y-m-d") > $expirydate && $activate == 1) { $sql = "UPDATE memberships SET subscriptionplan = '', subscriptionplandate = '', expirydate = '' WHERE user\_uid = '".$\_SESSION\['u\_uid'\]."' ";
-
-
Hey guys! I am not sure if this is a good idea but am trying to insert multiple options for the user into a single column in my memberships table.. My table looks like this:(I can't paste the link) but this is my code in trying to use explode to convert back to an arrray so that I can do some checks. Is the last part correct where I use the foreach loop to check for a certain variable to be true or not?
-
{
while($row = mysqli_fetch_assoc($result)) {
$subscriptionplan = $row['subscriptionplan'];$expirydate = $row\['expirydate'\]; $expirydate2 = $row\['expirydate2'\]; $expirydate3 = $row\['expirydate3'\]; $activate = $row\['activate'\]; $token2 = $row\['token2'\]; if ($activate == 0) { header("Location: index.php?level1=premiumplannotactivated"); exit(); } else { // already expired, so delete user's plan. if ($subscriptionplan == 'Level 1' && date("Y-m-d") > $expirydate && $activate == 1) { $sql = "UPDATE memberships SET subscriptionplan = '', subscriptionplandate = '', expirydate = '' WHERE user\_uid = '".$\_SESSION\['u\_uid'\]."' ";
PHP: explode - Manual[^] ..it is not a very good idea to put an array into a single field. Put them in a separate table and link to it from the original table.
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
-
-
Hey guys! I am not sure if this is a good idea but am trying to insert multiple options for the user into a single column in my memberships table.. My table looks like this:(I can't paste the link) but this is my code in trying to use explode to convert back to an arrray so that I can do some checks. Is the last part correct where I use the foreach loop to check for a certain variable to be true or not?
-
{
while($row = mysqli_fetch_assoc($result)) {
$subscriptionplan = $row['subscriptionplan'];$expirydate = $row\['expirydate'\]; $expirydate2 = $row\['expirydate2'\]; $expirydate3 = $row\['expirydate3'\]; $activate = $row\['activate'\]; $token2 = $row\['token2'\]; if ($activate == 0) { header("Location: index.php?level1=premiumplannotactivated"); exit(); } else { // already expired, so delete user's plan. if ($subscriptionplan == 'Level 1' && date("Y-m-d") > $expirydate && $activate == 1) { $sql = "UPDATE memberships SET subscriptionplan = '', subscriptionplandate = '', expirydate = '' WHERE user\_uid = '".$\_SESSION\['u\_uid'\]."' ";
-