Fork me on GitHub

Debugging SQL  Bottom

  • I'd like to be able to debug my code (particularly my SQL as it's not my strongest point).

    I found in the config.php file the following lines and changed the 0's to 1s
    $pndebug['debug'] = 1;
    $pndebug['debug_sql'] = 1;
    $pndebug['pagerendertime'] = 1;

    I now get the debug window, but it's not helping me much. All I get is:

    Quote


    30.09.2005 15:48:50
    http://localhost/magog/index.php?module=Magoggen&func=display_group&group_id=2

    double: Page created in (seconds) = 0.6400580406189

    30.09.2005 15:48:59
    http://localhost/magog/index.php?module=Magoggen&type=userapi&func=update_group

    double: Page created in (seconds) = 0.5755250453949

    Do I need to add something to my code to make it display my debugging info (for example the SQL statement I just fed the server)?


    Thanks in advance!
  • You're better off echoing the SQL statement directly from your module, in my opinion.

    I never got the debug settings to work well enough for my liking, so I used ADOdb's debugging. Check the ADOdb site for information on how to turn it on. I think I put the statement in the pnInit(); function in pnAPI.php on my test site. That will show you every single query made to the database in the header of your site.

    --
    itbegins.co.uk - Zikula Consulting

    birtwistle.me.uk - Personal Blog


    Please read the Support Guide
  • im having the same poor results as gaiatree, but it does appear that the popup just hangs and still tries to load something. I never get any results other than what he stated. I also tried using the pnrender debug tag, but that just gave me some other error. Im trying all of this with .761. I have had both working before with earlier versions of PN, but i have also had troubles as well. Hmm.

    Havent figured out what to add to pnAPI.php file though as hammerhead suggested. Care to share the code?

    Thanks,
    Mark
  • right after u compose the SQL

    print_r($SQL);
    die;
  • but im just trying to debug problems with premade scripts

    Stupid pndebug should be working :x
  • You could try to use a SQL-executing function like this one (which comes from the 0.8 DBUtil class):

    Code

    function &executeSQL ($sql, $exitOnError=true, $verbose=true)
            {
                if (!$sql)
                  v4b_exit ("No SQL statement to execute in DBUtil::executeSQL()");

                $dbconn =& pnDBGetConn(true);
                if (!$result =& $dbconn->Execute($sql))
                {
                    if ($verbose)
                    {
                      print "<BR>";
                      print $dbconn->ErrorMsg();
                      print "<BR>";
                      print "$sql";
                      print "<BR>";
                    }
                    if ($exitOnError)
                        exit('Exiting after SQL-error');

                    return false;
               }

               return $result;
            }


    In it's default state and form it will scream and exit when it encounters an error ... it'll show you the failed SQL statement and the error it received ...

    Greetings
    --> R
  • so basically pndebug doesnt work and there isnt any options for doing debugging SQL or PHP without modifying the files?

This list is based on users active over the last 60 minutes.