Stefany93 Posted August 21, 2012 Share Posted August 21, 2012 Hello friends, I want to check when a new row is inserted into the mysql DB, but the problem is that since I insert the rows manualy because they are blog posts, the mysql_insert_id doesn't work, and I would very much like to check that because I would like a mail to be send after that action. Please tell me how to check when a row is inserted. Thank you! Best Regards Stefany Quote Link to comment https://forums.phpfreaks.com/topic/267393-how-to-check-whether-a-row-is-inserted-into-the-db/ Share on other sites More sharing options...
xyph Posted August 21, 2012 Share Posted August 21, 2012 What do you mean, manually? If you're inserting them yourself, why do you need a script to check if you've inserted a row? Quote Link to comment https://forums.phpfreaks.com/topic/267393-how-to-check-whether-a-row-is-inserted-into-the-db/#findComment-1371227 Share on other sites More sharing options...
floridaflatlander Posted August 21, 2012 Share Posted August 21, 2012 I think myqli_affected_rows($data_base_connection) for INSERT, UPDATE or DELETE if (myqli_affected_rows($data_base_connection) == 1) { } Quote Link to comment https://forums.phpfreaks.com/topic/267393-how-to-check-whether-a-row-is-inserted-into-the-db/#findComment-1371229 Share on other sites More sharing options...
Stefany93 Posted August 21, 2012 Author Share Posted August 21, 2012 Because I want the system to automatically send an email to all the subsdcribers to the blog. Or am I doing everyrhinf wron? Sorry, sometimes I do everything so messed up :'( Quote Link to comment https://forums.phpfreaks.com/topic/267393-how-to-check-whether-a-row-is-inserted-into-the-db/#findComment-1371230 Share on other sites More sharing options...
floridaflatlander Posted August 21, 2012 Share Posted August 21, 2012 Because I want the system to automatically send an email to all the subsdcribers to the blog. Is this something you built or is it something like wordpress? Quote Link to comment https://forums.phpfreaks.com/topic/267393-how-to-check-whether-a-row-is-inserted-into-the-db/#findComment-1371234 Share on other sites More sharing options...
xyph Posted August 21, 2012 Share Posted August 21, 2012 Because I want the system to automatically send an email to all the subsdcribers to the blog. Or am I doing everyrhinf wron? Sorry, sometimes I do everything so messed up :'( So why are you manually entering the database information. If you're going as far as having subscribers and want to send out mass e-mails on updates, why not create a front-end to update the blog, and have it send the e-mails. Quote Link to comment https://forums.phpfreaks.com/topic/267393-how-to-check-whether-a-row-is-inserted-into-the-db/#findComment-1371245 Share on other sites More sharing options...
Stefany93 Posted August 21, 2012 Author Share Posted August 21, 2012 Because with the front end I will have to create an admin panel and everything the admin panel does I can do it myself. I have heard that admin panels are made only for people do not know how to program. I mean, I can do everything just manually typing the blog post and title and stuff. And to answer the upper question, I am not using wordpress, I have made the blog myself. Quote Link to comment https://forums.phpfreaks.com/topic/267393-how-to-check-whether-a-row-is-inserted-into-the-db/#findComment-1371261 Share on other sites More sharing options...
Jessica Posted August 21, 2012 Share Posted August 21, 2012 I mean, I can do everything just manually typing the blog post and title and stuff. Apparently not. You should make an admin interface for your blog. Quote Link to comment https://forums.phpfreaks.com/topic/267393-how-to-check-whether-a-row-is-inserted-into-the-db/#findComment-1371263 Share on other sites More sharing options...
xyph Posted August 21, 2012 Share Posted August 21, 2012 I have heard that admin panels are made only for people do not know how to program. I mean, I can do everything just manually typing the blog post and title and stuff. Then do it that way, I suppose? Or write a CLI-based script that accepts a flag/argument containing the row's ID and e-mails all your subscribers? Run this script after you've added a post, manually giving it the post's unique ID. I'm not sure if you can create a MySQL trigger that will run an outside application, that might be worth looking into as well. Quote Link to comment https://forums.phpfreaks.com/topic/267393-how-to-check-whether-a-row-is-inserted-into-the-db/#findComment-1371265 Share on other sites More sharing options...
Stefany93 Posted August 22, 2012 Author Share Posted August 22, 2012 Well thank you for the help, everybody! I will see what I can do. Quote Link to comment https://forums.phpfreaks.com/topic/267393-how-to-check-whether-a-row-is-inserted-into-the-db/#findComment-1371339 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.