cooldude832 Posted March 2, 2009 Share Posted March 2, 2009 I'm gonna sound stupid here, but Can you delete all instances from a database where a UserID = $userid? not just a table the whole db? I'm developing something new and I wanted to know if it works and if I can combo it with innoDB to make it even better Link to comment https://forums.phpfreaks.com/topic/147495-delete-from-db/ Share on other sites More sharing options...
dropfaith Posted March 2, 2009 Share Posted March 2, 2009 so you want to delete a user from all tables in a database? so it would remove the account ad all posts maid emails or whatever data your dealing with? hrmm i havent seen anything to that extent maybe loop an array as the table <? // includes include("../header.php"); // open database connection $conn = mysql_connect(HOST, DBUSER, PASS) or die('Could not connect !<br />Please contact the site\'s administrator.'); $db = mysql_select_db(DB) or die('Could not connect to database !<br />Please contact the site\'s administrator.'); // generate and execute query $UserID = mysql_escape_string(trim(htmlentities($_GET['UserID']))); $table = newmysql_query("DELETE FROM $table WHERE UserID = '$UserID'") or die(mysql_error()); echo newmysql_query; echo mysql_query; ?> Link to comment https://forums.phpfreaks.com/topic/147495-delete-from-db/#findComment-774282 Share on other sites More sharing options...
corbin Posted March 2, 2009 Share Posted March 2, 2009 You would have to do foreign keys or what dropfaith said. There's no such thing as a DELETE FROM DATABASE statement ;p. Link to comment https://forums.phpfreaks.com/topic/147495-delete-from-db/#findComment-774288 Share on other sites More sharing options...
cooldude832 Posted March 2, 2009 Author Share Posted March 2, 2009 i was trying to get fancy with innoDB, but I realized that innoDB does this for me so I solved my own issue using the right engine. its just innoDB is so constricting that if I don't need it I shouldn't use it Link to comment https://forums.phpfreaks.com/topic/147495-delete-from-db/#findComment-774314 Share on other sites More sharing options...
corbin Posted March 2, 2009 Share Posted March 2, 2009 Constricting? How is InnoDB constricting? Link to comment https://forums.phpfreaks.com/topic/147495-delete-from-db/#findComment-774326 Share on other sites More sharing options...
cooldude832 Posted March 2, 2009 Author Share Posted March 2, 2009 Constricting? How is InnoDB constricting? You lose some things you use to in ISAM Link to comment https://forums.phpfreaks.com/topic/147495-delete-from-db/#findComment-774338 Share on other sites More sharing options...
corbin Posted March 2, 2009 Share Posted March 2, 2009 There are reasons for InnoDB over MyISAM though. Row level locking, transactions.... Link to comment https://forums.phpfreaks.com/topic/147495-delete-from-db/#findComment-774349 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.