0

I have follow issue with my php function; it tell me that my sql fields not find instead they are present. what mistake did I make in the code? Thanks for any help Andrea

enter image description here

function get_card($carta_posted) {
    global $connection;
    $query="SELECT f50carta, f50nome, f50cognome FROM qs36f.fid050f"; //where carta = '970002871875'";
    
    if($carta_posted != null) {
        //echo $_GET["card_id"];
        $query.=" WHERE f50carta = '".$carta_posted."' LIMIT 1";
    }   
    $response=array();
    $response["records"] = array();
    $result = odbc_exec($connection, $query);
     
    if (odbc_num_rows($result) > 0) {
        while ($row=odbc_fetch_array($result)) {
            $card_item = array(
                'carta' => $row['f50carta'],
                'nome' => $row['f50nome'],
                'cognome' => $row['f50cognome']
            );
            array_push($response["records"], $card_item);
        }
    } else {
        $response=("No Record Found"); 
    }
    echo json_encode($response); 
}

?>

Notice: Undefined index: f50carta in C:\xampp\htdocs\wstest\cards_post.php on line 96

Notice: Undefined index: f50nome in C:\xampp\htdocs\wstest\cards_post.php on line 97

Notice: Undefined index: f50cognome in C:\xampp\htdocs\wstest\cards_post.php on line 98

Michael
  • 3,093
  • 7
  • 39
  • 83
Andrea
  • 1

0 Answers0