Jump to content


Photo

Mysql not saving slashes


  • Please log in to reply
2 replies to this topic

#1 may

may
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 23 August 2006 - 09:42 PM


I have this strange problem of saving file name.
I want to save the path of the file just uploaded.
The variable $uploadfile contains the whole path for the file as :

$uploadfile='E:\mydata\pop.jpg';

The problem is that my query written below does not save the '\' , even if i use addslashes it completely ignores it. any idea how can i save slashes in mysql?

$sql2="update adverts set login='$uploadfile'";
$rs2=mysql_query($sql2);

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 23 August 2006 - 10:01 PM

Use addslashes on the uploadfile variable:
$sql2="update adverts set login='" . addslashes($uploadfile) . "'";


#3 may

may
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 25 August 2006 - 07:28 AM

Thanks wildteen!

This code worked :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users