Adsense
Popular Posts
- Install APXS in Redhat Linux
- MySQL workbench -"Could not decrypt password cache"
- Transfer modules between sites
- JavaScript, remove trailing insignificant zeros after toFixed function
- Set Windows path command line
- datatable order by nunmeric
- MySQL date created and date modified
- super(props) in React
- PHP, dump varailbes in a format way
- React: connect(mapStateToProps, mapDispatchToProps)
Monday, October 6, 2014
Loading external sql files in PHP
I have a large sql file. I preferred to separate it from PHP code.
I created a SQL directory to put these sql files. Using PHP function file_get_contents to laod
external sql files.
$db2 = new ConnectionDB2();
$sql = file_get_contents(SITE_SERVER_ROOT."/_models/SQL/CSRPTcourses_lut.sql");
$result = $db2->query($sql);
$data = array();
while ($row = $db2->getArray($result)) {
$data[] = $row;
}
$db2->close();
Labels:
php
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment