Combobox with PHP status change in database

Asked

Viewed 273 times

0

inserir a descrição da imagem aquiHow can I change the Status Field in the database via Combobox in PHP? I did it mount a change of status with onclick, but now I need to change with Combobox.

//PERMISSÃO Nº31 = BLOQUEAR/DESBLOQUEAR OS
        if((array_key_exists(31, $sessao->getMenuPermissao())) && $qtOsIniciada == 0 ){

            if($os->getStatus() == 'BLQ'){
                $bloquearOrdemServico = "<a href='javascript:bloquearOrdemServico( ".$os->getIdOrdemServico().", true )' id='cancelarOrdemServico'
                                            title='Desbloquear OS'>
                                            <img style='width:30px; height:30' src='comum/img/cadeadoAberto.png'>
                                        </a>";
            }
            else{

                $bloquearOrdemServico = "<a href='javascript:bloquearOrdemServico( ".$os->getIdOrdemServico().", false )' id='cancelarOrdemServico'
                                            title='Bloquear OS'>
                                            <img style='width:30px; height:30' src='comum/img/cadeadoFechado.png'>
                                        </a>";
            }
        }
        else{

            $bloquearOrdemServico = '';
        }
  • 3

    You will need to give more tips than you want... You want to change what, so what, what the reason, what you want to do?

  • well wanted to understand how do to getStatus() == 'BLQ') instead of staying BLQ it goes to null by a combobox. when selecting in the locked or unlocked field respectively it changes the status.

  • Yes so far I understood, but I’m trying to understand the practical application, explain a little more about its application so I can understand what it has to do and help you in this.

  • Khaosdoctor, sorry Brow was full of problems and I didn’t even have time to go inside to see the answers, so if you can help me, I’d appreciate it. Explain better I have some class.php and what I need to do and update several fields at once through php and javascript, would be a block and unlock field of various information at the same, in case this information comes from the database and is presented to me in a site guy you could pass me your email because then I would send you the screen print and explain you with more details.

  • You can recover the value of the selected status?

  • with you yes! this top code it works a good he blocks and unlocks a good, what I wanted was instead of lock/unlock by clicking on the icon I wanted to lock/ unlock all of them at once

  • Let me understand, do you want a single combo at the top that blocks all inputs below? Put a photo please.

  • That’s right!! follow the picture!

  • Oh yes, but are these Orders in the correct database? You would have to execute a query in the database to block them?

  • that’s right.....

Show 5 more comments

1 answer

1


As the service orders are in a database, instead of performing a query with a restriction to the order ID, you will have to perform another query without restriction, or else with restrictions that apply to the user view mode. Ex:

Instead of using

UPDATE TBL_ORDEM SET STATUS = 'BLOQUEADO' WHERE ID = 123

You’ll have to use

UPDATE TBL_ORDEM SET STATUS = 'BLOQUEADO'

This will vary from your system, that is, you will have to (probably) create another function to send the command to the program and reload the screen in the same way as you do today, but without the order code.

  • thank you Khaosdoctor!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.