Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.