Example #1
0
function dba_insert_id($mystring)
{
    global $dba_object, $dba_DB, $DBA_ROW_COUNTER, $DBA_LIMIT_FROM, $DBA_LIMIT_COUNT;
    if (dba_query($mystring)) {
        switch (_DB_TYPE_) {
            case "mysql":
            case "mysqli":
                $myquery = "SELECT @@IDENTITY";
                $result_tmp = dba_query($myquery);
                list($result) = dba_fetch_row($result_tmp);
                break;
            case "sqlite3":
                $myquery = "SELECT last_insert_rowid()";
                $result_tmp = dba_query($myquery);
                $result = dba_fetch_row($result_tmp);
                $result = $result[0];
                break;
            case "pgsql":
                $myquery = "SELECT lastval()";
                $result_tmp = dba_query($myquery);
                list($result) = dba_fetch_row($result_tmp);
                break;
        }
    }
    return $result;
}
Example #2
0
function dba_insert_id($mystring)
{
    global $dba_object, $dba_DB, $DBA_ROW_COUNTER, $DBA_LIMIT_FROM, $DBA_LIMIT_COUNT;
    if (dba_query($mystring)) {
        $myquery = "SELECT @@IDENTITY";
        $result_tmp = dba_query($myquery);
        list($result) = dba_fetch_row($result_tmp);
    }
    return $result;
}