thehitechpanky Posted December 14, 2014 Share 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');?> Quote Link to comment Share on other sites More sharing options...
requinix Posted December 14, 2014 Share Posted December 14, 2014 ...no. First, open source is a concept - a license, really - not an implementation. You don't have to host your code on GitHub for it to be open source, and putting it on GitHub doesn't make it open source. Second, GitHub and others are code repositories. You don't keep your code there and then try to run it from there. It's a place you can store your files on the internet. When you want to run them, you download them (in the case of GitHub, using git) and run them. Locally. You could just as well put the files in a .zip on an FTP server and download the code for all it matters. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.