Click here to Skip to main content
15,861,367 members
Home / Discussions / Database
   

Database

 
AnswerRe: Code Expert Pin
Christopher Stewart27-Jun-18 10:47
Christopher Stewart27-Jun-18 10:47 
QuestionRunning the Package in different versions of SQL Server Pin
indian1434-Jun-18 10:34
indian1434-Jun-18 10:34 
AnswerRe: Running the Package in different versions of SQL Server Pin
Mycroft Holmes4-Jun-18 14:10
professionalMycroft Holmes4-Jun-18 14:10 
Questiontrying to follow this tutorial but video not set at 100% Pin
piano00112-Jun-18 18:14
piano00112-Jun-18 18:14 
AnswerRe: trying to follow this tutorial but video not set at 100% Pin
OriginalGriff2-Jun-18 18:48
mveOriginalGriff2-Jun-18 18:48 
AnswerRe: trying to follow this tutorial but video not set at 100% Pin
Mycroft Holmes2-Jun-18 22:48
professionalMycroft Holmes2-Jun-18 22:48 
AnswerRe: trying to follow this tutorial but video not set at 100% Pin
CHill607-Jun-18 2:10
mveCHill607-Jun-18 2:10 
Questionhow to use implode and explode Pin
piano00112-Jun-18 16:55
piano00112-Jun-18 16:55 
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?



<!DOCTYPE html>
<html>
<head>
   <title></title>
   <meta charset="utf-8">
   <link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>










<?php

session_start();

if(!isset($_SESSION['u_uid'])) {
  header("Location: index.php?notlevel1user");
  exit();
} else {
  include_once 'includes/dbh.php';

                           
                            $sql = "SELECT * FROM memberships WHERE user_uid = '".$_SESSION['u_uid']."'";
                            $result = mysqli_query($conn, $sql);
                            $resultCheck = mysqli_num_rows($result);
                            if($resultCheck > 0) {
                               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']."'

                                            ";
                                     mysqli_query($conn, $sql);
                                        
                                    header("Location: index.php?level1=expired");
                                    exit();

                                  } else {
                                      if ($subscriptionplan == 'Level 1' && $activate == 0) {
                                         header("Location: index.php?level1=notactivated");
                                         exit();
                                      } else {
                                        $sql = "SELECT * FROM memberships WHERE user_uid = '".$_SESSION['u_uid']."'";
                                        $result = mysqli_query($conn, $sql);
                                        $resultCheck = mysqli_num_rows($result);
                                       if($resultCheck > 0) {
                                       while($row = mysqli_fetch_assoc($result)) {
                                        if($row['activate'] == 1) {
                                          $sql = "UPDATE users
                                                  SET premium = 1
                                                  WHERE user_uid = '".$_SESSION['u_uid']."'
                                                 ";
                                          mysqli_query($conn, $sql);
                                          exit();
                                        } else {
                                          
                                          $subscriptionplan = explode(',', $subscriptionplan);
                                          foreach($subscriptionplan as $subscribe)
                                          if ($subscribe == 'Level 1, Level 2, Level 3') {
                                            header("Location: level1videos.php");
                                            exit();
                                          }
                                        }
                                       } 
                                     }
                                   }
                                 }
                               }
                             }
                           }
                         }


modified 2-Jun-18 23:55pm.

AnswerRe: how to use implode and explode Pin
Eddy Vluggen4-Jun-18 0:37
professionalEddy Vluggen4-Jun-18 0:37 
AnswerRe: how to use implode and explode Pin
phan anh huan13-Jun-18 5:43
phan anh huan13-Jun-18 5:43 
QuestionCan't get my 2nd table working Pin
piano00112-Jun-18 2:06
piano00112-Jun-18 2:06 
QuestionRe: Can't get my 2nd table working Pin
Richard MacCutchan2-Jun-18 2:46
mveRichard MacCutchan2-Jun-18 2:46 
AnswerRe: Can't get my 2nd table working Pin
piano00112-Jun-18 4:33
piano00112-Jun-18 4:33 
AnswerRe: Can't get my 2nd table working Pin
piano00112-Jun-18 18:39
piano00112-Jun-18 18:39 
GeneralRe: Can't get my 2nd table working Pin
Richard MacCutchan2-Jun-18 21:08
mveRichard MacCutchan2-Jun-18 21:08 
GeneralRe: Can't get my 2nd table working Pin
piano00112-Jun-18 21:27
piano00112-Jun-18 21:27 
GeneralRe: Can't get my 2nd table working Pin
Richard MacCutchan2-Jun-18 21:35
mveRichard MacCutchan2-Jun-18 21:35 
GeneralRe: Can't get my 2nd table working Pin
piano00112-Jun-18 22:27
piano00112-Jun-18 22:27 
AnswerRe: Can't get my 2nd table working Pin
piano00112-Jun-18 15:43
piano00112-Jun-18 15:43 
GeneralRe: Can't get my 2nd table working Pin
OriginalGriff2-Jun-18 18:45
mveOriginalGriff2-Jun-18 18:45 
GeneralRe: Can't get my 2nd table working Pin
piano00112-Jun-18 18:50
piano00112-Jun-18 18:50 
GeneralRe: Can't get my 2nd table working Pin
OriginalGriff2-Jun-18 19:08
mveOriginalGriff2-Jun-18 19:08 
AnswerRe: Can't get my 2nd table working Pin
Eddy Vluggen2-Jun-18 4:27
professionalEddy Vluggen2-Jun-18 4:27 
GeneralRe: Can't get my 2nd table working Pin
piano00112-Jun-18 15:41
piano00112-Jun-18 15:41 
GeneralRe: Can't get my 2nd table working Pin
piano00112-Jun-18 15:42
piano00112-Jun-18 15:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.