`

PHP call mysql stored procedure

    博客分类:
  • PHP
阅读更多

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); 
?> 
 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics