Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6731825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:34:29+00:00 2026-05-26T10:34:29+00:00

im using hook form alter in drupal. If the fields left empty I want

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T10:34:30+00:00Added an answer on May 26, 2026 at 10:34 am

    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:

    $sql = 'SELECT * FROM FROM {uc_auction_bids} WHERE nid = %d ORDER BY amount DESC LIMIT 1';
    $obj = db_fetch_object(db_query($sql));
    $obj->amount = (($obj->amount) ? $obj->amount: 0) + .01;
    
    drupal_write_record('uc_auction_bids', $obj, array('bid'));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi sorry about my bad terminology. Im using drupal Im using hook form alter
I have a custom user registration form at: somepath/register using hook form alter. I
Trying to prepopulate some of my form fields, and am using hook_form_alter(). I've tried
I want to redirect my form after submissions, I'm trying to use a hook,
When submitting a message in my site-wide contact form in Drupal 6.x I get
I've made a field using Custom Formatters (Drupal, CCK). Now I got this PHP
how can I run specific code when a form is submitted in Drupal ?
I'm using hook_node_presave to pre-populate taxonomy field with group's audience value. Thus, I'm trying
I am filtering the HKEYS by using Hook filtering function, I use the following
For tracking user activity, I am using a Windows Hook for the main application

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.