abdfahim Posted February 19, 2008 Share Posted February 19, 2008 When I run any query using mysql_query, if any error occured, I can get the error message from mysql_error(). Is there any similar function which will result success message. Link to comment https://forums.phpfreaks.com/topic/91835-solved-how-to-shoy-mysql_query-success-message/ Share on other sites More sharing options...
Chris92 Posted February 19, 2008 Share Posted February 19, 2008 No, what you can do is write it yourself: <?php if( mysql_query("UPDATE `table` SET `field` = 'update' WHERE `field` = 'needs updated'") ) { echo "Successfully updated field"; } else { echo mysql_error(); } ?> Link to comment https://forums.phpfreaks.com/topic/91835-solved-how-to-shoy-mysql_query-success-message/#findComment-470340 Share on other sites More sharing options...
abdfahim Posted February 19, 2008 Author Share Posted February 19, 2008 the main problem with this is, for the following code REPLACE INTO `table1` SELECT * FROM `table2` WHERE CONDITION; I cant know how many rows has been updated. In phpmyadmin, if you run this query in any program like phpmyadmin, you will see this count how many rows has been updated. If there is no built-in function for this, I have write some other quiries to get that fegure. Link to comment https://forums.phpfreaks.com/topic/91835-solved-how-to-shoy-mysql_query-success-message/#findComment-470362 Share on other sites More sharing options...
PHP Monkeh Posted February 19, 2008 Share Posted February 19, 2008 You could take a look at : http://uk.php.net/manual/en/function.mysql-affected-rows.php Link to comment https://forums.phpfreaks.com/topic/91835-solved-how-to-shoy-mysql_query-success-message/#findComment-470371 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.