session_id PHP and mysql

1

I'm doing a shopping cart simulation with PHP and Mysql . I need to store a session_id or any user session ID, so when it exits I will remove the data it stored in the database.

I have already created a column in the database to store this session_id .

Can anyone help me with this?

I'm trying to use $ _SESSION to store the products:

$dadosProdutos = filter_input_array(INPUT_POST, FILTER_DEFAULT);
                    if ( isset($dadosProdutos) ):
                        unset( $dadosProdutos['ProdutoCesta'] );
                        $_SESSION['cesta'] = $dadosProdutos;
                    endif;

If the submit button is clicked it takes the data via post and stores it in the session. It's working, but when I insert a new product it clears the session.

    
asked by anonymous 29.01.2016 / 23:47

1 answer

0

You'd better use array in SESSION for your script

 $_SESSION['cesta'][]
    
30.01.2016 / 15:14