Asked 30+ days ago
19 Jul 2017
Views 310
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 Jan 21 '18 20:17

escape function will be used to escape input before saving database

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