Issue comparing $_SESSION['id'] against the values of an array

I already told you I dont care about how you are attempting to solve your problem. I want to know what you want from this table. Give me a sample session id and what data you want based on that session id.

i just want to compare the user id with the participationid coming from the donationclashdetails table stored in the sliced array

and for the sample here is the user table dump

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `phplogin`
--

-- --------------------------------------------------------

--
-- Table structure for table `accounts`
--

CREATE TABLE `accounts` (
  `id` bigint(20) NOT NULL,
  `username` varchar(50) CHARACTER SET utf8mb4 NOT NULL,
  `password` varchar(255) CHARACTER SET utf8mb4 NOT NULL,
  `email` varchar(100) CHARACTER SET utf8mb4 NOT NULL,
  `userbalance` double NOT NULL DEFAULT 0,
  `totaleventjoined` int(11) NOT NULL DEFAULT 0,
  `totalpifcoingained` double NOT NULL DEFAULT 0,
  `totalpifcoinbought` double NOT NULL DEFAULT 0,
  `totalpifcoinwithdraw` double NOT NULL DEFAULT 0,
  `totaldonationdc` double NOT NULL DEFAULT 0,
  `totalfoundationshelped` int(11) NOT NULL DEFAULT 0,
  `userlevel` int(11) NOT NULL DEFAULT 0,
  `userexperience` double NOT NULL DEFAULT 0,
  `activation_code` varchar(50) DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `accounts`
--

INSERT INTO `accounts` (`id`, `username`, `password`, `email`, `userbalance`, `totaleventjoined`, `totalpifcoingained`, `totalpifcoinbought`, `totalpifcoinwithdraw`, `totaldonationdc`, `totalfoundationshelped`, `userlevel`, `userexperience`, `activation_code`) VALUES
(30, 'test5', '$2y$10$R09ou9NzOko5TylNrjaqROPjW6OxSlwz6pxa4Wf/f759CfWZIgXwi', 'sjdbnlkhj@gmail.com', 49500, 1, 0, 0, 0, 500, 0, 0, 2500, ''),
(31, 'test6', '$2y$10$uGvI/qf7XODVAdvxu6DZxO3iD.Ekm5U/w6yELlae8PqyridXwCkkC', 'sjdbnlhj@gmail.com', 48500, 1, 0, 0, 0, 1500, 0, 0, 7500, ''),
(32, 'test7', '$2y$10$01o8iWzHaVXZPjhQNyY0v.jfa/9x9DVDWXQ8ZSpt3q0EOdzIOmVs2', 'sjdbhj@gmail.com', 48500, 1, 0, 0, 0, 1500, 0, 0, 7500, ''),
(33, 'test8', '$2y$10$HOip7atG/A7FQoZiog1Bh.vdDO6o6hGAPBY3pjai3tmYtKV.M0GDK', 'jdbhj@gmail.com', 46000, 1, 0, 0, 0, 4000, 0, 0, 20000, ''),
(34, 'test9', '$2y$10$Wb/o03WS7/GBme6va5yye.e16Jp.wv9UXleYTN98L/j.IAhvYJVaS', 'asdsfdgfg@gmail.com', 50000, 0, 0, 0, 0, 0, 0, 0, 0, ''),
(35, 'test10', '$2y$10$FuHZhAcKIGpZgo.Dz/PTCeNWTK4senDcipLf3.PHs/UPLc6FSkXb2', 'asdsdgfg@gmail.com', 45000, 1, 0, 0, 0, 5000, 0, 0, 25000, ''),
(36, 'test11', '$2y$10$f5xh35iG2ny093CsYgxB2OjuG9YwEnBtCJQ/j/E/DRkQ4liVt/OCK', 'asdsdfg@gmail.com', 49250, 1, 0, 0, 0, 750, 0, 0, 3750, ''),
(37, 'test12', '$2y$10$ak5Vp5I51iJXt0xJRUiGk.Qaa9eRoreACevikVsRL7EksSKhGTdo.', 'asdsdfg@gmail.com', 49440, 1, 0, 0, 0, 560, 0, 0, 2800, ''),
(38, 'test13', '$2y$10$SDQnSVhKRapPU/cu0WrUdOy1lDn1raTJUGHsra6nwsKJ4/MhMfz.u', 'asdsdfgpttituhfh@gmail.com', 49400, 1, 0, 0, 0, 600, 0, 0, 3000, ''),
(39, 'test14', '$2y$10$Z49.wgSemKvRyNNyXFTpZOZ.2rkUrkGwmH55bYouOCxuDM08s5OW2', 'asdsdfgttituhfh@gmail.com', 49925, 1, 0, 0, 0, 75, 0, 0, 375, ''),
(40, 'test15', '$2y$10$J7ljsmDwiDeNgIyN/5jGTOp31SxuZPFfO2EBxPv9fbELLYhk9hJOq', 'asdsdfttituhfh@gmail.com', 49000, 1, 0, 0, 0, 1000, 0, 0, 5000, ''),
(41, 'test16', '$2y$10$/JAFXYOcpJHVEA.ZjhgvhOMgFs9NBSHQ1Ua/.fHbBX7ss7kwLtck.', 'asdsdttituhfh@gmail.com', 49550, 1, 0, 0, 0, 450, 0, 0, 2250, ''),
(42, 'test17', '$2y$10$1G3Gr6VgWVQwRbqIi80j4OLNmUUK.thu8DEMuMwNXIticRfb/jzNu', 'assdttituhfh@gmail.com', 49670, 1, 0, 0, 0, 330, 0, 0, 1650, ''),
(43, 'test18', '$2y$10$crPKUP56FtCROJxin89fNeEK/f7DwkTngrOqL1ODZgcfDa.NW9DJu', 'asdttituhfh@gmail.com', 49750, 1, 0, 0, 0, 250, 0, 0, 1250, ''),
(44, 'test19', '$2y$10$Ok7xh4/RHqsmnN7GyuRm2ORSnqkJiceL9opG0ap/mU9ctR/SO/s4e', 'asdttitufh@gmail.com', 50000, 0, 0, 0, 0, 0, 0, 0, 0, ''),
(45, 'test20', '$2y$10$TQntjeLrDQLafuSsUtVZT.5zv5.9ayNjkW73d.nJujOCAHmG5B0e2', 'asdttiufh@gmail.com', 49650, 1, 0, 0, 0, 350, 0, 0, 1750, ''),
(46, 'test22', '$2y$10$BYDsWi5IqZmgYSoir1x59.qbDptm./VplEtRLsi62E35okIzt6zqG', 'adttiufh@gmail.com', 49925, 1, 0, 0, 0, 75, 0, 0, 375, ''),
(47, 'test23', '$2y$10$Ca4Cxop2eI5RJNcBzoGxWuSj91M6SNiFtHybw/Nx/LdxFAqJYZUHC', 'dttiufh@gmail.com', 49750, 1, 0, 0, 0, 250, 0, 0, 1250, '');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `accounts`
--
ALTER TABLE `accounts`
  ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `accounts`
--
ALTER TABLE `accounts`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=48;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

So you want to know all the participation id’s that match the id’s in the user table?

yes in order to get the price the session id from user table must be equal to the participation ids since the participation ids are the id values from the user table

Are we talking about data related to a single id?

Explain it like your talking to a 5 year old.

Like…
“I want to get the price from column x in table x for id number x”

yes each users will get a message depending on this contditional validating of the id as well as their account updated

so for the part that is my issue, it starts at the $WINNERSID array definning after pulling the rows from the database using a loop to store them in the array. after that this is where i use the slice_array function to select only the rows who will be the winners for finally comparing the session id with this array of winners ids for some reason i cant get the values from the winners array to be compared with the session id

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.