Categories
Visual Studio

Visual Studio Web Developer Permission Error Fix

Occasionally when working with Visual Studio on a local site, I have received an permission error when trying to run the application. I usually dig and dig before finding the solution, so I am going to save it here.

Solution: Turn off NTLM authentication in Property Window.

Categories
Code Snippets

Encode Mysql Results to JSON

The title says it all:


mysql_set_charset('utf8', $database_connection); // charset
$sqlStr = "SELECT * FROM yourtable;"; //provide the query
$result = mysql_query ($sqlStr, $database_connection) or die ($sqlStr); // get the results
$rows = array(); // create the array
if (mysql_num_rows($result)) {
while ($row = mysql_fetch_assoc($result)) { // populate array with results
$rows[] = $row;
}
}
echo json_encode($rows); // encode all in json
mysql_close($database_connection); // close the database connection