0

I have such code to get via odbc some data...

     $data = odbc_exec($this->odbc_id, $odbc_query);
     odbc_longreadlen($data, 10485760); //10MB = 10485760
     while(odbc_fetch_row($data)) 
     { 
     $row = odbc_fetch_array($data);
     if($row['graphID'] != "") {
     $file_name_jp2 = "TI/" . $table_name . "/" . $row['graphID'] . ".jp2";
     $file = fopen ($file_name_jp2, "w");
     fputs($file, $row['graph']);
     fclose($file);
     set_time_limit(3600);
 }

 unset($row);
 }

but for some reasons it is fetching each each second db entrie... But why? What i write wrong?

What to change to fetch all data?

1 Answer 1

2

You're using both odbc_fetch_array and odbc_fetch_row, you should be using one of the other. Something similar to:

while($row = odbc_fetch_array($data)) {
  // As you were..
}

And remove your line:

$row = odbc_fetch_array($data);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.