| | |
PHP and MySQL Stored Procedure Exec Problem
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
here is my stored procedure
here is my php code
so far everything works fine after calling second procedure.
.... doesnt show up anything... i got empty array
i closed and opened the connection and freed the previous array etc etc..
still nothing.. anyone has idea??
thanx in advance.
sql Syntax (Toggle Plain Text)
BEGIN SELECT indexes.IndexID, languages.LanguageID, languages.LanguageName, indexes.OrderID, indexes.IndexName FROM indexes, languages WHERE indexes.LanguageID = languages.LanguageID AND languages.LanguageID = Language ORDER BY indexes.OrderID asc; END
here is my php code
php Syntax (Toggle Plain Text)
<?php $Server = "127.0.0.1"; $Port = ":"."3306"; $DataBase = "abc"; $UserName = "def"; $PassWord = "blabla"; $Flags = "MYSQL_CLIENT_SSL"; $Connection = mysql_connect($Server . $Port, $UserName, $PassWord, $Flags, 65536); if(!$Connection) { die("Could not connect to server : " . mysql_error()); } else { mysql_select_db($DataBase,$Connection) or die("Could not connect to database"); } $TM = mysql_query("Call SP_Index($Language)",$Connection); while($TM_W = mysql_fetch_array($TM)) { $i1++; print $TM_W[4]; } ?>
so far everything works fine after calling second procedure.
.... doesnt show up anything... i got empty array
php Syntax (Toggle Plain Text)
<?php $Cat = mysql_query("Call SP_Category($Language)",$Connection); $Cat_N = mysql_num_rows($Cat); while($Cat_W = mysql_fetch_array($Cat)) { $i3++; print $Cat_W[4]; } ?>
still nothing.. anyone has idea??
thanx in advance.
Last edited by fatihpiristine; Nov 7th, 2007 at 7:11 pm.
mysqli version.. doesnt work also... 

php Syntax (Toggle Plain Text)
<?php $Server = "127.0.0.1"; $DataBase = "teknober"; $UserName = "root"; $PassWord = "19741968"; $Connection = mysqli_connect($Server, $UserName, $PassWord); if(!$Connection) { die("Could not connect to server : " . mysqli_error()); } else { mysqli_select_db($Connection,$DataBase) or die("Could not connect to database"); } ?> <?php print "Procedure #1<br>"; $TM = mysqli_query($Connection, "CALL mypro;"); while($TM_W = mysqli_fetch_array($TM)) { print $TM_W[2] . "<br>"; } ?> <?php print "<hr>"; print "Procedure #2<br>"; $TM = mysqli_autocommit($Connection,1); $TM = mysqli_query($Connection, "select * from news;"); while($TM_W = mysqli_fetch_array($TM)) { print $TM_W[2] . "<br>"; } ?>
i got a smiliar procedure to work on my server. i hope this helps.
here is the procedure:
Here is the php:
here is the procedure:
PHP Syntax (Toggle Plain Text)
CREATE PROCEDURE SP_Index (IN lang VARCHAR(255), OUT info BLOB) BEGIN SELECT indexes.IndexID, languages.LanguageID, languages.LanguageName, indexes.OrderID, indexes.IndexName INTO info FROM indexes,languages WHERE indexes.LanguageID = languages.LanguageID AND languages.Language = lang ORDER BY indexes.OrderID ASC; END
Here is the php:
PHP Syntax (Toggle Plain Text)
<?php $Server = "127.0.0.1"; $Port = ":"."3306"; $DataBase = "abc"; $UserName = "def"; $PassWord = "blabla"; $Flags = "MYSQL_CLIENT_SSL"; $Connection = mysql_connect($Server . $Port, $UserName, $PassWord, $Flags, 65536); if(!$Connection) { die("Could not connect to server : " . mysql_error()); } else { mysql_select_db($DataBase,$Connection) or die("Could not connect to database"); } $TM = mysql_query("Call SP_Index($Language, @data)", $Connection); $TM2 = mysql_query('SELECT @data'); while ($TM_W = mysql_fetch_array($TM2)) { //DO WHAT YOU WANT }
![]() |
Similar Threads
- PHP MySQL 5.0 stored procedure (PHP)
- how to call Stored Procedure in mysql by php (PHP)
- php mysql problem (PHP)
- how do I run a "disconnected" stored procedure (MS SQL)
- Stored procedure call with ADO (C)
- php mysql help (PHP)
- Using PHP, MySQL and Apache Server (PHP)
- DB-Authentication php/mysql on Mac OSX v3 (PHP)
Other Threads in the PHP Forum
- Previous Thread: doc root in windows virtual hosting
- Next Thread: Pagination Help
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code codingproblem cron curl database date directory display download dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla limit link login loop mail memmory menu methods mlm mod_rewrite multiple mysql oop parameter parse paypal pdf php problem query radio random recursion regex remote script search select send server sessions sms soap source space speed sql static structure syntax system table tutorial up-to-date update upload url validation validator variable video web wordpress xml youtube






