2013-02-12 139 views
-4

我能做些什么来修复我的代码?我收到以下错误消息,当我运行程序:致命错误:调用未定义的方法PDOStatement :: fetch_row()

Fatal error: Call to undefined method PDOStatement::fetch_row() in C:\apache2\Apache2\htdocs\ch\ch32\listing32_2(1).php on line 12

<?php 

    // Instantiate the mysqli class 
    $db = new PDO("mysql:host=localhost;dbname=coorporate", "root", "xxxxxxxx"); 

    // Assign the employeeID 
    $eid = htmlentities($_POST['id']); 

    // Execute the stored procedure 
    $result = $db->query("SELECT calculate_bonus('$eid')"); 

    $row = $result->fetch_row(); 

    printf("Your bonus is \$%01.2f",$row[0]); 
?> 

回答

2

在PDOStatement对象不存在的fetch_row方法 - 你必须使用PDOStatement::fetch(PDO::FETCH_NUM)

相关问题