Several of my users have started receiving the following error:
user warning: Unknown column 'p' in 'where clause' query: SELECT mlid, menu_name FROM menu_links WHERE p= 0 in C:\wamp\www\drupal-6.10\sites\all\Modules\menu_node_edit\menu_node_edit.module on line 485.
Here is the code from lines 481-500:
// Check the user permissions.
$account = $user;
$account->menu_node_edit = menu_node_edit_load_access($account);
// If this value is empty, we cannot do anything.
if (empty($account->menu_node_edit)) {
return;
}
$items = array();
$check = array();
foreach ($account->menu_node_edit as $mlid) {
$item = db_fetch_object(db_query("SELECT mlid, menu_name, depth FROM {menu_links} WHERE mlid = %d", $mlid));
$result = db_query("SELECT mlid, menu_name FROM {menu_links} WHERE %s= %d", "p$item->depth", $item->mlid);
while ($data = db_fetch_object($result)) {
$items[$data->menu_name][] = $data->mlid;
$check[] = $data->mlid;
}
}
if (empty($items)) {
return;
}
I'm kind of at a loss as to what is happening. Has anyone seen this anywhere before? Thanks!
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | 625392-p.patch | 1.2 KB | agentrickard |
Comments
Comment #1
agentrickardThis would mean that they are assigned to menu items that no longer exist, I believe. Check to make sure that all the entries in {menu_node_edit_user} actually exist in {menu_links}.
We should, for clarity, probably wrap that second query (as in the attached).
But the question is "Why are your data tables out of sync?"
Comment #2
Bigpappaj commentedThat was indeed the issue. I have several "mlid" entries in the menu_node_edit_user table that did not exist in the menu_links table. Once I deleted these entries the errors ceased. Thanks for your help :) What is the patch that you posted there for?
Comment #3
agentrickardThe patch is extra error handling to prevent that bad query from being run.
Comment #4
agentrickardCommitted.