Stored Procedure execution using MySQL Extension
Friends, here I am going to share an interesting thing which I faced recently.
In PHP, everyone knows to establish a mysql connection we use (This is the standard)
<?php
mysql_connect(‘HOST_NAME’, ‘USER_NAME’, ‘PASSWORD’);\* Using MYSQL extnsion *\
/* OR */
mysqli_connect(‘HOST_NAME’, ‘USER_NAME’, ‘PASSWORD’);\* Using MYSQLi extnsion *\
?>
Presently, everyone is using Stored Procedures and to execute the Stored Procedure uses the MYSQLi Extension. But in previous versions of PHP which have no support for MYSQLi, it’s a been tricky. Because to execute Multi-Query statements(Stored Procedures), we have to enable it by adding two new parameters in mysql_connect. Otherwise it throws errors.
<?php
mysql_connect(‘HOST_NAME’, ‘USER_NAME’, ‘PASSWORD’);\* Using MYSQL extnsion *\
/* OR */
mysqli_connect(‘HOST_NAME’, ‘USER_NAME’, ‘PASSWORD’);\* Using MYSQLi extnsion *\
?>
Presently, everyone is using Stored Procedures and to execute the Stored Procedure uses the MYSQLi Extension. But in previous versions of PHP which have no support for MYSQLi, it’s a been tricky. Because to execute Multi-Query statements(Stored Procedures), we have to enable it by adding two new parameters in mysql_connect. Otherwise it throws errors.
<?php mysql_connect('HOST_NAME', 'USER_NAME', 'PASSWORD', NEW_LINK, CLIENT_FLAG );\* Using MYSQL extnsion *\ ?> So the cod eshould look like <?php mysql_connect('HOST_NAME', 'USER_NAME', 'PASSWORD', false, 65536 );\* Using MYSQL extnsion *\ ?>
To read more about this, check this
0 comments:
Post a Comment