vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Returning the ID's of deleted rows? (https://vborg.vbsupport.ru/showthread.php?t=54591)

Velocd 06-21-2003 05:12 PM

Returning the ID's of deleted rows?
 
I have a query that looks exactly like this:
PHP Code:

$DB_site->query("DELETE FROM categories WHERE FIND_IN_SET('$catid',parentlist)>0"); 

I need to somehow return the ID's of the rows deleted from this query. Those ID's being the values of the first column auto_increment 'categoryid' of the table categories.

I need this for a later query that looks like this:
PHP Code:

$DB_site->query("DELETE FROM images WHERE categoryid IN ($deletelist)"); 

$deletelist being the rows deleted in the first query, arranged in a comma seperated list using implode().

I would be very thankful if you could help. ;)

Xenon 06-21-2003 11:02 PM

hmm i don't know if this is dooable but you can do a workaround with a query you have to run before the delete query

SELECT id FROM...
then
DELETE from cat
then
Delete from images..

Velocd 06-21-2003 11:33 PM

True, that way wouldn't be hard, and I was about to result to that, but I was just seeing if it could be done in some other simpler trick.

Too bad it can't be done with something simple like how you can return the auto_increment id of an INSERT command using $DB_site->insert_id();

PHP needs a delete_ids(); that functions like insert_id(); but for the DELETE query (and can return many values).
[high]* Velocd shrugs
[/high]

Thanks though ;)

filburt1 06-21-2003 11:44 PM

Such a function is a nice idea in concept but doesn't apply: insert_id() returns the newly created id of an auto_increment column. Nothing new is generated so nothing can be retrieved.


All times are GMT. The time now is 09:54 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01156 seconds
  • Memory Usage 1,715KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete