kporter.porter Posted October 5, 2007 Share Posted October 5, 2007 If I am understanding what I have read here and in the Dummies book I bought, if I have any sort of output before the php, then it can cause a blank screen. I have this going on: The products page calls three other pages - the header page, the products display page, the footer page. The header prints on the screen, then the rest is blank. The products display page calls the member header page which has this code: <table cellspacing=0 cellpadding=3 border=0 width=70%> <tr><td align=center><h3>Welcome, <u><b><?= GetSessionVar("full_name") ?></b> </td> </tr> </table> Then goes back to the display page and has a flash, then php, then html, then php, then html, then php, then javascript. Is the blankness coming from the fact that I am outputting before the php? If so how would I better organize it. And the code IO show looks suspect to me. Thanks for any input, trying to clean up someone elses stuff. Quote Link to comment https://forums.phpfreaks.com/topic/72022-output-before-php/ Share on other sites More sharing options...
BlueSkyIS Posted October 5, 2007 Share Posted October 5, 2007 Is the blankness coming from the fact that I am outputting before the php? the blankness is probably because you have error_reporting turned off. if you can't change it in php.ini, set it at the top of your script: // Report all errors except E_NOTICE // This is the default value set in php.ini error_reporting(E_ALL ^ E_NOTICE); Quote Link to comment https://forums.phpfreaks.com/topic/72022-output-before-php/#findComment-362876 Share on other sites More sharing options...
kporter.porter Posted October 5, 2007 Author Share Posted October 5, 2007 Hi Blue, Yeah, I can't change my php.ini for that. I added that code to the top of the pages in question and still get nothing. I remarked out the call to the call to the member header and now it continues on until this part. <!-- toggle is defined in include/scripts.inc, global.php requires it --> <?php function dispMiscellaneous() { ?> <p><div onClick="toggle('one', event)"> <img src="../images/icon-open.png" name="one_toggle"> Miscellaneous </div> <div id="one" style="display:none;"> <div onClick="toggle('one_a', event)" style="margin-left: 12pt;"> <?php getProducts(create_query('Miscellaneous')); ?> </div> </div></p> <?php } This goes through until <?php getProducts(create_query('Miscellaneous')); ?> everything dies at this point. The create_query and getProducts function looks like this (it is at the end off the page). function create_query($category) { $query = "SELECT * FROM Product WHERE category='$category' ORDER BY description"; return $query; } function getProducts($query) { //print $query . '<br/>'; $db = new Sql(); $db->exec($query); if ($db->NumRows()) { $r=$db->Next(); while ($r) { print '<li class="formlist">' . $r['1'] . '</li>'."\n"; $r=$db->Next(); } } } Should I move these functions to the top? Quote Link to comment https://forums.phpfreaks.com/topic/72022-output-before-php/#findComment-362943 Share on other sites More sharing options...
MmmVomit Posted October 5, 2007 Share Posted October 5, 2007 Put this as the first line in your script and let us know what happens. <?php ini_set('error_reporting', PHP_INI_ALL); ?> Quote Link to comment https://forums.phpfreaks.com/topic/72022-output-before-php/#findComment-362958 Share on other sites More sharing options...
kporter.porter Posted October 8, 2007 Author Share Posted October 8, 2007 Nothing happened on the page in IE7. However, when debugged in my IDE it says - Notice = Use of undefined constant PHP_INI_ALL Thanks, Quote Link to comment https://forums.phpfreaks.com/topic/72022-output-before-php/#findComment-364712 Share on other sites More sharing options...
MmmVomit Posted October 8, 2007 Share Posted October 8, 2007 Sorry, that should have been this. <?php ini_set('error_reporting', E_ALL); ?> Quote Link to comment https://forums.phpfreaks.com/topic/72022-output-before-php/#findComment-364747 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.