Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9122775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:10:56+00:00 2026-06-17T06:10:56+00:00

I am a newbie in Drupal, I have a table in a drupal database.

  • 0

I am a newbie in Drupal, I have a table in a drupal database. I wanted to query all the content of it and display in a tabular format. Whenever I execute the query the link directs me to the blank page and nothing appears. I have attached the PhP code for the reference. Any help will be highly appreciated.

   <?php
  $header = array('Name', 'Age', 'Sex','University');
  $rows = array();

  $sql = 'SELECT Name, Age, Sex,University FROM {data_pulling} ORDER BY Name';
  $res = db_query($sql);
  while ($row = db_fetch_array($res)) {
    $rows[] = $row;
  }

  print theme('table', $header, $rows);
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T06:10:57+00:00Added an answer on June 17, 2026 at 6:10 am

    At a guess you’re using Drupal 7 but are trying to use API functions from Drupal 6.

    Try this

    foreach ($res as $row) {
      $rows[] = (array) $row;
    }
    
    print theme('table', array('rows' => $rows, 'header' => $header));
    

    Have a look at the docs for db_query and theme_table for more information

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am a drupal newbie and have been looking for drupal themes for my
I'm a Drupal newbie plus I don't have much experience updating code, styles, and
I'm a drupal newbie (mean it :) I have a Block, created with View
I'm a drupal newbie... I have created a block with View Module to list
I am a newbie in drupal, webform and php. Actually I have installed the
I'm a newbie php guy. I have 1 string output from Drupal's date module
I am a newbie to drupal, and have used cakephp and codeigniter frameworks earlier.
I am a newbie to drupal I have to develop a website in drupal
Newbie in the Linq to XML arena... I have a Linq query with results,
I'm a drupal newbie. In Drupal 7, I have an install file and I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.