Jump to content

PHP in Drupal


ghenson22

Recommended Posts

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  :'(

Link to comment
https://forums.phpfreaks.com/topic/214507-php-in-drupal/#findComment-1116205
Share on other sites

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...  :)

Link to comment
https://forums.phpfreaks.com/topic/214507-php-in-drupal/#findComment-1117327
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.