-2
`    <?php
/*

Connection PHP file! Edit this to properly connect to your MySQL!



Copyright © 2011, 2012 Quin Schurman

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see http://www.gnu.org/licenses/.
*/

$_Host = "**.***.***.**";
$_User = "*****";
$_Pass = "****";

$_Database = "cnr";

$_UsersTable = "playerdata"

//Connect to MySQL using mysql_connect()
$_Connection = mysql_connect($_Host, $_User, $_Pass) or die('Could not connect to $_Host with $_User using password $_Pass');

//Select the database defined in $_Database.
mysql_select_db($_Database);

?>`

Using above codes everything's setup but On checkcredts.php Parse error: syntax error, unexpected '$_Connection' (T_VARIABLE) in C:\xampp\htdocs\cnr\connection.php on line 33

Jamie Taylor
  • 4,709
  • 5
  • 44
  • 66
Shrey Ratna
  • 131
  • 1
  • 1
  • 9
  • Just add ; after `$_UsersTable = "playerdata"` – A.Essam Aug 14 '16 at 08:55
  • `$_UsersTable = "playerdata"` ...here you are missing a semicolon – Riad Aug 14 '16 at 08:55
  • Please, when posting code remove anything and everything not directly related to the question. That copyright notice is nothing but a distraction. Seeing (C) 2012, code presumably unpatched in over four years, is not encouraging. – tadman Aug 14 '16 at 09:47
  • **WARNING**: If you're just learning PHP, please, do not learn the obsolete [`mysql_query`](http://php.net/manual/en/function.mysql-query.php) interface. It's awful and has been removed in PHP 7. A replacement like [PDO is not hard to learn](http://net.tutsplus.com/tutorials/php/why-you-should-be-using-phps-pdo-for-database-access/) and a guide like [PHP The Right Way](http://www.phptherightway.com/) helps explain best practices. Make **sure** your user parameters are [properly escaped](http://bobby-tables.com/php) or you will end up with severe [SQL injection bugs](http://bobby-tables.com/). – tadman Aug 14 '16 at 09:47

1 Answers1

-1

Try:

replace

$_Connection = mysql_connect($_Host, $_User, $_Pass) or die('Could not connect to $_Host with $_User using password $_Pass');

to

@mysql_connect($_Host, $_User, $_Pass) or die('Could not connect to $_Host with $_User using password $_Pass');

and add ";"after $_UsersTable = "playerdata"

  • there is a syntax error you see...not a `mysql_connect` error.. – Riad Aug 14 '16 at 09:04
  • i`m sorry, i learning php :) – Paweł Barszcz Aug 14 '16 at 09:05
  • Do not use the error-suppressing `@` operator unless you have a very good reason. Also single quoted strings will not interpolate. Thirdly **DO NOT** put sensitive information like usernames, hosts and passwords in error messages that are seen by your users. This is what `die` does. – tadman Aug 14 '16 at 09:47