-2

Possible Duplicate:
mysql_fetch_array() expects parameter 1 to be resource, boolean given in select

I am querying a field which contains JSON data. but

json_decode($result)

gives an output like: json_decode expects parameter to be string, resource given in line.

$result=mysql_query("SELECT values FROM 'table' LIMIT 0,1");

Now how do I get the string output? Why is that output as resource and not string?

Community
  • 1
  • 1
Chandan Gupta
  • 1,296
  • 2
  • 12
  • 28
  • Refer to the [manual](http://php.net/mysql_query) to find out how `mysql_query()` is used. Related: [Reference: What is a perfect code sample using the mysql extension?](http://stackoverflow.com/q/6198104) – Pekka Aug 30 '11 at 08:18
  • The manual has lots of examples yet we see the same question again and again and again. I wonder what's failing here... :( – Álvaro González Aug 30 '11 at 08:24

1 Answers1

3
$result = mysql_query("SELECT values FROM 'table' LIMIT 0,1");
$real_result = mysql_fetch_assoc($result);
json_decode($real_result['values']);
J0HN
  • 25,158
  • 5
  • 48
  • 84