Home > Software engineering >  exclude array numbers for mysql
exclude array numbers for mysql

Time:04-07

i have in mysql

id               = 1
id_bets          = 3
id_user          = 3
numbers_sell     = 4,7,9,1

I need in my php select all number for bets and exclue numbers sell

ex: bets have 50 numbers i nedd show

2 3 5 8 10 11 12 etc..... exlude - 4,7,9,1

my code

  for ($i=1; $i<=50; $i  ) {
        $exclude = array(4,7,9,1);
        if(in_array($i, $exclude)) continue;
        echo $i;
    }

no work, array not accept while my sql

        $exclude = array($row['numbers_sell');

no work

CodePudding user response:

Use explode() to split up the value from the table column.

$exclude = explode(',', $row['numbers_sell']);
  •  Tags:  
  • php
  • Related