Get data from database I'm running Drupal 7 site on WAMP Server!

I'm using below code in a custom block to get data from the database :

$result = db_select('event', 'x')
  -&gt;fields('x', array('address'))
  -&gt;execute()
  -&gt;fetchAll();
foreach ($result as $value) {
  print_r ($value);
}


Event is the name of node we use

Every time I try to reload the page, I get this message :


  The website encountered an unexpected error. Please try again later.


When I check WAMP PHP error log, there is nothing in it about it !

Any idea ?

Update :
Now is see I get this error :

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'drupal.event' doesn't exist: SELECT x.address AS address FROM {event} x; Array ( ) in eval()


I understand that it mean it can't find the table, but why ? I found it like that in every example on the internet !
The website encountered an unexpected error. Please try again later.


Above error is Drupal specific error, to get more details about this error you need to go to Drupal Logs. You can access Drupal Logs by navigating to "Admin => Reports => Recent Log Messages". These logs are provided by Database logging Module in Drupal Core.

Updates:


  Event is the name of node we use


In Drupal Nodes data is stored into node table and not table named with content type. Check out getting started guide about node. You've to check node table to get all nodes where type is event.

To fetch nodes you can use EntityFieldQuery API. Check example on How to use EntityFieldQuery. And to fetch any fields value, check Programmatically get field values.