vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Having trouble updating using DataMan... (https://vborg.vbsupport.ru/showthread.php?t=239523)

Jaxel 03-31-2010 11:54 PM

Having trouble updating using DataMan...
 
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');


All times are GMT. The time now is 06:26 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01096 seconds
  • Memory Usage 1,708KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (1)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete