Forum Moderators: coopster

Message Too Old, No Replies

O O P slight problem

Entering the OO world - Hitting a "small" snag

         

henry0

8:29 pm on Apr 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I am in the process of adding OO programing knowledge
and to update my own CMS and template system
in order to become OO oriented.
it follows the classical route:
Class -- class instance..

for a trial I made a simple DB table 1 row one col
my index position all page segments fine but one
that is pulled from the DB
instead of placing the small test text it show a " 1 "
(query result) where the text should be and palce the text out of page table to its very top left corner
here is what I use
<<<
from the index:
$content .= include "includes/main_content.inc.php";
$page->SetParameter("PAGE_CONTENT", $content);

from the main template"
<td width="610" valign="top"><br></br><!--{PAGE_CONTENT}--></td>

the whole main content .inc main_content.inc.php

<?
$conn = db_connect();
$sql= "select main_content from test";
//where id=$id";
$result = mysql_query($sql,$conn);
while ($new_content=mysql_fetch_array($result) ){
print $new_content[main_content];
}
?>
>>> Any input? obviously there is a query problem but I cannot zero on it
thanks

Henry

MrCrowley

8:37 pm on Apr 23, 2004 (gmt 0)

10+ Year Member



include returns true (1) if it succeeds. So basically what your $content is is the result of the include function, not the result of what is in the include.

you should do:
$content = '';
include "includes/main_content.inc.php";
$page->SetParameter("PAGE_CONTENT", $content);

and this is your include:
<?
$conn = db_connect();
$sql= "select main_content from test";
//where id=$id";
$result = mysql_query($sql,$conn);
while ($new_content=mysql_fetch_array($result) ){
$content .= $new_content[main_content];
}

henry0

8:43 pm on Apr 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I got it thank you so much

henry