PHP MySQL 5.0 stored procedure

Thread Solved

Join Date: Jan 2006
Posts: 29
Reputation: rcasinillo_s is an unknown quantity at this point 
Solved Threads: 0
rcasinillo_s rcasinillo_s is offline Offline
Light Poster

PHP MySQL 5.0 stored procedure

 
0
  #1
Mar 15th, 2006
Any could give me a PHP script on how to call or execute mysql stored procedure.

Thank you.

Roland
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 2
Reputation: ameer is an unknown quantity at this point 
Solved Threads: 1
ameer ameer is offline Offline
Newbie Poster

Re: PHP MySQL 5.0 stored procedure

 
0
  #2
Mar 21st, 2006
Before you installed the php_mysqli.dll


<?php

/* Connect to a MySQL server */
$link = mysqli_connect(
'localhost', /* The host to connect to */
'root', /* The user to connect as */
'root', /* The password to use */
'db_name'); /* The default database to query */

if (!$link) {
printf("Can't connect to MySQL Server. Errorcode: %s\n", mysqli_connect_error());
exit;
}


/* Send a query to the server */
if ($result = mysqli_query($link, "call se_proc('crm')")) {


/* Fetch the results of the query */
while( $row = mysqli_fetch_array($result) ){

echo ($row[0]. "--------- SR. " . $row[1] . "<br>");

}

/* Destroy the result set and free the memory used for it */
mysqli_free_result($result);
}

/* Close the connection */
mysqli_close($link);
?>
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 2
Reputation: kladizkov is an unknown quantity at this point 
Solved Threads: 1
kladizkov kladizkov is offline Offline
Newbie Poster

Re: PHP MySQL 5.0 stored procedure

 
0
  #3
May 4th, 2008
Oh it was simple, just execute "call proc_name"

http://fabinm.com/content/view/17/9/
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 3
Reputation: thinktejas is an unknown quantity at this point 
Solved Threads: 1
thinktejas thinktejas is offline Offline
Newbie Poster

Re: PHP MySQL 5.0 stored procedure

 
0
  #4
Sep 10th, 2008
There is an article on this site which shows how to access Mysql Stored procedures using PDO and PHP
http://tejuspratap.co.cc/2008/08/29/...-using-php-50/
Last edited by thinktejas; Sep 10th, 2008 at 4:39 am.
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 16
Reputation: mazeroth is an unknown quantity at this point 
Solved Threads: 3
mazeroth mazeroth is offline Offline
Newbie Poster

Re: PHP MySQL 5.0 stored procedure

 
0
  #5
Jan 27th, 2009
Here's a quick tutorial on executing mysql stored procedures in php using mysql, mysqli, and pdo for the people using the different database extension:

http://www.joeyrivera.com/2009/using...ysqlmysqlipdo/
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 3
Reputation: thinktejas is an unknown quantity at this point 
Solved Threads: 1
thinktejas thinktejas is offline Offline
Newbie Poster

Re: PHP MySQL 5.0 stored procedure

 
0
  #6
Jul 13th, 2009
Originally Posted by thinktejas View Post
There is an article on this site which shows how to access Mysql Stored procedures using PDO and PHP
http://tejuspratap.co.cc/2008/08/29/...-using-php-50/
The article has been moved to http://www.tejuspratap.com/main/node/18
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 3
Reputation: thinktejas is an unknown quantity at this point 
Solved Threads: 1
thinktejas thinktejas is offline Offline
Newbie Poster

Re: PHP MySQL 5.0 stored procedure

 
0
  #7
Jul 16th, 2009
Originally Posted by thinktejas View Post
The article has been moved to http://www.tejuspratap.com/main/node/18
I am sorry I gave the wrong url before.

The article has been moved to http://www.tejuspratap.com/main/cont...s-using-php-50
Last edited by thinktejas; Jul 16th, 2009 at 4:26 am. Reason: I gave the wrong url before.
Reply With Quote Quick reply to this message  
Join Date: Nov 2009
Posts: 2
Reputation: kbramprasath is an unknown quantity at this point 
Solved Threads: 0
kbramprasath kbramprasath is offline Offline
Newbie Poster
 
0
  #8
Nov 16th, 2009
  1. DROP PROCEDURE IF EXISTS `UsersR_DELETE_byPK`
  2. GO
  3.  
  4. CREATE PROCEDURE UsersR_DELETE_byPK
  5. (
  6. IN UsersID INT(11)
  7. )
  8. BEGIN
  9.  
  10. DELETE FROM UsersR
  11.  
  12. WHERE UsersID=UsersID;
  13.  
  14.  
  15. END
it is my stored proceder how to call php code perfom delete operation
Last edited by nav33n; Nov 16th, 2009 at 6:25 am. Reason: Please use [code] tags to wrap your code.
Reply With Quote Quick reply to this message  
Join Date: Dec 2009
Posts: 1
Reputation: topspindex is an unknown quantity at this point 
Solved Threads: 0
topspindex topspindex is offline Offline
Newbie Poster
 
0
  #9
Dec 16th, 2009
Originally Posted by rcasinillo_s View Post
Any could give me a PHP script on how to call or execute mysql stored procedure.

Thank you.

Roland
I'll give you a very simple connection.. and how to call a procedure very simply. here it is -
------->
//first create a connection to your database...
function connection(){
$mysqli = new mysqli('$hostname','$dbusername', '$dbpassword', '$dbname');
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}

return $mysqli;

}
//second create the function to call the stored procedure
function query($query){
//call the connection function
if($result = connection()->query($query)){
while($row = $result->fetch_assoc()){
$data[] = $row;
}
return $data;
}else {
print('error on:'.$query.mysqli_error($this));
}
}
//then call the function to execute stored procedure
query("call store_proc('$param1')");
done! it's that simple... thanks
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum


Views: 61814 | Replies: 8
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2010 DaniWeb® LLC