Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Perl Not returning SQL query result

by 1nickt (Canon)
on May 11, 2021 at 12:25 UTC ( [id://11132398]=note: print w/replies, xml ) Need Help??


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!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11132398]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-03-29 11:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found