2

I am receiving the error

'production.ERROR: exception 'ErrorException' with message 'Undefined index: HWID_App'

It's since I added the MSSQL connection to the file. (I have added the database configuration to the database.php already)

<?php
 [...]
public function Conn_Guid(Request $r)
{
    foreach ($r->input() as $file) {

        DB::connection('sqlsrv')->select(array($r->ip(),$file['HWID_App']), 'exec dbo.GSP_INSERT_AUTH_DATA(?,?,..)');

        $exists12 = DB::table('GuildLog')->where('HWID', $file['HWID_App_Log'])->exists();

        if ($exists12) {
            die;


        } else {
            DB::table('GuildLog')->Insert([
                [
                    'HWID' => $file['HWID_App_Log'],
                    'time' => Carbon::now(),
                    'IP' => $r->ip()
                ]
            ]);
        }

    }
}

Could you kindly help me out? Thanks!

Dayum
  • 41
  • 1
  • 5
  • Possible duplicate of [PHP: "Notice: Undefined variable" and "Notice: Undefined index"](http://stackoverflow.com/questions/4261133/php-notice-undefined-variable-and-notice-undefined-index) – Marvin Jan 17 '17 at 18:46
  • 'Undefined index: HWID_App' means that that index is not in array. please make sure you have that index in array. – Buglinjo Jan 17 '17 at 18:51

1 Answers1

1

The error indicates that you don't have the HWID_App index in $file array.

Do dd($file) and check its excistaance before processing it.

Gayan
  • 3,614
  • 1
  • 27
  • 34