2013-02-12 51 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)

相關問題