Hello guys im with a problem handling PHP and JSON
This is my php code
<?php mysql_connect("127.0.0.1","root",""); mysql_select_db("spadramatico_db"); $query = mysql_query("SELECT * FROM feed_table ORDER BY id"); $records = array(); while($obj = mysql_fetch_object($query)) { $records [] = $obj; } print (json_encode($records)); ?> And this is the output result:
[{"id":"1","title":"Teste Title","image":"http:\/\/catalinaseaspa.com\/wp-content\/uploads\/2015\/03\/island-girl.jpg","desc":"Desc test","price":"1"}] My Problem its with the link, the output its like this:
http:\/\/catalinaseaspa.com\/wp-content\/uploads\/2015\/03\/island-girl.jpg But its to be like this:
http://catalinaseaspa.com/wp-content/uploads/2015/03/island-girl.jpg How can i fix that? Thank you :D
mysql_*functions. They are no longer maintained and are officially deprecated. Learn about prepared statements instead, and consider using PDO, it's really not hard.