•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 401,707 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,985 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 973 | Replies: 1
![]() |
•
•
Join Date: Jul 2005
Location: Downingtown
Posts: 57
Reputation:
Rep Power: 4
Solved Threads: 3
I have to write an include file for this independent study thing I am doing, since my boss doesn't feel that mysql stored procedures are enterprise-ready yet. This include file will, among other things, interface with the database that I designed.
Is there anything I should know before doing this? Links and/or your personal opinions would be nice.
Is there anything I should know before doing this? Links and/or your personal opinions would be nice.
•
•
Join Date: Aug 2005
Location: somewhere in time
Posts: 71
Reputation:
Rep Power: 4
Solved Threads: 3
It sounds like you want to use an include file to store your SQL statement. You can just assign the SQL statment to a variable as a string in the include file. As in:
[PHP]$sql = "SELECT col_1, col_2, col_3 FROM filename WHERE id=3";[/PHP]
If security is the major concern, you should place the include files outside the Web tree. In other words, above the root directory for your site. Most servers have a tmp directory or something similar that you can use to store these types of files. The important part is that it should not be part of the Web site tree and therefore will not be accessible to others.
To call the include file, just fully specify the path to the file as in:
[PHP]require_once '/home/mysite/tmp/sql01.php';[/PHP]
If you do not know the server path to a directory outside of the Web tree, just ask your Webmaster or hosting company.
[PHP]$sql = "SELECT col_1, col_2, col_3 FROM filename WHERE id=3";[/PHP]
If security is the major concern, you should place the include files outside the Web tree. In other words, above the root directory for your site. Most servers have a tmp directory or something similar that you can use to store these types of files. The important part is that it should not be part of the Web site tree and therefore will not be accessible to others.
To call the include file, just fully specify the path to the file as in:
[PHP]require_once '/home/mysite/tmp/sql01.php';[/PHP]
If you do not know the server path to a directory outside of the Web tree, just ask your Webmaster or hosting company.
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- access include file from subdomain (ASP)
- include file needed (C++)
- <%@include file> (JSP)
- "Cannot Open Include File" MS Visual C++ error (C++)
- How to set up include file for navbar (HTML and CSS)
- Include a file from another website (ASP)
Other Threads in the PHP Forum
- Previous Thread: Looking for an Asset Tracking system
- Next Thread: Best method to randomize image


Linear Mode