i have to call Mysql Procedure from Php... I dnt know how it is work..!!

Waiting for positive reply..!! :)

Recommended Answers

All 8 Replies

The example in the link also uses mysql functions, not mysqli.

Well, I am trying to response to all:

the communication between PHP and MySQL expects a single query and single (or none) response. While calling the stored procedure, the query and also the response is more complex, what you must announce at opening the connection: $link = mysql_connect("server", 'usr', 'pass', false, [B]196608[/B]) where the number 196608 = 131072 + 65536 what can be decoded according the following table:

/** All constants from MySQL source: */
#define CLIENT_LONG_PASSWORD            1 /* new more secure passwords */
#define CLIENT_FOUND_ROWS               2 /* Found instead of affected rows */
#define CLIENT_LONG_FLAG                4 /* Get all column flags */
#define CLIENT_CONNECT_WITH_DB          8 /* One can specify db on connect */
#define CLIENT_NO_SCHEMA               16 /* Don't allow database.table.column */
#define CLIENT_COMPRESS                32 /* Can use compression protocol */
#define CLIENT_ODBC                    64 /* Odbc client */
#define CLIENT_LOCAL_FILES            128 /* Can use LOAD DATA LOCAL */
#define CLIENT_IGNORE_SPACE           256 /* Ignore spaces before '(' */
#define CLIENT_PROTOCOL_41            512 /* New 4.1 protocol */
#define CLIENT_INTERACTIVE           1024 /* This is an interactive client */
#define CLIENT_SSL                   2048 /* Switch to SSL after handshake */
#define CLIENT_IGNORE_SIGPIPE        4096 /* IGNORE sigpipes */
#define CLIENT_TRANSACTIONS          8192 /* Client knows about transactions */
#define CLIENT_RESERVED             16384 /* Old flag for 4.1 protocol */
#define CLIENT_SECURE_CONNECTION    32768 /* New 4.1 authentication */
#define CLIENT_MULTI_STATEMENTS     [B]65536[/B] /* Enable/disable multi-stmt support */
#define CLIENT_MULTI_RESULTS       [B]131072[/B] /* Enable/disable multi-results */

as it is described for example here

After some searching online, I think you may be right. Mysqli is recommended when using stored procs, so you may need to switch.

its nice to read people start store procedure in mysql

Hey.

The old MySQL extension was written for MySQL 3, and while it is compatible with MySQL 4 and above, it doesn't support most of the new functionality, like Stored Procedures.

If you are using MySQL 4 or higher, you should really be using the MySQLI extension, and, if only for the sake of security, be using Predefined Statements. (See the examples here)

But if you don't like that, using MySQLI can be almost identical to using MySQL. A minor difference in the connect functions aside, you can pretty much just replace the "mysql" in the function calls with "mysqli".

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.