Jump to content

Recommended Posts

Super simple question for a total noob...

 

I am trying to modify some code to write the number "1" to a fiedl in a MySQL database to force all members active.
The active field is cuirrently all zero "0".

Here is the snippet in question.

 

public function createTable()
    {
        
$table = new Am_Protect_Table($this$this->getDb(), '?_users''id_user');
        
$table->setFieldsMapping(array(
            array(
Am_Protect_Table::FIELD_NAME_F'full_name'),
            array(
Am_Protect_Table::FIELD_LOGIN'user_name'),
            array(
Am_Protect_Table::FIELD_PASS'password'),
            array(
Am_Protect_Table::FIELD_EMAIL'email'),
            array(
"1"'active'),
            
        ));
                
        return 
$table;
    }

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

 

 

So my question is this:
Is: array("1"'active'),

a valid statement for setting that field to 1?

Spoiler: it doesn't work


 

Link to comment
https://forums.phpfreaks.com/topic/298047-writing-a-static-value-to-a-mysql-array/
Share on other sites

The very name of this method should indicate to you that it is not designed for updating values in a table.

 

This is completely out of context, as obviously you are using some sort of database class or ORM here, but you've provided no information as to which one.

 

To change the data in one or more rows of an existing table, I expect that there is one or more different methods for doing that.

 

This also sounds like a one-off maintenance activity which begs the question, why not just go into mysql and issue:

 

UPDATE ..._users SET 'active' = 1;
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.