You are here: Re: Output stops after while loop « PHP Programming Language « IT news, forums, messages
Re: Output stops after while loop

Posted by dawnerd on 07/30/06 17:50

Shelly wrote:
> "dawnerd" <dawnerd@gmail.com> wrote in message
> news:1154246620.954322.199410@m79g2000cwm.googlegroups.com...
> > Here is the page in it's completeness. I removed the logging and other
> > stuff to see if it was the cause, and it wasn't. Also, the logging
> > script is not open source, well, yet.
> >
> > <?php
> > if( !OJAICMS )
> > {
> > die("No");
> > }
> >
> > require_once( "functions/newpage.function.php" );
> >
> > /**
> > * update the page?
> > */
> > if( $_GET["action"] == "update" )
> > {
> > ///
> > /// Planned
> > ///
> > }
> >
> > /**
> > * Delete the page?
> > */
> > if( $_GET["action"] == "delete" )
> > {
> > ///
> > /// Planned
> > ///
> > }
> > /**
> > * Show the correct breadcrumb and perform some other hacking checks
> > */
> > if( $_GET["do"] == "edit" )
> > {
> > $bc = "&raquo; Editing Page";
> > $do = "edit";
> >
> > /**
> > * Check if the id was passed
> > */
> > if( $_GET["id"] == "" )
> > {
> > $error .= "<li>What post do you expect to edit?</li>";
> > $do = "list";
> > }
> > else
> > {
> > $id = mysql_real_escape_string( htmlspecialchars( trim( $_GET["id"] )
> > ) );
> > $sql = "SELECT * FROM `pages` WHERE `id` = '$id'";
> > $query = $db->query( $sql );
> > $num = $db->numrows( $query );
> >
> > /**
> > * Check if the page exists
> > */
> > if( $num != 1 )
> > {
> > $error .= "<li>Page does not exist witht that identification
> > number</li>";
> > $do = "list";
> > }
> > else
> > {
> > $row = $db->fetcharray( $query );
> > }
> > }
> > }
> > else if( $_GET["do"] == "delete" )
> > {
> > $bc = "&raquo; Deleting Page";
> > $do = "delete";
> >
> > /**
> > * Check if the id was passed
> > */
> > if( $_GET["id"] == "" )
> > {
> > $error .= "<li>What post do you expect to edit?</li>";
> > $do = "list";
> > }
> > else
> > {
> > $id = mysql_real_escape_string( htmlspecialchars( trim( $_GET["id"] )
> > ) );
> > $sql = "SELECT * FROM `pages` WHERE `id` = '$id'";
> > $query = $db->query( $sql );
> > $num = $db->numrows( $query );
> >
> > /**
> > * Check if the page exists
> > */
> > if( $num != 1 )
> > {
> > $error .= "<li>Page does not exist witht that identification
> > number</li>";
> > $do = "list";
> > }
> > else
> > {
> > $row = $db->fetcharray( $query );
> > }
> > }
> > }
> > else
> > {
> > $do = "list";
> >
> > /**
> > * Go ahead and do some sql to grab all pages
> > */
> > $sql = "SELECT * FROM `pages`";
> > $query = $db->query( $sql );
> > $num = $db->numrows( $query );
> > }
> > ?>
> > <p><a href="index3.php?page=main">Home</a> &raquo; <a
> > href="index3.php?page=pagemanager">Page Manager</a> <?php echo $bc;
> > ?></p>
> > <div id="newpage">
> > <h2>Page Manager</h2>
> > <?php
> > if( $error != "" )
> > {
> > /**
> > * Show the errors if there are any
> > */
> > ?>
> > <div id="error">
> > <img src="images/emblem-important.png" alt=" " width="32" height="32"
> > />
> > <h2>There were errors: </h2>
> > <ul><?php echo $error;?></ul>
> > </div>
> > <?php
> > }
> > if( $perfect != "" )
> > {
> > /**
> > * Show the success mesasages if any
> > */
> > ?>
> > <div id="perfect">
> > <img src="images/emblem-notice.png" alt=" " width="32" height="32" />
> > <ul><?php echo $perfect;?></ul>
> > </div>
> > <?php
> > }
> >
> > /**
> > * Show the editing page
> > */
> > if( $do == "edit" )
> > {
> >
> > }
> >
> > /**
> > * Show the delete confirmation
> > */
> > else if( $do == "delete" )
> > {
> >
> > }
> >
> > /**
> > * Else, show the list of pages
> > */
> > else
> > {
> > /**
> > * Check if the page exists
> > */
> > if( $num <= 0 )
> > {
> > ?>
> > <p>There are no pages to display here.<br />
> > To add pages, go to back and click on "Create Page".</p>
> > <?php
> > }
> > else
> > {
> > ?>
> > <table id="page_table" border="0" cellspacing="0" cellpadding="5">
> > <tr>
> > <td>&nbsp;</td>
> > <td>&nbsp;</td>
> > <th>Id</th>
> > <th>Title</th>
> > <th>Slug</th>
> > <th>Type</th>
> > </tr>
> > <?php
> > /**
> > * Loop through the resultset
> > */
> > $int = 0;
> > while( $row = $db->fetcharray( $query ) )
> > {
> > if( $int == 0 )
> > {
> > $class = "page_table1";
> > $int++;
> > }
> > else
> > {
> > $class = "page_table2";
> > $int = 0;
> > }
> >
> > if( $row["type"] == "error" )
> > {
> > $img = "emblem-important-small.png";
> > }
> > else
> > {
> > $img = "text-x-generic.png";
> > }
> > ?>
> > <tr class="<?php echo $class; ?>">
> > <td><a
> > href="index3.php?page=pagemanager&amp;do=edit&amp;id=<?php echo
> > $row["id"]; ?>">
> > <img src="images/emblem-unreadable.png" width="16" height="16"
> > border="0" /></a></td>
> > <td><a
> > href="index3.php?page=pagemanager&amp;do=edit&amp;id=<?php echo
> > $row["id"]; ?>">
> > <img src="images/accessories-text-editor.png" alt="Edit" width="16"
> > height="16" /></a></td>
> > <td><?php echo $row["id"]; ?></td>
> > <td><?php echo $row["title"]; ?></td>
> > <td><?php echo $row["slug"]; ?></td>
> > <td><img src="images/<?php echo $img; ?>" title="<?php echo
> > $row["type"]; ?>" style="float:left;" />&nbsp;
> > <?php echo $row["type"]; ?></td>
> > </tr>
> >
> > <?php
> > }
> > ?>
> > </table>
> > <?php
> > }
> > }
> >
> > /**
> > * Do some logging.
> > * Note: This was removed as for testing
> > */
> > ?>
> > </div>
> >
>
>
> Where is the <html></html>, <body></body> etc.? I couldn't find it in this
> code. You said that this was the complete code. Also, how do you know it
> stops after the while loop?
>
> Shelly

