0

Getting an unexpected error don't know what the hell is wrong as everything is perfect as far as I noticed

Parse error: syntax error, unexpected '=' in C:\wamp\www\dropbox-sdk\index.php on line 18


<?php
    session_start();

    require_once "lib/Dropbox/autoload.php";

    $_SESSION["user_id"] = 1;

    $dropboxKey     = '';
    $dropboxSecret  = '';
    $appName        = 'puttiapp/1.0';

    $appInfo = new Dropbox\AppInfo($dropboxKey, $dropboxSecret);

    $csrfTokenStore = new Dropbox\ArrayEntryStore($_SESSION, 'droppbox-ayth-csrf-token');

    $webauth = new Dropbox\WebAuth($appInfo, $appName, 'http://localhost/editmate/dropbox_finish.php', $csrfTokenStore);

    $database = new PDO(mysql::host=localhost;dbname=editmate;dbuser=root);
    $user   = $database->prepare("SELECT * FROM users WHERE id = :user_id");
    $user->execute(['user_id' => $_SESSION['user_id']]);
    $user = $user->fetchObject();

    var_dump($user);
?> 
3
Contributors
2
Replies
27
Views
1 Year
Discussion Span
Last Post by diafol
1

Why do you need a backslash in new Dropbox\AppInfo(...) and in 2 other places???

Also, I am not sure you are creating PDO correctly. Shouldn't it be something like...

$database = new PDO('mysql::host=localhost;dbname=editmate;dbuser=root');

Edited by Taywin

Votes + Comments
“Dropbox” in this case could be a namespace that is referenced directly or through a use statement.
1

Try:

$database = new PDO("mysql:host=localhost;dbname=editmate","root","");

Sounds like the root of your error problem (root, get it? he heh, never mind).

Edited by diafol

Votes + Comments
;) . Yes this was line 18 (before adding the comments to code to make it trickier). The root of the problem is to read the error message ;)
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.