|
#1
|
|||
|
|||
|
AUTO_INCREMENT for image ID numbers?
Is there a reason that's escaping me why mysql_insert_id() is being used to assign the image ID for new posts, instead of counting the number of existing images and incrementing by one?
Since mysql_insert_id() retrieves the ID generated for the AUTO_INCREMENT column by the previous INSERT query, if images are ever deleted and later re-added (or not) it causes quirky jumps/gaps in the image ID. I realize this is being extremely picky, but it seems that something like the following would work just as well: $photonumb = sql_array("select count(*) as count from ".$pixelpost_db_prefix."pixelpost"); $theid = $photonumb['count'] + 1; |
|
#2
|
|||
|
|||
|
Luminist:
yes there is a reason: It was done like this. You know, you have almost everytime more than one choice, even in programming.. but seriously: Punk who created PixelPost, used this function and not the other. But what is the problem for you: IDs are IDs and not inventary-numbers.. they work for functionality, for counting you have other tools or do you see any problems in it? |
|
#3
|
||||
|
||||
|
if this small aesthetical problem is more important than functionailty to users then this is useful otherewise steer clear.
__________________
Affordable Website Design in North Wales |
|
#4
|
|||
|
|||
|
As Joey said, it's purely aesthetic. I didn't mean to suggest that the current implementation is a bad one (quite the contrary, I'm thrilled with the application), I was more curious as to whether there was an inherent benefit that wasn't obvious to me from using auto_increment.
Thanks! |
|
#5
|
||||
|
||||
|
I prefer not to answer the over asked question about the image id.
8)
__________________
Photoblog: http://pblog.raminia.com Powered by Pixelpost 1.7 |
| Post Reply |
| Thread Tools | |
|
|