Page 1 of 1

Ob_start() function does not work

Posted: Tue Oct 07, 2003 9:38 am
by alexre2003
Hi,

I am retrieving the following string from the database field CatDescriptionEng and trying to evaluate it as PHP code

<?include("/home/virtual/wibcs.com/var/www
/cgi-bin/php_files/show_job_offer.php");?>

but it is not working i.e. I see nothing on my WEB page

<?
if (!isset($db)){
$db=connectDb();
}
$qryCatDescr="SELECT noCatPar, CatNameEng, CatDescriptionEng FROM Categories1 WHERE NoCat=39";
$resQryCatDescr = mysql_query ($qryCatDescr, $db);
/* annulation of warning 1-st time login in site..*/
$nbRowsResult=@mysql_num_rows($resQryCatDescr);
if ($nbRowsResult > 0)
$catDescr = $myrowResQryCatDescr[2];
ob_start();
eval('?>'. $catDescr);
$catDescr = ob_get_contents();
ob_end_clean();
}
}
?>

Any help will be much appreciated.
'Thnk you in advance.
Alex

alexander_reichman@hotmail.com

Posted: Tue Oct 07, 2003 9:41 am
by Nay
home/virtual/wibcs.com/var/www/cgi-bin/php_files/show_job_offer.php

PHP files won't work in the CGI-BIN, you'll have to put the PHP files in the public-html folder.

Or make a PHP-BIN folder for you PHP files, but that should be in the public-html folder anyhow.

-Nay

Posted: Tue Oct 07, 2003 2:10 pm
by mudkicker
ob_start(); should be at the top of the page.

Posted: Tue Oct 07, 2003 6:25 pm
by McGruff
mudkicker wrote:ob_start(); should be at the top of the page.
Nope - can go anywhere.

Is this declared: $myrowResQryCatDescr[2]?

You dumped the buffer contents into $catDescr: do you echo it out anywhere?

PS: properly indented code & syntax highlighting is much easier to read.

Posted: Wed Oct 08, 2003 2:06 am
by mudkicker
McGruff wrote:
mudkicker wrote:ob_start(); should be at the top of the page.

really? why? i always knew that it that way...
people learn always never stop learnin huh? ;)
thanks mcgruff.