Quick php question, should be pretty simple I think.

christopherareed - March 25, 2009 - 22:40

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.

I haven't used it yet, but

setfree - March 26, 2009 - 01:11

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,

christopherareed - March 26, 2009 - 01:23

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

The Type local nids module

nevets - March 26, 2009 - 02:00

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

 
 

Drupal is a registered trademark of Dries Buytaert.