Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^5: DBI SQL Returns Less than Direct SQL

by Corion (Patriarch)
on Oct 18, 2011 at 10:14 UTC ( [id://932106]=note: print w/replies, xml ) Need Help??


in reply to Re^4: DBI SQL Returns Less than Direct SQL
in thread SOLVED: DBI SQL Returns Less than Direct SQL

I would now run the SQL statement that phpMyAdmin produces with the Perl code.

I would also run the select count(*) from ... where ... statement, to see what the database thinks how many rows there would be.

Replies are listed 'Best First'.
Re^6: DBI SQL Returns Less than Direct SQL
by DaveNagy (Initiate) on Oct 18, 2011 at 13:21 UTC

    I crafted the SQL in PHPAdmin to get what I wanted from the table, tuning it until I was happy with the results. Then I ported it to PERL but simply copying it to the source and plugging in the variable to let me specify the search words when the program ran.

    By this technique, I could see what results I expected when the PERL program ran. I will try the COUNT(*) and see what MySQL says.

    Dave
Re^6: DBI SQL Returns Less than Direct SQL
by DaveNagy (Initiate) on Oct 18, 2011 at 13:31 UTC

    I ran the COUNT(*) SQL in PHPAdmin and it returned a value of 6 indicating as expected that there were 6 rows that matched the criteria specified in the SQL. When run from PERL, it is returning 1.

    Dave

      Then I would really, really make sure that the two programs are connecting to the same database indeed. Consider using the mysql command line program to cross-check the results.

      If MySQL tells Perl that there is only one row, and Perl only returns one row, the two are consistent. If MySQL tells Perl one thing and PHP another thing, I highly doubt that the two are talking to the same database instance.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-04-25 13:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found