Question:

How to store paths in mysql db using PHP? ?

by  |  earlier

0 LIKES UnLike

I am trying to store a file path on a database but what was being stores is incomplete...HELP!

 Tags:

   Report

1 ANSWERS


  1. Are you specifying the size of the varchar column? When you create the table you need to specify a maximum length of the string, if you make it too short it will truncate the end of your path name. Make sure you specify a good size when creating, like 256 should be good:

    CREATE TABLE vc (v VARCHAR(256))

    It also may be an issue of putting the data into the database. When you do something like:

    INSERT INTO vc (v) VALUES("C:\Users\newfolder")

    notice that '\' specifies and escape sequence, and '\n' is an escape sequence for newline and may cause problems. do this:

    INSERT INTO vc (v) VALUES("C:\\Users\\newfolder")

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.