Zikula: A Flexible Open Source Content Management System
home | forum | contact us

Dizkus

Bottom
PO_Insert_ID problem (again :P)
  • Posted: 11.09.2006, 15:11
     
    SiCk949
    rank:
    Freshman Freshman
    registered:
     June 2006
    Status:
    offline
    last visit:
    30.10.06
    Posts:
    28
    Hello
    I had searched about that but my problem is strange and different. I'm makin a adminapi_create func. All goes OK with genid etc.
    I printed and inserted manually my SQL sentence and it works ok, so the problem is on:

    Code

    $cod = $dbconn->PO_Insert_ID($informaciontable, $informacioncolumn['sid']);

    It always get me '0'! and the execution don't starts, but no error detected :s

    Here you are my complete create code:

    Code

    function Informacion_adminapi_create($args)
    {
        extract($args);
       
        if (!$title || !$hometext // BALBA ETC ETC, checking arguments) {
            pnSessionSetVar('errormsg', _MODARGSERROR);
            return false;
        }
        if (!pnSecAuthAction(0, 'Informacion::', "::", ACCESS_ADD)) {       pnSessionSetVar('errormsg', _MODULENOAUTH);return false;}
        $dbconn =& pnDBGetConn(true);
        $pntable =& pnDBGetTables();
        $catid = pnModGetVar('Informacion', 'cat');
        if (!pnUserLoggedIn()) {
            return false;
        } else {
            $uid=pnUserGetVar('uid');
            $uname=pnUserGetVar('uname');
        }
        $date=date("Y-m-d H:i:s");
        $informaciontable  = &$pntable['stories'];
        $informacioncolumn = &$pntable['stories_column'];
        $nextId = $dbconn->GenId($informaciontable);
        list($title,$comm,$hometext,$bodytext,$notes) = pnVarPrepForStore($title,$comm,$hometext,$bodytext,$notes)
        $sql = "INSERT INTO $informaciontable (
                  $informacioncolumn[sid],
                  $informacioncolumn[catid],              
                  $informacioncolumn[aid],              
                  $informacioncolumn[title],             
                  $informacioncolumn[time],              
                  $informacioncolumn[hometext],              
                  $informacioncolumn[bodytext],              
                  $informacioncolumn[comments],            
                  $informacioncolumn[counter],
                  $informacioncolumn[topic],              
                  $informacioncolumn[informant],             
                  $informacioncolumn[notes],             
                  $informacioncolumn[ihome],             
                  $informacioncolumn[withcomm],
                  $informacioncolumn[alanguage],
                  $informacioncolumn[themeoverride],
                  $informacioncolumn[format_type])
                VALUES (
                  '"
    .(int)$nextId."',
                  '"
    .$catid."',
                  '"
    .$uid."',
                  '"
    .$title."',              
                  '"
    .$date."',              
                  '"
    .$hometext."',              
                  '"
    .$bodytext."',              
                  '0',
                  '0',
                  '',
                  '"
    .$uname."',
                  '"
    .$notes."',
                  '1',           
                  '"
    .$comm."',
                  '',
                  '',            
                  '5'
                  )"
    ;
        if ($dbconn->ErrorNo() != 0) {
            pnSessionSetVar('errormsg', _CREATEFAILED);
            return false;
        }
        $cod = $dbconn->PO_Insert_ID($informaciontable, $informacioncolumn['sid']);
        pnModCallHooks('item', 'create', $cod, array('module' => 'Informacion'));
        return $cod;
    }


    I hope you could help me! Thanks!



    edited by: SiCk949, Sep 11, 2006 - 10:12 AM

Extensions Moderation

Main Menu

Extensions Database

Documentation

Development

Login

Donate to Zikula