0
<?php
    mysql_connect("mysql13.000webhost.com", "a7796367_Bubelz", "password"); or die("Couldn't connect to SQL server.");
    mysql_select_db("a7796367_Bubelz"); or die("Couldn't select DB.");
?>​

I can't connect to my database. I'm using 000webhost.com

When I open it, it shows me this error :

Parse error: syntax error, unexpected T_LOGICAL_OR in    
/home/a7796367/public_html/bubelz/connect.inc.php on line 2
vivekpansara
  • 895
  • 1
  • 6
  • 14
  • 1
    Please, [stop using `mysql_*` functions](http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php). They are no longer maintained and are [officially deprecated](https://wiki.php.net/rfc/mysql_deprecation). Learn about [prepared statements](http://en.wikipedia.org/wiki/Prepared_statement) instead, and use [PDO](http://jayblanchard.net/demystifying_php_pdo.html). – Jay Blanchard Apr 21 '15 at 14:11
  • Simply remove `;` before `or` – Paweł Tomkiel Apr 21 '15 at 14:21

3 Answers3

1

try this you have syntax error and you have to use mysqli insted becuse mysql Officially deprecated

mysql_connect("mysql13.000webhost.com", "a7796367_Bubelz", "password") or die("Couldn't connect to SQL server.");
mysql_select_db("a7796367_Bubelz") or die("Couldn't select DB.");


mysqli

$connection = new mysqli('localhost', 'my_user', 'my_password', 'my_db') ;
Osama Jetawe
  • 2,697
  • 6
  • 24
  • 40
0

remove ; in first line of code:

mysql_connect("mysql13.000webhost.com", "a7796367_Bubelz", "password"); <---
Alexis Peters
  • 1,583
  • 1
  • 10
  • 17
0

You Cannot write OR like this.

mysql_connect("mysql13.000webhost.com", "a7796367_Bubelz", "password"); 
or die("Couldn't connect to SQL server.");

You can use as follows

if(!mysql_connect("mysql13.000webhost.com", "a7796367_Bubelz", "password")){ 
    die("Couldn't connect to SQL server.");
}