0

I am storing file path in my database(MySQL).. bUT when the path stores in table it stores without backslashes...find my MySQL query below..

INSERT INTO ContentViewed (`UserDataId`, `ProductId`, `FileId`, `Name`, `HitCount`, `VideoTime`, `BatchId`, `UniversityId`, `UniUserId`, `type`, `CreatedOn`, `ModifiedOn`, `FileType`, `SubjectId`,`MaxScore`,`Timestamp`, `content_path`, `scoreByTotal`) 
VALUES (78, 12 , 12 , 'Mayur', 3, '21212121',0 ,0 ,0 ,1, '1490005519','14444258', 2, 0, 0.0, '1490007296', 'F:\\\\SD Cards\\\\Original\\\\BPP-English\\\\Basic Language Skills\\\\Lessons\\\\Video\\\\Unit 4 - Language Used in \\u0026 Its Use in\ Different Fields.mp4' ,'22');
sachin singh
  • 43
  • 1
  • 1
  • 10
  • what is the error you are getting? – Nishant Nair Mar 21 '17 at 05:20
  • This stackoverflow post has an answer for your question [link](http://stackoverflow.com/questions/17153624/using-php-to-upload-file-and-add-the-path-to-mysql-database). Try it. – Kaviranga Mar 21 '17 at 05:42
  • F:\\SD Cards\\Original\\BPP-English\\Basic Language Skills\\Lessons\\Video\\Unit 4 - Language Used in \u0026 Its Use in Different Fields.mp4 this is what i get after executing the query in my content_path column – sachin singh Mar 21 '17 at 05:45
  • when i hit api through postman then in database the path gets stores as --F:SD Cards Original BPP-English Basic Language Skills Lessons Video Unit 4 - Language Used in u0026 Its Use in Different Fields.mp4-- you can see above that their is no backslash in path...and i want to store actual path with backslashes – sachin singh Mar 21 '17 at 05:50
  • help me out pls – sachin singh Mar 21 '17 at 06:02
  • Quick hack is to make the datatype as "text" – Tej Patil Mar 21 '17 at 06:25
  • Or else you can write a trigger to update the filepath value before insert and replace "\" with "\\" – Tej Patil Mar 21 '17 at 06:26
  • Or best way would be to format the filepath and pass it to query – Tej Patil Mar 21 '17 at 06:31
  • thanx @tej patil ...text didnt worked ....but i will try the other two – sachin singh Mar 21 '17 at 12:31

0 Answers0