New User...Error cannot connect DB


#1

Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /storage/ssd4/948/3399948/public_html/checklogin.php:5 Stack trace: #0 {main} thrown in /storage/ssd4/948/3399948/public_html/checklogin.php on line 5

Can help me


#2

Use PDO instead :slight_smile:


#3

Original File
mysql_connect(“localhost”,“root”,"") or die(“Cannot connect to server”);
mysql_select_db(“data”) or die(“Cannot select Database”);

Edit
mysql_connect(“databases.000webhost.com”,“root”,“123456”) or die(“Cannot connect to server”);
mysql_select_db(“id3399948_data”) or die(“Cannot select Database”);


#4

Is this a script you’ve wrote or a premade one?


#5

original file in my script
can u help me…
i never use free webhost to publish my system…but now i have to publish my system…
i cannot connet DB…:sob::sob::sob::sob:


#6

Try heading to “General Settings” on 000webhost.com and selecting a lower PHP version.


#7

ok…i set lower PHP version…
i get error Warning: mysql_connect(): ProxySQL Error: Access denied for user ‘root’@‘2a02:4780:bad:f00d::e’ (using password: YES) in /storage/ssd4/948/3399948/public_html/checklogin.php on line 5 Cannot connect to server

in my localhost NOT use password

but in webhost i set password 123456 but i still get that error…i change use and no password still get error

mysql_connect(“localhost”,“root”,"") or die(“Cannot connect to server”);
mysql_select_db(“id3399948_data”) or die(“Cannot select Database”);


#8

You can’t use root

host is localhost

username/database names are under Manage Database as well as passwords at 000webhost.com


#9

ok…but i still get error…new error from another page…i have change my coding all page?erm…i get tired coz that…

Notice: Use of undefined constant username1 - assumed ‘username1’ in /storage/ssd4/948/3399948/public_html/menu_user.php on line 4 Parse error: syntax error, unexpected T_STRING in /storage/ssd4/948/3399948/public_html/sqlconn.php on line 6