Ob_start() function does not work

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
alexre2003
Forum Newbie
Posts: 1
Joined: Tue Oct 07, 2003 9:38 am

Ob_start() function does not work

Post 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
Nay
Forum Regular
Posts: 951
Joined: Fri Jun 20, 2003 11:03 am
Location: Brisbane, Australia

Post 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
User avatar
mudkicker
Forum Contributor
Posts: 479
Joined: Wed Jul 09, 2003 6:11 pm
Location: Istanbul, TR
Contact:

Post by mudkicker »

ob_start(); should be at the top of the page.
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post 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.
User avatar
mudkicker
Forum Contributor
Posts: 479
Joined: Wed Jul 09, 2003 6:11 pm
Location: Istanbul, TR
Contact:

Post 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.
Post Reply