$name = "O'Malley"; $name = PMA_Util::sqlAddSlashes($name); echo $name; //Output: O\'Malley
$sql = "INSERT INTO users (name, email) VALUES ('John Doe', 'johndoe@example.com')"; $sql = PMA_Util::sqlAddSlashes($sql); $result = mysqli_query($conn, $sql);This example demonstrates how the sqlAddSlashes function can be used to safely insert data into a database without worrying about SQL injection attacks. The sql variable contains a SQL query with values that could potentially be hazardous. PMA_Util sqlAddSlashes function is used to escape these values before passing them to the mysqli_query function. In conclusion, PMA_Util sqlAddSlashes is a useful function that can save developers time by automatically escaping potentially hazardous strings for use in SQL queries.