Jump to content

Output Before PHP


kporter.porter

Recommended Posts

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.

 

 

 

 

 

 

Link to comment
Share on other sites

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);

Link to comment
Share on other sites

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?

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.