0

Hi

I am new to php and been following various youtube tutorials and boought a few books, I am now however clueless with my latest error and really need some help.
This is my error Parse error: syntax error, unexpected T_STRING in C:\xampp\htdocs\lilfairy\admin\library\config.php on line 17

Please have a look at my code and advise where I am going wrong. I had a feeling is my my files and because the website is uploaded its in a subdirectory but on Xampp its the main one and on localhost. So not sure.

Thanks in advance

            `<?php
            ini_set('display_errors', 'On');
            error_reporting(E_ALL);

            // start the session
            session_start();

            // database connection config
            $dbHost = 'localhost';
            $dbUser = 'tullaba2_admin';
            $dbPass = 'mypassword';
            $dbName = 'tullaba2_mystore';

            // setting up the web root and server root for
            // this shopping cart application
            $thisFile = str_replace('\', '/', __FILE__);
            $docRoot = $_SERVER['DOCUMENT_ROOT'];

            $webRoot  = str_replace(array($docRoot, 'library/config.php'), '', $thisFile);
            $srvRoot  = str_replace('library/config.php', '', $thisFile);

            define('WEB_ROOT', $webRoot);
            define('SRV_ROOT', $srvRoot);

            // these are the directories where we will store all
            // category and product images
            define('CATEGORY_IMAGE_DIR', 'images/category/');
            define('PRODUCT_IMAGE_DIR',  'images/product/');

            // some size limitation for the category
            // and product images

            // all category image width must not
            // exceed 75 pixels
            define('MAX_CATEGORY_IMAGE_WIDTH', 75);

            // do we need to limit the product image width?
            // setting this value to 'true' is recommended
            define('LIMIT_PRODUCT_WIDTH',     true);

            // maximum width for all product image
            define('MAX_PRODUCT_IMAGE_WIDTH', 300);

            // the width for product thumbnail
            define('THUMBNAIL_WIDTH',         75);

            if (!get_magic_quotes_gpc()) {
                if (isset($_POST)) {
                    foreach ($_POST as $key => $value) {
                        $_POST[$key] =  trim(addslashes($value));
                    }
                }

                if (isset($_GET)) {
                    foreach ($_GET as $key => $value) {
                        $_GET[$key] = trim(addslashes($value));
                    }
                }    
            }

            // since all page will require a database access
            // and the common library is also used by all
            // it's logical to load these library here
            require_once 'database.php';
            require_once 'common.php';

            // get the shop configuration ( name, addres, etc ), all page need it
            $shopConfig = getShopConfig();
            ?> `
3
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by karthik_ppts
1

This is due to:

$thisFile = str_replace('\', '/', __FILE__);

When you do '\' it escapes the trailing single quote in the parameter itself. Try using '\\' instead.

Votes + Comments
Helpful post
0

Thanks for that, it definitely removed my error message so hopefully I can now get it all sorted.

This question has already been answered. 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.