Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/246.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在php/mysqli中调用过程?_Php - Fatal编程技术网

如何在php/mysqli中调用过程?

如何在php/mysqli中调用过程?,php,Php,我在MySQL中使用了。但我不能称之为程序 <?php $mysqli = new mysqli("localhost", "user", "pass", "testDB"); $query = "SELECT * FROM testTable"; if ($result = $mysqli->query($query)) { $row = $result->fetch_assoc(); header("Content-type: audio/mpeg")

我在MySQL中使用了。但我不能称之为程序

<?php
$mysqli = new mysqli("localhost", "user", "pass", "testDB");

$query = "SELECT * FROM testTable";

if ($result = $mysqli->query($query)) {
    $row = $result->fetch_assoc();

    header("Content-type: audio/mpeg"); 
    echo $row['audioData'];

    $result->free();
}

$mysqli->close();
?>
请尝试以下代码:

<?php
//database gegevens
$servername = "localhost";
$username = "root";
$password = "mysql";
$dbname = "db";


//maak connectie met database
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
$result = mysqli_query($conn, "SELECT * FROM testTable") or die(mysqli_error($conn));
if (mysqli_num_rows($result)>=1) {
    while($row = mysqli_fetch_array($result)) {
        $name = $row['name'];
   }   
  } 
 ?>

您可以使用call关键字调用该过程

$query = "CALL procedure_name(para_1,para_2);";


$result = $mysqli->query($query)

我看你没有要求任何程序?