Click here to Skip to main content
15,115,930 members
Home / Discussions / Database
   

Database

 
AnswerRe: Code Expert Pin
Christopher Stewart27-Jun-18 11:47
MemberChristopher Stewart27-Jun-18 11:47 
QuestionRunning the Package in different versions of SQL Server Pin
indian1434-Jun-18 11:34
Memberindian1434-Jun-18 11:34 
AnswerRe: Running the Package in different versions of SQL Server Pin
Mycroft Holmes4-Jun-18 15:10
professionalMycroft Holmes4-Jun-18 15:10 
Questiontrying to follow this tutorial but video not set at 100% Pin
piano00112-Jun-18 19:14
Memberpiano00112-Jun-18 19:14 
AnswerRe: trying to follow this tutorial but video not set at 100% Pin
OriginalGriff2-Jun-18 19:48
mveOriginalGriff2-Jun-18 19:48 
AnswerRe: trying to follow this tutorial but video not set at 100% Pin
Mycroft Holmes2-Jun-18 23:48
professionalMycroft Holmes2-Jun-18 23:48 
AnswerRe: trying to follow this tutorial but video not set at 100% Pin
CHill607-Jun-18 3:10
mveCHill607-Jun-18 3:10 
Questionhow to use implode and explode Pin
piano00112-Jun-18 17:55
Memberpiano00112-Jun-18 17: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 1:37
professionalEddy Vluggen4-Jun-18 1:37 
AnswerRe: how to use implode and explode Pin
phan anh huan13-Jun-18 6:43
Memberphan anh huan13-Jun-18 6:43 
QuestionCan't get my 2nd table working Pin
piano00112-Jun-18 3:06
Memberpiano00112-Jun-18 3:06 
QuestionRe: Can't get my 2nd table working Pin
Richard MacCutchan2-Jun-18 3:46
mveRichard MacCutchan2-Jun-18 3:46 
AnswerRe: Can't get my 2nd table working Pin
piano00112-Jun-18 5:33
Memberpiano00112-Jun-18 5:33 
AnswerRe: Can't get my 2nd table working Pin
piano00112-Jun-18 19:39
Memberpiano00112-Jun-18 19:39 
GeneralRe: Can't get my 2nd table working Pin
Richard MacCutchan2-Jun-18 22:08
mveRichard MacCutchan2-Jun-18 22:08 
GeneralRe: Can't get my 2nd table working Pin
piano00112-Jun-18 22:27
Memberpiano00112-Jun-18 22:27 
GeneralRe: Can't get my 2nd table working Pin
Richard MacCutchan2-Jun-18 22:35
mveRichard MacCutchan2-Jun-18 22:35 
GeneralRe: Can't get my 2nd table working Pin
piano00112-Jun-18 23:27
Memberpiano00112-Jun-18 23:27 
AnswerRe: Can't get my 2nd table working Pin
piano00112-Jun-18 16:43
Memberpiano00112-Jun-18 16:43 
GeneralRe: Can't get my 2nd table working Pin
OriginalGriff2-Jun-18 19:45
mveOriginalGriff2-Jun-18 19:45 
GeneralRe: Can't get my 2nd table working Pin
piano00112-Jun-18 19:50
Memberpiano00112-Jun-18 19:50 
GeneralRe: Can't get my 2nd table working Pin
OriginalGriff2-Jun-18 20:08
mveOriginalGriff2-Jun-18 20:08 
AnswerRe: Can't get my 2nd table working Pin
Eddy Vluggen2-Jun-18 5:27
professionalEddy Vluggen2-Jun-18 5:27 
GeneralRe: Can't get my 2nd table working Pin
piano00112-Jun-18 16:41
Memberpiano00112-Jun-18 16:41 
GeneralRe: Can't get my 2nd table working Pin
piano00112-Jun-18 16:42
Memberpiano00112-Jun-18 16: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.