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 1043167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:37:30+00:00 2026-05-16T15:37:30+00:00

Why does some query that works in mysql doesn’t work with db_query? For instance

  • 0

Why does some query that works in mysql doesn’t work with db_query? For instance –

” SELECT * FROM {tb1},{tb2}WHERE {tb1}.vid=%d ” (Of course I substitute %d with actual vid value while I’m testing in mysql environment)

“SELECT f1,f2,…,f10 FROM {tb1} INNER JOIN {tb2} ON {tb1}.vid = {tb2}.vid WHERE {tb1}.vid = %d AND {tb2}.vid = %d

Although I get 1 record returned in mysql environment for both statements, db_query doesn’t return anything at all. Any idea what mistake I’m making? For what is worth, I’m using IIS 7.5, Mysql 5.5, php 5.2.12
****UPDATE**** db_query/db_fetch_object work just fine. It just that hook_view isn’t being invoke. So, as a result, no data is displayed. Sorry for the trouble.

UPDATED

function mymodule_load($node){
   $query = 'SELECT f1,f2,...,f10 FROM {tb1} INNER JOIN {tb2} ON {tb1}.vid = {tb2}.vid WHERE {tb1}.vid = %d AND {tb2}.vid = %d';

   $result = db_query($query,$node->vid);//If I use db_query($query,$node->vid,$node->vid), drupal doesn't invoke hook_view

   drupal_set_message($node->vid,"status"); //for testing purpose
   return db_fetch_object($result);
}

function mymodule_view($node, $teaser = FALSE, $page = FALSE){
    $node = node_prepare($node, $teaser); // get it ready for display

    $f1 = check_markup($node->f1);
     ..............
    $f10 = check_markup($node->f10);

    // Add theme stuff here
    $node->content['mycontent'] = array(
       '#value' => theme('defaultskin', $f1,...,$f10),
       '#weight' => 1,
    );


    return $node;
}

function mymodule_theme(){

    return array(
        'defaultskin' => array(
            'template' => 'node-defaultskin',
            'arguments' => array(               
                'f1' => NULL,
                ......
                'f10' => NULL,
            ),
        ),
    );
}
  • 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-05-16T15:37:31+00:00Added an answer on May 16, 2026 at 3:37 pm

    Have you tried…

    db_query(“SELECT f1,f2,…,f10 FROM {tb1} tb1
    INNER JOIN {tb2} tb2 ON tb1.vid = tb2.vid
    WHERE tb1.vid = %d AND tb2.vid = %d”, $vid, $vid);

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

Sidebar

Ask A Question

Stats

  • Questions 509k
  • Answers 509k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I discovered this issue was being caused by the WebDav… May 16, 2026 at 4:37 pm
  • Editorial Team
    Editorial Team added an answer You can start the screen saver by sending a windows… May 16, 2026 at 4:37 pm
  • Editorial Team
    Editorial Team added an answer A SystemSoundID is a integer value, not an object; and… May 16, 2026 at 4:37 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have this script: <? $query = mysql_query(SELECT * FROM azzdk) or die(mysql_error()); $row
I've got a webpage which needs to load some data from a database. In
I'm getting a very strange behavior in MySQL, which looks like some kind of
I have some doubts over how Enumerators work, and LINQ. Consider these two simple
So I have this website that has a search feature which searches a table
I've got a query like this: update table set status = 1 where status
I am using a SWFupload script and I can't make a request from flash
I've been doing some research and testing on how to do fast random selection
I am running an aggregate function in java through hibernate and for some reason
). I hope somebody wants some easy reputation by answering a simple question ::-

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.