Asked 7 years ago
19 Jul 2017
Views 3069
jaggy

jaggy posted

what is alternative of mysql_real_escape_string in wordpress ?

what is alternative of mysql_real_escape_string in wordpress ?



$arr=				array( 
				'subject' => $subject,
				'message' =>  $message,
				'department' =>  mysql_real_escape_string($department),
   
				) ;	
			$insert=$wpdb->insert( 
				"{$wpdb->prefix}ticket", 
				$arr
			);
		 


generating error as below


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 
Mitul Dabhi

Mitul Dabhi
answered Nov 30 '-1 00:00

escape function will be used to escape input before saving database

$wpdb->escape($input);
Post Answer