Okay... so I have a datamanager called "media". I've been able to insert and delete items using the datamanager without any issues. However, when I want to update an entry, I am having problems. Here is the jist of what I am doing....
Code:
$media = array('mediaID' => $mid);
$dm =& datamanager_init('Media', $vbulletin);
$dm->set_existing($media);
$dm->setr('title', $title);
$dm->setr('description', $description);
$dm->setr('length', $length);
$dm->setr('categoryID', $categoryID);
$dm->pre_save();
$mediaID = $dm->save();
Looks pretty simple right? Unfortunately I keep getting an SQL error...
Code:
Database error in vBulletin 4.0.2:
Invalid SQL:
UPDATE media SET
title = 'Nature by Numbers',
description = 'A SHORT MOVIE INSPIRED ON NUMBERS',
length = 224,
categoryID = 2
WHERE dataid = 0;
MySQL Error : Unknown column 'dataid' in 'where clause'
Error Number : 1054
What is "dataid"? And how do I set it to what I want it to be? I thought $dm->set_existing was supposed to extract all the necessary information.
It should be "WHERE mediaID = #" (where the number is whatever number I passed into the array from $mid)
--------------- Added [DATE]1270089685[/DATE] at [TIME]1270089685[/TIME] ---------------
Found the issue... had to put this in my datamanager...
Code:
var $condition_construct = array('mediaID = %1$d', 'mediaID');