Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
addslashes() and stripslashes()
I have a some PHP code from a book that will only work if i have magic qoutes switched on, but because the computers i am working on are provided by a university i'm having trouble finding out how to switch them on. However the book says that if i do not have them enabled i can add 'addslashes()' to data going to the database and 'stripslashes()' to data coming back from the database, but it doesn't explain how to do this.
I assume they have to be added somewhere within this section of the code(below), but where? If i'm wrong about this could someone please point me in the right direction. If anyone could help me i would very much appreciate it.
// query database for the books in a category
if (!$catid || $catid=="")
$conn = db_connect();
$query = "select * from tools where catid='$catid'";
$result = @mysql_query
$num_books = @mysql_num_rows
if ($num_books ==0)
$result = db_result_to_array($result);