help to correct the error

Iam getting error with a little piece of code and iam newbies…please help
This is the error:
FATAL ERROR syntax error, unexpected ‘username’ (T_STRING), expecting ‘)’ on line number 7

and this is the code:

[php]<?php$databases = array (
‘default’ =>
array (
‘default’ =>
array (
‘database’ => 'XXXXX’,
‘username’ => 'XXXXXX’,
‘password’ => ‘XXXXXXXX’,
‘host’ => ‘localhost’,
‘port’ => ‘’,
‘driver’ => ‘mysql’,
‘prefix’ => ‘’,
),
),
);
[/php]

Looks like single quotes were replaced by another character. If you notice the color change on the username line, that line and the line above it have off quotes.

This one has me stumped other than <?php should be the only thing on the first line that should had worked.
[php]<?php

$database = array(
‘default’ =>
array(
‘default’ =>
array(
‘database’ => 'XXXXX’,
‘username’ => 'XXXXXX’,
‘password’ => ‘XXXXXXXX’,
‘host’ => ‘localhost’,
‘port’ => ‘’,
‘driver’ => ‘mysql’,
‘prefix’ => ‘’,
)
)
);

$database = [
‘default’ => [
‘default’ => [
‘database’ => ‘xxxx’,
‘username’ => ‘xxxx’,
‘password’ => ‘XXXXXXXX’,
‘host’ => ‘localhost’,
‘port’ => ‘’,
‘driver’ => ‘mysql’,
‘prefix’ => ‘’
]
]
];

$database = array(
‘default’ =>
array(
‘default’ =>
array(
‘database’ => ‘XXXXX’,
‘username’ => ‘XXXXXX’,
‘password’ => ‘XXXXXXXX’,
‘host’ => ‘localhost’,
‘port’ => ‘’,
‘driver’ => ‘mysql’,
‘prefix’ => ‘’
)
)
);[/php]

I did a test script, I copied you script on top and get the error. I manually typed the one on the bottom exactly like yours no error. I even commented your script out to see if it was just getting a false positive, but it still passed with no errors. The middle is the newer way of writing arrays. I have never seen anything like this. Maybe my eyes are going and someone else can pinpoint the error? :-\ I also took the ‘s’ off of $database in the original script, but still get the error.

That’s it!!! Must be a British Keyboard Layout ;D

[php]'XXXXX’,
‘username’ => 'XXXXXX’, [/php]

Last quotes, are not quotes.

A better question is why are you using such a cluster muck of code for a DB connection?

It’s a framework conf page.

Even still, three arrays?

DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'mydatabase', } }

Sponsor our Newsletter | Privacy Policy | Terms of Service