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);