in reply to Perl Not returning SQL query result

Hi,

Where does $sth come from, other than C&P from the doc?

To quote the DBI doc: For SELECT statements, execute simply "starts" the query within the database engine. Use one of the fetch methods to retrieve the data after calling execute. The execute method does not return the number of rows that will be returned by the query (because most databases can't tell in advance), it simply returns a true value.

Hope this helps!


The way forward always starts with a minimal test.

Replies are listed 'Best First'.
Re^2: Perl Not returning SQL query result
by santoo (Initiate) on May 11, 2021 at 15:25 UTC
    I updated code plz check

      Again: Reading from a database

      (This time, read better: you have to run the fetch* function in a loop, and catch its result, in that example 'Reading from a database' the result values get caught into: $field1, $field2, $field3)

      If you update your post, Please use <strike>...</strike> tags or some other way to identify those changes.

      If the question changes mid-stream, the answers are confusing and out of context!