Download & Extend

How to call ALL the nodes of a db in the block?

Project:Drupal core
Version:5.x-dev
Component:other
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed (won't fix)

Issue Summary

With the next code, I retrieve the nid in a database that I created with the products that the users have selected, and I use this nid to retrieve its content_fields. The database MyProductsCart has two field: uid and nid. For the moment, in the block, I only have the information related to the first nid (in "MyProductsCart), but there are more nodes stored in it. So my while loop must be false. But I don't know how to fix the code so as to have all the nodes published in the block.

function products_page_block($op='list' , $delta=0, $edit=array()) {

switch ($op) {
case 'list':
$blocks[0]['info'] = t('Product Cart');
return $blocks;
case 'view':
global $user;
$uid = $user -> uid;
$query1 = db_query("SELECT * FROM {MyProductsCart} WHERE uid = %d", $uid);
while ($row1 = db_fetch_array($query1)) {
$nid = $row1['nid'];
$row2 = db_fetch_array(db_query("SELECT * FROM {node} WHERE nid = %d", $nid));
$title = $row2['title'];
$row3 = db_fetch_array(db_query("SELECT * FROM {content_field_category} WHERE nid = %d", $nid));
$category = $row3['field_category_value'];
$row4 = db_fetch_array(db_query("SELECT * FROM {content_field_gender} WHERE nid = %d", $nid));
$gender = $row4['field_gender_value'];

$advice = $title.' '.$category;
$blocks['subject'] = t('Your products');
$blocks['content'] = t($advice);

return $blocks; }

Any idea?

Comments

#1

Project:Block Theme» Drupal core
Version:5.x-1.1» 5.x-dev
Component:Code» other

This issue has nothing to do with the Block Theme module so I'm moving it to the right place for getting support.

#2

Status:active» closed (won't fix)

Considering the lack of activity on this issue and that Drupal v5 is no longer supported by fixes or patches, I am going to close this ticket. If this issue still exists and you want to continue to ask for technical support from the community, please reopen and update this ticket.

nobody click here