Monday, 15 March 2010

php - Remove unwanted lines while Content-Type: text/plain -



php - Remove unwanted lines while Content-Type: text/plain -

i describe problem code - best.

<? include('configs.php'); require_once 'dbqueries.php'; $con = mysql_connect( $db_host, $db_user, $db_pass ); mysql_query("set names 'cp1250'") or die('could not set names'); if (!$con) { die('could not connect: ' . mysql_error()); } mysql_select_db($db_dbname); $ounexportedorders = dbqueries::getinstance()->getunexportedorders(); header("content-type: text/plain"); while ($aorderexport = mysql_fetch_assoc ($ounexportedorders)){ echo $aorderexport['data']; }

what happening:

include stuff connection db get info db important: set header content-type: text/plain important: print text info echo

result:

**!!! there 7 unwanted lines !!!** line of info line of info line of info line of info ....

expected result:

line of info line of info line of info line of info

- expected lines of info generated echo within for, without 7 lines.

question:

how that, phone call when (etc.) rid of unwanted lines?

thank you.

ob_clean(); clear out output buffer, in conjuction ob_start();

<? ob_start(); include('configs.php'); require_once 'dbqueries.php'; $con = mysql_connect( $db_host, $db_user, $db_pass ); mysql_query("set names 'cp1250'") or die('could not set names'); if (!$con) { die('could not connect: ' . mysql_error()); } mysql_select_db($db_dbname); $ounexportedorders = dbqueries::getinstance()->getunexportedorders(); ob_clean(); header("content-type: text/plain"); while ($aorderexport = mysql_fetch_assoc ($ounexportedorders)){ echo $aorderexport['data']; }

that should rid of unwanted whitespace included files.

php text content-type removing-whitespace

No comments:

Post a Comment