Deprecated: mysql_escape_string()

God Of Pain

Member
Joined
Aug 3, 2017
Messages
528
Reaction score
16
mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead.

help?

PHP:
<?PHP
$idas = mysql_escape_string($_GET['idas']);
 

Raggaer

Godly Member
Joined
Jul 25, 2012
Messages
1,551
Reaction score
882
Location
Spain
mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead.

However if you use PHP 7 both of these wont work as mysql driver is ded

 
OP
God Of Pain

God Of Pain

Member
Joined
Aug 3, 2017
Messages
528
Reaction score
16
mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead.

However if you use PHP 7 both of these wont work as mysql driver is ded
php 5, how fix it? I tested use mysql real escape
 
OP
God Of Pain

God Of Pain

Member
Joined
Aug 3, 2017
Messages
528
Reaction score
16
Did real not work? what was the error
Deprecated: mysql_real_escape_string(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead

Warning: mysql_real_escape_string(): Access denied for user ''@'localhost' (using password: NO)

Warning: mysql_real_escape_string(): A link to the server could not be established
 

Raggaer

Godly Member
Joined
Jul 25, 2012
Messages
1,551
Reaction score
882
Location
Spain
Okey so mysql_real_escape_string expects your mysql connection as the second parammetter, try doing that

However it loads the last connection open if its null so it should work. Are you sure your database connection is ok?
 
OP
God Of Pain

God Of Pain

Member
Joined
Aug 3, 2017
Messages
528
Reaction score
16
Okey so mysql_real_escape_string expects your mysql connection as the second parammetter, try doing that

However it loads the last connection open if its null so it should work. Are you sure your database connection is ok?
How I can do it? connection in second parammetter

db connection is ok
 

LordVissie

( ͡°( ͡° ͜ʖ( ͡° ͜ʖ ͡°) ͜ʖ ͡°) ͡°)
Joined
Aug 4, 2015
Messages
1,614
Reaction score
570
Location
The Earth
The link I posted shows exactly what you need.
 
OP
God Of Pain

God Of Pain

Member
Joined
Aug 3, 2017
Messages
528
Reaction score
16
The link I posted shows exactly what you need.
Warning: mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES) in /var/www/html/pages/bans.php on line 9
Failed to connect to MySQL: Access denied for user 'root'@'localhost' (using password: YES)
Deprecated: mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead. in /var/www/html/pages/bans.php on line 17
 

LordVissie

( ͡°( ͡° ͜ʖ( ͡° ͜ʖ ͡°) ͜ʖ ͡°) ͡°)
Joined
Aug 4, 2015
Messages
1,614
Reaction score
570
Location
The Earth
Your database connection is wrong as raggaer said and you are still using the old function.
 

LordVissie

( ͡°( ͡° ͜ʖ( ͡° ͜ʖ ͡°) ͜ʖ ͡°) ͡°)
Joined
Aug 4, 2015
Messages
1,614
Reaction score
570
Location
The Earth
Warning: mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES) in /var/www/html/pages/bans.php on line 9
Failed to connect to MySQL: Access denied for user 'root'@'localhost' (using password: YES)

This says it isnt correct.
 

messenoire

Active Member
Joined
Sep 26, 2015
Messages
106
Reaction score
35
First of all, create a user for your server in your database. Don't just use root.
1. open MySQL CLI
2. create user 'forgottenserver'@'localhost' identified by 'passw0rd';
3. grant all privileges on forgottenserver.* to 'forgottenserver'@'localhost';
4. flush privileges;

Then try again but using the user you just created.
Typed from head so look up if the syntax checks out.

Second, use PDO.
 
OP
God Of Pain

God Of Pain

Member
Joined
Aug 3, 2017
Messages
528
Reaction score
16
First of all, create a user for your server in your database. Don't just use root.
1. open MySQL CLI
2. create user 'forgottenserver'@'localhost' identified by 'passw0rd';
3. grant all privileges on forgottenserver.* to 'forgottenserver'@'localhost';
4. flush privileges;

Then try again but using the user you just created.
Typed from head so look up if the syntax checks out.

Second, use PDO.
This has already been solved, but thank you
 
Top