DEBUGGING - Jan 5th, 2014


Dave Edis from Interactive Tools expert advice saved the day once again. He said:
Anytime a MySQL query isn't working the first thing to do is back up and print out the variables you're passing to it
(or the query itself).

Try this debug code: (change the section and field names to your own)



print "<xmp>Product Record: ";
print_r($productsRecord);
print "</xmp>";



or



print "<xmp>my_field: ";
print_r($productsRecord)['my_field'];
print "</xmp>";



Another trick is to add this option which displays the SQL being executed:



'debugSql' => true,



If you’re getting an "undefined index' error, that means that field could not be found in the record. You can try
displaying all the fields in the record with this code to see what fields are available (or where the missing ones are):



<xmp><?PHP print_r($record); ?></xmp>



To this list, Jason Shautuck added:



<?php showme($record['recipe']);exit; ?>

Or if you're looking for th value of a variable,

<?php showme($your_variable);exit; ?>


He said: This will just output the content of that variable and then stop execution.



The materials on this web site have been created for use with CMS Builder content management software. CMS Builder software is published and licensed for use by InteractiveTools.com. Please contact Interactive Tools for information on the downloading of the software or the purchasing of licenses.


Terms of Service