You need to make a copy of the str instead of just capturing a pointer reference.
try: my_array[i] = strdup(sqlite3_column_text(pStat, 0)); "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: Hello, I got an error when I try to read some data outside the while{}, inside the while{} it's ok, an idea ? test.db have just one "table1" and a "field1" with values "one", "two", "three". #include #include int main(void) { sqlite3 *db; sqlite3_stmt *pStat; const char *dbname = "test.db"; const char *sql = "SELECT * FROM table1"; const unsigned char *my_array[3]; int i=0;; sqlite3_open(dbname, &db); sqlite3_prepare_v2(db, sql, -1, &pStat, 0); while(sqlite3_step(pStat) == SQLITE_ROW) { my_array[i] = sqlite3_column_text(pStat, 0); printf ("%s\n",my_array[i]); // ok i++; } for (i = 0; i<3; i++);{ printf ("%s\n", my_array[i]); // error } sqlite3_finalize(pStat); sqlite3_close(db); return 0; } Fred. ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------