Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Mar 2012
    Location
    Somewhere over the Rainbow
    Posts
    96
    Thanks
    7
    Thanked 5 Times in 5 Posts

    variable labeling inside a query

    A quick question:

    If there is only one place in my database with the column name "apples" then I do not have to include the table name before the $apples variable in my INSERT query, is that correct?

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    If it never causes a conflict, and isn't a reserved word, then no you don't need to prepend the field with the table.
    Although, since a lot of field names are reused between multiple tables, especially ones with relationships, a table name or alias is required during joins so it knows which table to draw from. For consistencies sake, that alone is a reason to always use a table.field syntax.

  • #3
    New Coder
    Join Date
    Mar 2012
    Location
    Somewhere over the Rainbow
    Posts
    96
    Thanks
    7
    Thanked 5 Times in 5 Posts
    Ok thank you!


  •  

    Posting Permissions

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