ghenson22 Posted September 27, 2010 Share Posted September 27, 2010 Hi, I'm totally new to Drupal use and development, and I need some help. Thus anyone know how to retrieve data from a database through your page in your site in Drupal? By the way I'm using Drupal 6.19 Tnx for the reply! Quote Link to comment https://forums.phpfreaks.com/topic/214507-php-in-drupal/ Share on other sites More sharing options...
ghenson22 Posted September 27, 2010 Author Share Posted September 27, 2010 I've imported this simple codes, thought it would be the answer! <?php $sql = "SELECT * FROM healing"; $result = db_query(db_rewrite_sql($sql)); while ($data = db_fetch_object($result)) { $node = node_load( $data->nid ); print node_view( $node, TRUE ); } ?> but it give me this response! warning: Invalid argument supplied for foreach() in /home1/mccoyinc/public_html/healingtheworld/modules/cck/content.module on line 1284 :'( Quote Link to comment https://forums.phpfreaks.com/topic/214507-php-in-drupal/#findComment-1116205 Share on other sites More sharing options...
jerdiggity Posted September 29, 2010 Share Posted September 29, 2010 Hi there. Couple things actually... First, the CCK folder (or any other contributed modules) should be put into a different location. You might have to disable/uninstall it first, but the place it really should be (assuming that /home1/mccoyinc/public_html/healingtheworld/ is where Drupal has been installed) is at: /home1/mccoyinc/public_html/healingtheworld/sites/all/modules/cck/ (as opposed to) /home1/mccoyinc/public_html/healingtheworld/modules/cck/ Either way, try this: <?php // Change to Drupal's installation directory chdir('/home1/mccoyinc/public_html/healingtheworld'); // And get Drupal to the "database" bootstrap level include_once('./includes/bootstrap.inc'); drupal_bootstrap(DRUPAL_BOOTSTRAP_DATABASE); // Now, just insert your code below: $sql = "SELECT * FROM healing"; $result = db_query(db_rewrite_sql($sql)); while ($data = db_fetch_object($result)) { $node = node_load( $data->nid ); print node_view( $node, TRUE ); } ?> Hope that helps... Quote Link to comment https://forums.phpfreaks.com/topic/214507-php-in-drupal/#findComment-1117327 Share on other sites More sharing options...
steppingmanoj Posted October 1, 2010 Share Posted October 1, 2010 Wow i like your efforts thanks..... Quote Link to comment https://forums.phpfreaks.com/topic/214507-php-in-drupal/#findComment-1117920 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.