SQL to JSON with C#

This seems to work quite well. If there is a more efficient way please let me know. string SQLtoJSON(string _sqlCon, string _sqlQuery) { using (SqlConnection con = new SqlConnection(_sqlCon)) { using (SqlCommand cmd = new SqlCommand(_sqlQuery, con)) { using (SqlDataAdapter adapter = new SqlDataAdapter(cmd)) {…

php mysql database connection

Connecting to mysql via php. <?php $servername = “hostname”; $username = “username”; $password = “password”; $dbname = “database”; $loggedin = false; $conn = new mysqli($servername, $username, $password, $dbname); if ($conn->connect_error) { //handle it } ?> this is nice to keep in a separate file (inc/conn.php)…