im using hook form alter in drupal.
If the fields left empty I want it to get the last value submitted for the field and increase it by .01
Ive tried
function uc_pa_form_submit($form, &$form_state) {
global $user;
$maxbid = db_result(db_query('SELECT MAX(amount) FROM {uc_auction_bids} WHERE nid = %d', $node->nid));
$input01 = (($maxbid) ? $maxbid : 0) + .01;
drupal_write_record('table', $input01);
but it isnt updating with anything, I know $input01 works as I tried it in a different function.
if i change drupal_write_record(‘table’, $input01); to the value submitted it works.
drupal_write_record()expects the second argument to be an object, at the moment you’re passing a number. Also, if you’re trying to update a record you’ll need to provide the table’s primary keys as the third argument. Something like this: