SitePoint Sponsor

User Tag List

Results 1 to 15 of 15
  1. #1
    SitePoint Member
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Huge HTML/PHP/MySQL problem!

    I'm having a huge problem with my site. This problem does not make any logical sense, programming wise. The explaination is as follows. I have a site that loads an article from a database, the page is put together by some basic html and a few includes. Generally, everything loads fine but for some odd articles, the page stops loading after getting approx. halfway through the database loaded content and so all the following closing html and what not, is missing from the source and the page.

    A link to a working page is here:
    http://presenttruth.dyndns.org/_othe...ubject=baptism

    A link to a non-working page is here:
    http://presenttruth.dyndns.org/_othe...ject=whatpagan

    Please view the source to see what I'm talking about. If anyone wants a copy of the page and includes, just ask. Also, when I remove one of my includes, doesn't matter which one, the page starts to work properly. I've gone through these includes and there's nothing wrong with any of them from what I can see.

  2. #2
    Ensure you finish what you sta bronze trophy John Colby's Avatar
    Join Date
    Aug 2003
    Location
    University of Central England, U.K.
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Would you like to validate your code at http://www.htmlhelp.com because I'm getting a large number of errors when I do so one the generated pages, both the 'working' and the 'non-working'.

    First observation is that you have an HTNL 4.0 DOCTYPE but the document is loaded with XHTML constructs, which is causing grief.
    John
    No electrons were harmed during the creation, transmission
    or reading of this posting. However, many were excited and
    some may have enjoyed the experience.

  3. #3
    SitePoint Member
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by John Colby
    Would you like to validate your code at http://www.htmlhelp.com because I'm getting a large number of errors when I do so one the generated pages, both the 'working' and the 'non-working'.

    First observation is that you have an HTNL 4.0 DOCTYPE but the document is loaded with XHTML constructs, which is causing grief.
    Thank you for bringing this xhtml doctype declaration to my attention, however, this is clearly not the problem. The problem is either in the PHP or the server. HTML no matter how bad it's put together, will always display. If tags are broken, incomplete, no matter, it will still load. This problem is causing the page not to load which is obviously not an HTML matter.

  4. #4
    gingham dress, army boots... silver trophy redux's Avatar
    Join Date
    Apr 2002
    Location
    Salford / Manchester / UK
    Posts
    4,838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    have you got a really low timeout set for PHP, perhaps ?
    without seeing your page generation code, there's not much we can do, i think...
    re·dux (adj.): brought back; returned. used postpositively
    [latin : re-, re- + dux, leader; see duke.]
    WaSP Accessibility Task Force Member
    splintered.co.uk | photographia.co.uk | redux.deviantart.com

  5. #5
    SitePoint Enthusiast Gamblingharry's Avatar
    Join Date
    Apr 2003
    Location
    UK
    Posts
    83
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You might find it has something to do with quotation marks in the article in the database. I had this problem, and sorted it by removing the quotation marks - which is the wrong method!

    I will sort it properly sometime using the php functions used to sort out quotation marks for storage in a database.

  6. #6
    SitePoint Member
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Gamblingharry
    You might find it has something to do with quotation marks in the article in the database. I had this problem, and sorted it by removing the quotation marks - which is the wrong method!

    I will sort it properly sometime using the php functions used to sort out quotation marks for storage in a database.
    Are you talking about addslashes() and stripslashes()?

    If you are, this isn't what the problem is. All the information in the database is fine, and when slashes are added, it makes no difference. Good thought though. This problem doesn't make any logical programming sense. Sometimes it displays correctly, other times, it doesn't.

  7. #7
    SitePoint Member
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My loading timeout isn't low at all, I actually upped it in order to load some huge information I have on another page of my site. If you were willing to check it out, I'd be more than glad to put a link to a zipped file containing the files in use?

  8. #8
    SitePoint Wizard
    Join Date
    Oct 2001
    Location
    Tucson, Arizona
    Posts
    1,858
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can you just post the source of topics.php?

  9. #9
    SitePoint Member
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've copied the topics and main_topic include onto here, if there's another include you wish to see the source for, lemme know.

    TOPICS.PHP

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
    
    <?php
    	
    	include('includes/main_cookie.php');
    	include('includes/main_dbcnx.php');
    
    	/***************************
    	* Display Subject in Title *
    	***************************/
    
    	if(isset($subject)) {
        
      		$title_sql = @mysql_query("SELECT title FROM ptv3_topics WHERE Keyword='$subject'");    
      
      		if (!$title_sql) {      
       			echo("<span class='regtext'>Error performing query: " . mysql_error() . "</span>");          
      	        }
    
    		while ( $title_row = mysql_fetch_array($title_sql) ) {      
       				$title = $title_row["title"];
    		}
    	}
    
    ?>
    
    <html>
    <head>
    	<title>Present Truth &middot; 
    <?php
    	if(!$subject) {
    		echo("Topics");
    	} else {
    		echo("Topics &middot; " . $title);
    	}
    ?>
    </title>
    
    <link rel="stylesheet" type="text/css" href="<?=$pagestyle?>_style.css" />
    
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
    <meta name="keywords" content="Present Truth..." />
    <meta name="description" content="Present Truth..." />
    <meta name="robots" content="index,follow" />
    <meta name="revisit-after" content="7 Days" />
    <meta name="distribution" content="global" />
    <meta name="author" content="Joshua Rivard" />
    
    </head>
    <body>
    
    <?php 
    
    /**********************************
    *          Load Includes          *
    **********************************/
    
    include('includes/main_header.php');
    include('includes/main_menu.php');
    
    ?>
    
    <table align="center" cellpadding="0" cellspacing="0" class="noborder">
    
    <tr height="4">
    <td background="images/cleardot.gif"></td>
    </tr>
    
    </table>
    
    <table align="center" width="750" height="100%" cellpadding="0" cellspacing="0" class="noborder">
    
    <tr valign="top">
    <td class="noborder">
    
    	<?php /*---------------
    	| TOPIC PAGE INCLUDES |
    	---------------------*/ 
    
    	if(!isset($subject)) {
    		include('includes/main_topic_list.php');
    	} else {	
    		include('includes/main_topic.php');
    	}
    	
    	?>
    </td>
    <td class="noborder" align="center" width="150">
    
    	<?php /*---------------------
    	| RIGHT MISC HEADER INCLUDE |
    	---------------------------*/ 	
    
    	include('includes/main_misc_header.php');
    
    	?>
    
    	<table width="150" cellspacing="2" cellpadding="5" class="regtable">
    
    	<tr>
    	<td align="left" class="antable">
    
    	<?php if(isset($subject)) { ?>
    
    		<span class="smtextblk">Date Posted:</span><br /><span class="smtext"><?=$date?></span><br />
    		<span class="smtextblk">Posted By:</span><br /><span class="smtext"><?=$author?></span><br />
    		<span class="smtextblk">File Type:</span><br /><span class="smtext">.doc</span><br />
    		<span class="smtextblk">File Size:</span><br /><span class="smtext">
    		<?php
    			if(file_exists($file)) {
    
    				echo(filesize($file) . ' bytes');
    
    			} else {	
    		
    				echo("N/A");
    		
    			}			
    		?>
    		</span><br /><br />
    		<a href="studies/<?=$title?>.doc" class="smtext">download</a> <b>&middot;</b> <a href="forum/posting.php?mode=newtopic&f=6" class="smtext">comment</a><br />
    		
    	<?php } else { ?>
    	
    		<p class="smtextblk">Topics: <span class="smtext"><?=$TopicCount?></span></p>
    		<p class="smtextblk">Please select the topic that you wish to view by clicking the link to it.</p>
    		<p class="smtextblk">If you are experiencing difficulties either viewing, or downloading a study, click <a href="help_topics.php" class="smtext">here</a>.</p>
    	
    	<?php } ?>
    
    	</td>
    	</tr>
    
    	</table>
    
    </td>
    </tr>
    
    </table>
    
    <?php 
    
    /****************************************
    *          Load Footer Inlcude          *
    ****************************************/
    
    include('includes/main_footer.php');
    
    ?>
    
    </body>
    </html>
    MAIN_TOPIC.PHP

    Code:
    <? /*-----------------------------
    | MAIN TOPICS w/ SUBJECT INCLUDE |
    --------------------------------*/ 
    	
    	$sql= @mysql_query("SELECT author, article, date FROM ptv3_topics WHERE Keyword='$subject'");
    
    		if(!sql) {
    			echo("<span class='regtext'>Error performing query: " . mysql_error() . "</span>");
    		}
    		
    		while($row = mysql_fetch_array($sql)) {
    			$author = $row["author"];
    			$article = $row["article"];
    			$date = $row["date"];
    		
    			if($date==""){
    				$date="Unknown";
    			}
    		}
    	$file = "studies/$title.doc";
    	
    ?>
    
    	<table width="99.2%" cellspacing="0" cellpadding="10" class="regtable">
    
    	<tr height="5">
    	<td background="images/<?=$pagestyle?>_yellowcorner.gif" style="background-repeat: no-repeat" colspan="2"></td>
    	</tr>
    
    	<tr>
    	<td>
    	<span class="smtextblk"><a href="index.php" class="smtext">Home Page</a> <b>&middot;</b> <a href="topics.php" class="smtext">Topics</a> <b>&middot;</b> <?=$title?></span><br /><br />
    	<div align="center"><span class="tltext"><?=$title?></span><br />
    	<img src="images/default_yellowbarsm.gif" width="250" height="3" /></div><br />
    	<span class="regtext">
    
    	<?=$article?>
    
    	</span>
    	</td>
    	</tr>
    
    	<tr>
    	<td><div align="center"><a href="#" class="smtext">Back to Top</a></div></td>
    	</tr>
    
    	</table>
    Last edited by JoFrRi; Dec 8, 2003 at 12:10.

  10. #10
    SitePoint Member
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'd also like to mention that this only happens in IE.

  11. #11
    SitePoint Wizard
    Join Date
    Oct 2001
    Location
    Tucson, Arizona
    Posts
    1,858
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If it only happens in a certain browser, the problem is obviously not server-side. I'm wondering if your host recently upgraded PHP or something and perhaps shut off register_globals.
    PHP Code:
    <?php phpinfo() ?>

  12. #12
    SitePoint Member
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://presenttruth.dyndns.org/phpinfo.php

    ...if you'd like to see. I actually host my own site on a personal webserver (apache) and I haven't updated anything recently.

  13. #13
    SitePoint Enthusiast Deo's Avatar
    Join Date
    Oct 2003
    Location
    Washington, USA
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just a dumb question but....

    PHP Code:
    <?php
    ....
        while ( 
    $title_row mysql_fetch_array($title_sql) ) {      
                   
    $title $title_row["title"];
        }
    ...
    ?>
    why are you grabbing your websites' title from the db via a while loop? do you have multiple titles per page?

    Try:

    PHP Code:
    <?php
    ...
         list(
    $title) = mysql_fetch_array($title_sql);
    ...
    ?>
    Mark
    www.MySpaceWatcher.com
    Tracking & Statistics For MySpace.com Users

  14. #14
    SitePoint Member
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for bringing that to my attention, there truly isn't a need for a while statement. It has been removed and is still working wonderfully.

    Code:
    if(isset($subject)) {
        
      		$title_sql = @mysql_query("SELECT title FROM ptv3_topics WHERE Keyword='$subject'");    
      
      		if (!$title_sql) {      
       			echo("<span class='regtext'>Error performing query: " . mysql_error() . "</span>");          
      	        }
    
    		$title_row = mysql_fetch_array($title_sql);
          
       		$title = $title_row["title"];
    		
    	}
    Last edited by JoFrRi; Dec 8, 2003 at 12:09.

  15. #15
    SitePoint Member
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just a quick comment that might give a little more light on the problem.

    When I was at a friends place, I viewed the page from there computer and something strange was happening... When they would try to load the page, it would start, and then all of a sudden they would get forwarded to a cannot find server page.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •