tags:

views:

90

answers:

2

If php code like below how it's like as mysql store procedure equvilant.If any links tutorial on advance store proc mysql please put.

$sql=" SELECT  a,b FROM  j ";
$result=mysql_query($sql);
if(mysql_num_rows($result) > 0 ) { 
  while($row=mysql_fetch_array($result)) { 
    $sql_update="UPDATE b set a=".$row['a']."'";  
    mysql_query($sql_update);
  }
}
+1  A: 

There's a pretty complete example here. The article is about Qcodo, but there's a good example using the mysqli API.

http://amountaintop.com/php-5-and-mysql-5-stored-procedures-error-and-solution-qcodo

You can't do it with the mysql extension. Stored procedures can return multiple result sets, so you must use the mysqli extension. You need to call mysqli_multi_query() and continue to loop over result sets until you have read them all.

Bill Karwin
A: 

You could look into mysqli and use prepared statements?

James Hartig