Community & Support

Quick php question, should be pretty simple I think.

I'll try to keep it short and simple. I have a content type that contains a number like 10000. It's like an ID number that is used for something outside of Drupal. Everytime someone inputs more data to a new page, that page gets the #10001, then 10002 etc. Is there anyway to just have that field automatically fill itself in by calling the content type via php then search for the field ad_number, and return the highest value+1? I've been digging through the api drupal website (and googling php syntax) and I'm kind of stumped for as simple as this seems. Anyways, thanks ahead of time. I'll post back if I figure out.

Comments

I haven't used it yet, but

I haven't used it yet, but the computed field module for CCK sounds like it may work. You can assign it's value through PHP code. So you should be able to create an SQL query to find the highest ad_number and then simply +1.

Ooo, checking it out now,

Ooo, checking it out now, thanks! I'll write back how it goes.

The Type local nids module

The Type local nids module sounds like it would meet your needs.