Ben son sorgunun Otomatik artma değerinin kimliğini almak gerekir.
Benim sorgu şöyle:
$result = $wpdb->query( $wpdb->prepare( "
INSERT INTO $table_name
( name, season, copyright, description, path )
VALUES ( %s, %s, %s, %s, %s )",
$galleryData['name'], $galleryData['season'], $galleryData['copyright'], $galleryData['description'], $galleryData['path'] ) );
// Let's output the last autogenerated ID.
echo $wpdb->insert_id;
// This returns the same result
echo mysql_insert_id();
Looking at my DB table, I see rows counting from 1 to 24 (24 rows).
But using $wpdb->insert_id or mysql_insert_id() returns 241.
Yeni ekler yapıyor böylece 251, 261, 271 dönecektir ve. Neden sonunda ve ekstra '1 'do?
UPDATE
Thanks to Pekka (I'd better stad running a tab on the number of beers I owe him), I figured it out.
Ek kod aşağı Bende bu var:
if(!$result)
_e("[DB error] Ups. Something went wrong when trying to insert the event.");
else
echo true;
Bu son açıklama var (true) echo outputed olduğunu!