Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2007
    Posts
    27

    Question Unanswered: Spaces in filename and variables

    I have spaces in my database filename and a few in my variables (I didn't create this database or there would be no spaces). I was wondering if anybody could help me, I'm not sure if I'm coding this appropriately.

    Code:
    $conn->Open("Provider=Microsoft,.Jet.OLEDB.4.0; Data Source=F:\\Inetpub\\wwwroot\\EmployeeWellnessProgram\\Copy of HR Employee Wellness Program.mdb");
    
    // SQL statement to build recordset.
    $users = $conn->Execute("SELECT * FROM [analyzer query]");
    Thanks!

  2. #2
    Join Date
    Mar 2007
    Location
    636f6d7075746572
    Posts
    770
    I'm guessing here but I think you're using an ODBC connection? And have a class instance called $conn which is dealing with this?
    What does $conn-Open(...) give you back?
    Also what does $users equal? Is it a recordset? An array?

    As for the query I believe MSAccess (JetSQL) will be ok with the fact you have used [ square brackets ] for encapsulating the table name with spaces, although I think you can also use " inverted commas " as well. (Take care to escape them in your "" string )

    As for the Open string, it really does depend on how the Open function deals with the string, or how the ODBC connector splits the string up. It might not like spaces, but it seems to be ; separated so it should be fine.

    All in all, any errors? This'll give us a good hint to start.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •