JSON wont show mysql data correctly :using php

user3469432

i want to connect to a database server using php , and then echo the data as JSON so later i can use it in android but JSON shows / as \/ for example if http://www.google.com/ was in the database if shows it as

"http:\/\/www.google.com\/" .

i made connections and all and here is how i fetch the data

try {
    $stmt   = $db->prepare($query);
    $result = $stmt->execute($query_params);
}catch (PDOException $ex) {
    $response["success"] = 0;
    $response["message"] = "Database Error1. Please Try Again!";
    die(json_encode($response));
}
while($row = $stmt->fetch(PDO::FETCH_ASSOC))
$array[] = $row;
echo json_encode($array);
jeroen

This is valid json and the correct way to encode it, see http://codepad.viper-7.com/6PbdmJ

When you decode it in for example javascript or php, you will get your original URL back:

javascript:

JSON.parse('"http:\/\/www.google.com\/"');

php:

var_dump(json_decode(json_encode('http://www.google.com/')));

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

javascript data wont show in php codeigniter

From Dev

UpdateView will correctly show model data but wont actually save the update

From Dev

jQuery PHP Mysql jSon show the data on loop

From Dev

Json data to MySQL using PHP

From Dev

insert data from JSON into mysql using php

From Dev

Sending data from Mysql with Json using PHP

From Dev

Insert JSON data into MySQL using PHP

From Dev

Show Markers on google map by using data from mysql in php

From Dev

Show all data from Mysql Database by category wise using php

From Dev

Show Markers on google map by using data from mysql in php

From Dev

Grab complex data from mysql and show them using php

From Dev

Show data from database to Array Multidimensi using php and mysql

From Dev

show json data from foreach in view using core php

From Dev

Javascript wont parse objects from JSON correctly

From Dev

Buttons wont resize correctly when using a GridBagLayout

From Dev

PHP wont connect to mysql database

From Dev

How to show if no data using php

From Dev

Show XML Data using PHP

From Dev

Calculating tax correctly using Mysql and php

From Dev

php image type blob wont show

From Dev

JSON to MySql using PHP

From Dev

How to correctly format JSON using PHP

From Dev

Database data not showing correctly in Php using PDP

From Dev

show the data from complex json data in php

From Dev

Image wont show in div when using Chrome

From Dev

RSS Feed wont show using Feedwind

From Dev

Fetching data from Mysql DB to listView using JSON and PHP

From Dev

Swift/PHP How to display mysql data (json) in UITableView using Alamofire

From Dev

Nested JSON data using MySQL and PHP for AngularJs | ng-options

Related Related

HotTag

Archive