Using githup to make php code opensource, keeping details of server secure in PHP Coding Help Posted December 14, 2014 Hi Little Help NeededI have created a new websiteIn the index.php file i want to show records from databaseNow, here is how the problem ariseI want to import codes from github intead of hosting those files on my server because i want to keep it opensourceBelow is the code I am using<?php// connect to the databaseinclude('connect-db.php');// get results from database$sql = "SELECT id, upadhi, name FROM munishri";$result = $conn->query($sql);if ($result->num_rows > 0) {// output data of each rowwhile($row = $result->fetch_assoc()) {echo "id: " . $row["id"]. " - Name: " . $row["upadhi"]. " " . $row["name"]. "<br>";}} else {echo "0 results";}// close connection$conn->close();?>Can i host the code to show result in another file and use something like<?php// connect to the databaseinclude('connect-db.php');// get results from databaseinclude('http://rawgit.com/thehitechpanky/jainmunilocator/master/database.php');?>
Using githup to make php code opensource, keeping details of server secure
in PHP Coding Help
Posted
Hi Little Help Needed
I have created a new website
In the index.php file i want to show records from database
Now, here is how the problem arise
I want to import codes from github intead of hosting those files on my server because i want to keep it opensource
Below is the code I am using
<?php
// connect to the database
include('connect-db.php');
// get results from database
$sql = "SELECT id, upadhi, name FROM munishri";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "id: " . $row["id"]. " - Name: " . $row["upadhi"]. " " . $row["name"]. "<br>";
}
} else {
echo "0 results";
}
// close connection
$conn->close();
?>
Can i host the code to show result in another file and use something like
<?php
// connect to the database
include('connect-db.php');
// get results from database
include('http://rawgit.com/thehitechpanky/jainmunilocator/master/database.php');
?>