-8

I'm quite new on PHP coding and would like to see If it's possible to get help of the code below. Apparently the error is only on line 6.

<?php
class DBWrapper
{   
    function DBWrapper($server,$db,$user,$pass)
    {        
        $this->Server = $server;
        $this->DB = $db;
        $this->User = $user;
        $this->Password = $pass;

        mysql_connect($this->Server, $this->User, $this->password) or
                    die("Can't connect, please check your settings. Here is the MySQL error: ".mysql_error());

        mysql_select_db($this->DB) or
                    die("Can't select DB, please check your settings. Here is the MySQL error: ".mysql_error());       
    }

I really hope to receive some help about this.

Bruno Duarte
  • 21
  • 1
  • 1
  • 3
  • 4
    You should not post your username and password etc.. – Matheno Jan 05 '15 at 16:22
  • 2
    Your code makes no sense at all! – Rizier123 Jan 05 '15 at 16:23
  • You've obviously changed those from $server, etc. change them back and find the correct place to change them. – AbraCadaver Jan 05 '15 at 16:23
  • 4
    Flagged for moderator attention to get a developer to remove the username/password: http://puu.sh/e6J9f/1bc72aeb79.png – AStopher Jan 05 '15 at 16:26
  • @AntonyD'Andrea True, but even if they didn't do so this question is still VLQ for not having a clear problem statement. The question will probably be removed, the OP is probably under a question-ban by now. – AStopher Jan 05 '15 at 16:28
  • @cybermonkey sorry, I deleted my comment because I didn't realise they meant post them on the question rather than posting from a html form! – Antony D'Andrea Jan 05 '15 at 16:30
  • 1
    I advise you to change your password – Peter Jan 05 '15 at 16:31
  • 1
    @beauXjames, your edit is a substantive change to the question. Whilst it is a good idea for us to help an OP hide their leaked credentials, it is also a good idea to avoid changing the meaning of code samples. (Now the creds are posted, the OP should just change them anyway). – halfer Jan 05 '15 at 17:00
  • 3
    I've deleted this question, pending removal of the edit history items by a Stack Exchange developer. It will likely be restored after that. I **do** still *strongly* recommend you change the login information on the server right away, @Bruno – Andrew Barber Jan 05 '15 at 17:50
  • 1
    @halfer, it was actually an attempt to edit the question in the line of review...was punching through a few that day...apologies – beauXjames Jan 07 '15 at 20:39

2 Answers2

3

This:

    $this->Server = $mysql3.000webhost.com;

You have no quotes on this "string", so it's being parsed as:

$this->Sever = somevariable concatenate with undefined/illegal constant concatenate with undefined constant

Perhaps

    $this->Server = '$mysql3.000webhost.com';

or something?

Marc B
  • 356,200
  • 43
  • 426
  • 500
1
    $this->Server = $#####;
    $this->DB = $#####;
    $this->User = $######;
    $this->Password = $#######;

Hmm, aren't those strings? If so, skip $ and put them into '.

    $this->Server = 'mysql3.000webhost.com';
    $this->DB = 'a3206525_ezmail';
    $this->User = 'a3206525_ezmail';
    $this->Password = 'belfegor666';

Also, it's not wise to publish your credentials ;)

And the most important advice, read some more about PHP. It'll really help you.

Bruno Duarte
  • 21
  • 1
  • 1
  • 3
Elon Than
  • 9,603
  • 4
  • 27
  • 37
  • 1
    awesome! and thank you! (') this did the trick ;) thanks also for the advice, I got a bit stressed out and forgot to cleanup the credentials :/ – Bruno Duarte Jan 05 '15 at 16:58