unxposed Posted July 15, 2009 Share Posted July 15, 2009 Okay so can't get my head around this. I have a query: INSERT INTO pages (parent_id, layout_id, clean_url, title, description, keywords, live, language_id, navigation, weight , created, created_by, modified, modified_by) VALUES ('1', '1', '/boooo', 'booooooo', 'hello', '', '1', '3', '1', '0' , NOW(), 1, NOW(), 1) It works okay and inserts a row, but if I use mysql_num_rows I don;t get any valuem it returns blank. Therefore when I use it here: if (mysql_num_rows($result) >= 1) { do this } else { do that } It always goes to else. Also when I try and manually insert the query through phpmyadmin it inserts, but I don;t get the green bar returned saying it's been inserted and giving details of the query!? Weird, or am I just being stupid? Help would be really appreciated. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/166062-solved-query-works-but-no-data-returned/ Share on other sites More sharing options...
kickstart Posted July 15, 2009 Share Posted July 15, 2009 Hi mysql_num_rows only works on SELECTs and the like. For INSERTs and the like you need to use mysql_affected_rows(). All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/166062-solved-query-works-but-no-data-returned/#findComment-875781 Share on other sites More sharing options...
unxposed Posted July 15, 2009 Author Share Posted July 15, 2009 Ooops. Thanks for that, I probably should have known that... but I just didn't!!! Thanks again. Quote Link to comment https://forums.phpfreaks.com/topic/166062-solved-query-works-but-no-data-returned/#findComment-875789 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.