There's a really simple query related to the enabled and working Ubercart, where the task is to get all the nids from uc_products
table, which simply doesn't give any results:
$query = 'SELECT nid FROM uc_products';
$result = db_query($query);
dsm('===================================================');
dsm($query);
while ($nid = db_result($result)) {
dsm('$nid: '.$nid);
}
BUT when I run the very same query in the same database in phpMyAdmin, it works, and it gives me ALL the correct results (I have 8 products now).
BUT the following queries work correctly, and give me all the expected results (the first is the strangest, because vid
field is of the same type, but only has another name):
$query = 'SELECT vid FROM uc_products';
$result = db_query($query);
dsm('===================================================');
dsm($query);
while ($vid = db_result($result)) {
dsm('$vid: '.$vid);
}
$query = 'SELECT * FROM uc_products';
$result = db_query($query);
dsm('===================================================');
dsm($query);
while ($row = db_fetch_object($result)) {
dsm('$row->nid: '.$row->nid);
}
$query = 'SELECT nid FROM node';
$result = db_query($query);
dsm('===================================================');
dsm($query);
while ($nid = db_result($result)) {
dsm('$nid: '.$nid);
}
Here's a screenshot of the test results:
As you can see, the first two queries don't return any results, while the others work correctly.
This is a really strange problem. I didn't modify the core modules, so I don't understand the situation. It doesn't matter whether I run it on localhost or my ongoing public server, the result is the same. This means that uc_order_condition_has_products_form()
in Conditional Actions menu doesn't work correctly either. I've never ever met such problems in Drupal.
Does anyone have a clue where I should start debugging?
node
ids work,uc_products
ids don't. But maybe an update could remove any kind of messy stuffs, I don't have a clue...SELECT * FROM uc_products
works perfectly as it should... :-O The previously mentionedSELECT nid FROM uc_products
still doesn't.SELECT vid FROM uc_products
also works correctly too! Why can Drupal have such a problem with thenid
field?