Пример #1
0
function do_dbwrite($sql, $verb, $expected_rows = 1, $link = NULL)
{
    if ($link == NULL) {
        $link = get_dblink();
    }
    if ($link == NULL) {
        return false;
    }
    write_debug("SQL {$verb}: [{$sql}]");
    $rc = mysql_query($sql, $link);
    if ($rc == false) {
        $err = mysql_error();
        $upperverb = strtoupper($verb);
        write_error("Problem in {$upperverb} statement: {$err}");
        return false;
    }
    // if
    $retval = mysql_affected_rows($link);
    if ($expected_rows >= 0 and $retval != $expected_rows) {
        $err = mysql_error();
        write_error("Database {$verb} error: {$err}");
    }
    // if
    return $retval;
}
Пример #2
0
function op_findall()
{
    if (!get_input_string('wanttype', 'Database field type', $wanttype)) {
        return;
    }
    write_debug("called op_findall({$wanttype})");
    do_find($wanttype);
}