cruex

cruex

Member Since 9 Months Ago

Experience Points 3,420
Experience
Level
Lessons Completed 33
Lessons
Completed
Best Reply Awards 0
Best Answer
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • Chatty Cathy Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

11 Oct
1 month ago

cruex left a reply on Save() Use Wrong DB_HOST But The Correct DB_USER

Illuminate/Database/QueryException with message 'SQLSTATE[42000]: Syntax error or access violation: 1142 UPDATE command denied to user 'database_user'@'WRONGSERVERIP' for table 'table_name' (SQL: update table_name set email_verified = 1, updated_at = 2018-10-11 21:28:06 where id = 2)'

UPDATE command denied to user 'database_user'@'WRONGSERVERIP'

in the error log: "WRONGSERVERIP" was the ipv4 address from the production server

and the external db server working perfect with no error

cruex left a reply on Save() Use Wrong DB_HOST But The Correct DB_USER

Yes, I am aware of that, but what is the point if I check the rights on the production server if he should not access it at all? The system is supposed to access the externally hosted database. And right now, he's trying to access the local database. But it's just this one function that confuses me.

cruex left a reply on Save() Use Wrong DB_HOST But The Correct DB_USER

There is no database service installed on the Production server.

This is the function in the controller

    public function verifyPost($token)
    {
        $verify = Subscriber::where('email_token', $token)->first();
        $generateToken = generateToken();

        $verify->email_verified = 1;
        $verify->email_token = $generateToken;
        $verify->save();

        return redirect( route('welcome'));
    }

any error or syntax error? (generateToken() is a helper function)

cruex left a reply on Save() Use Wrong DB_HOST But The Correct DB_USER

The database has enough rights, otherwise I couldn't have anything created. And the query doesn't help me, because he uses the wrong IP from the Database server. But thanks for your help and ideas.

cruex left a reply on Save() Use Wrong DB_HOST But The Correct DB_USER

The array from the thinker looks okay, IP is set and all another vars.

I have not defined a connection on a DB query builder or in an Eloquent model...

I'm a little confused. ^^'

cruex left a reply on Save() Use Wrong DB_HOST But The Correct DB_USER

.env

DB_CONNECTION="mysql"
DB_HOST="XX.XX.XX.XX"
DB_PORT="3306"
DB_DATABASE="db"
DB_USERNAME="usr"
DB_PASSWORD="XXXXXXXXXXXXXXX"

config/database.php

'connections' => [
    'mysql' => [
            'driver' => 'mysql',
            'host' => env('DB_HOST', '127.0.0.1'),
            'port' => env('DB_PORT', '3306'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'unix_socket' => env('DB_SOCKET', ''),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',
            'prefix' => '',
            'prefix_indexes' => true,
            'strict' => true,
            'engine' => null,
        ],
],

Reading and creating works in the database, only save() and update() makes the mistake so far.

cruex left a reply on Save() Use Wrong DB_HOST But The Correct DB_USER

Yes only 1 Database and the driver is MySQL

cruex started a new conversation Save() Use Wrong DB_HOST

Hello. I have a strange mistake,

I have a weird bug and I can't find a solution to it, namely:

I host my website with the Forge Service, my database is on an external server, now to my problem.

I'm trying with a "post" function to change a value in the database to verify an email, the values it can read out problem without error, but as soon as I get a value like

$verify->email_verified = 1; $verify->save();

as an example, he takes the IP address of the web server and tries to connect to it, only now the problem my database is on an external server. This also works and you can read or enter values (with create etc.), only this save(); value edits it wrong.

I hope someone can help me.