The page I posted is included into a template.

And here is that template file.
-------------------------
<?php
/**
* OjaiCMS Copyright 2006 Troy Whiteley <troy.whiteley@gmail.com>
* Code is licensed under the BSD License.
* Please see license.txt in the root folder for license.
*
* File: index3.php
* System File: Yes
* Creation Date: July 18, 2006
*
* Details: This is the administration template.
*/

/**
* Start the session
*/
session_start();

/**
* Start output buffering
*/
ob_start();

/**
* Load up the config file
*/
require_once("../core/config/main.config.php");

require_once("functions/user.function.php");

/**
* Check if the user is logged in
*/
if( !checkuser( $db ) )
{
header("Location: index.php");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
/>
<title>Administration</title>
<style type="text/css">
<!--
@import url("global.css");
@import url("style.css");
-->
</style>

<script language="javascript" type="text/javascript"
src="js/yahoo/yahoo-min.js"></script>
<script language="javascript" type="text/javascript"
src="js/dom/dom-min.js"></script>
<script language="javascript" type="text/javascript"
src="js/event/event-min.js"></script>
<script language="javascript" type="text/javascript"
src="js/animation/animation-min.js"></script>
<script language="javascript" type="text/javascript"
src="js/jquery.js"></script>
<script language="javascript" type="text/javascript"
src="js/thickbox.js"></script>
<script language="javascript" type="text/javascript"
src="js/tiny_mce/tiny_mce_gzip.php"></script>
<script language="javascript" type="text/javascript"
src="js/tiny_mce/tiny_mce_config.js"></script>
<script language="javascript" type="text/javascript"
src="js/animation.js"></script>
</head>

<body onload="fadein('error',0,1); fadein('perfect',0,1);">
<div id="container2">
<div id="header"></div>
<div id="content">
<span id="head">Administration</span>
<p id="welcomeuser">welcome <?php echo htmlspecialchars(
$_COOKIE["user"] );?> (<a
href="index.php?action=logout">logout</a>)</p>
<?php
//check if page in url exists
if( file_exists("pages/" . $_GET["page"] . ".php") )
{
include("pages/" . $_GET["page"] . ".php");
}
else
{
include("pages/main.php");
}
?>
</div>
</div>
<div id="footer"></div>
</body>
</html>
<?php
/**
* End output buffering
*/
ob_end_flush();
?>

---------

I will have the demo up in a bit, and have to fix my cluster. It has
decided to not work at all, but thats nothing to do with the problem at
hand.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация