2013-02-12 3 views
-4

내 코드를 수정하려면 어떻게해야합니까? 나는이 프로그램을 실행할 때 다음과 같은 오류 메시지가 : PDOStatement에서치명적 오류 : 정의되지 않은 메서드 호출 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

는 fetch_row 방법이 존재하지 않는다 - 당신은 당신은 PDOStatement::fetch 필요 PDOStatement::fetch(PDO::FETCH_NUM)

0

사용할 필요가 더 fetch_row()이 없습니다.

$row = $result->fetch_row();$row = $result->fetch();

이어야합니다.
관련 문제