Forum Moderators: coopster

Message Too Old, No Replies

php / css problem

         

Scally_Ally

3:10 pm on May 30, 2006 (gmt 0)

10+ Year Member



Hi All,
I have a bit of a problem with a site that i have made.
The site is made almost exclusively with css (no tables involved at all).. everything that has been made and validated and all the pages are php - everything is working great. Problem is when i come to place php tags on the pages that pull information/text from the database the page completely messes up - by messing up i mean that nothing is displayed at all, just a complete blank page.. its very wierd.

What makes it even wierder is that the pages are already executing php to do the browser validation and to pull in different style sheets.

I have tried playing about with different doc types etc but all to no avail.. I was wondering if anyone has had the same problem or any ideas why it may be going wrong..

Cheers

barns101

3:36 pm on May 30, 2006 (gmt 0)

10+ Year Member



No idea what this could be. Post the code that "breaks" the page and we'll take a look.

jatar_k

4:27 pm on May 30, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



it sounds like there is an unhandled error somewhere

do you have errors set to show in your browser? you could try adding this to the top of that script

error_reporting(E_ALL);

that will show every error

Scally_Ally

4:56 pm on May 30, 2006 (gmt 0)

10+ Year Member



thanks guys,
I have tried putting error_reporting(E_ALL); at the top of the page but no errors are shown. i know my code works fines because i have tried it on a page that isnt laying everything out using css.

I cant understand it, it is just a completely blank page. Below is the code that i am using, the variables that have been pulled from the database at the top of the page.

<?php include_once("php/top_menu.inc.php");?>
<div id="content">
<div id="main">
<span class="top"></span>
<img src="images/competition_title1.gif" width="210" height="22" class="headingGc" alt="competition">
<p><?=$body_text;?><img src="images/comp_page/<?=$image;?>" border="0"></p>
<span class="bottom"></span> </div>

<div id="compPanel" class="panel">
<span class="top"></span>
<div class="text">
<a href="draw.php"><img src="images/enter_title2.gif" alt="enter the competition" width="150" height="20" border="0" class="headingGC"></a>
<p><a href="draw.php">design your own dot 2 dot </a></p>
</div>
<a href="draw.php"><img src="images/competition_gc.gif" alt="dot 2 dot competition icon" width="95" height="106" border="0" class="image"></a>
<span class="bottom"></span>
</div>

<div id="viewGallery">
<span class="top"></span>
<div class="text">
<a href="gallery.php"><img src="images/browse_title2.gif" alt="browse the gallery" width="150" height="20" border="0" class="headingGC"></a>
<p><a href="gallery.php">see the entries so far </a></p>
</div>

<span class="bottom"></span>
</div>

</div>
<?php include_once("php/footer.inc.php");?>

thanks.

jatar_k

4:59 pm on May 30, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



and when you view source what do you see?

Scally_Ally

5:00 pm on May 30, 2006 (gmt 0)

10+ Year Member



absolutely nothing.. its all blank..

whoisgregg

5:01 pm on May 30, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Setting error_reporting is only one part, you also need to have display_errors on. Add this to the top of the page:

ini_set("display_errors", "On");

Scally_Ally

5:25 pm on May 30, 2006 (gmt 0)

10+ Year Member



i have just tried this but had no luck with it.

It is almost asif the page cannot parse the php, but i have php includes on the page which work so it must be able to..

I have narrowed down where the problem is to the code below (that pulls the info from the database) but there is nothing wrong with that code. Very strange..

<?
//ini_set("display_errors", "On");
//error_reporting(E_ALL);
require("scripts/db_connect.php");
$query = "SELECT * FROM comp_page ORDER BY ID DESC LIMIT 1";
$result = mysql_query($query) or die('Error, insert query failed');
while($row = mysql_fetch_assoc($result)) {
$body_text = $row["body_text"};
$image = $row["image"};
}
?>

jatar_k

5:28 pm on May 30, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



have you tried the query at the command line or in phpmyadmin to see if it is returning what you think?

dreamcatcher

6:08 pm on May 30, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think this is your problem:

$body_text = $row["body_text"};
$image = $row["image"};

Try changing the braces:

$body_text = $row["body_text"];
$image = $row["image"];

dc

eelixduppy

6:20 pm on May 30, 2006 (gmt 0)



good catch dreamcatcher :) I wonder why it didn't show the errors...

henry0

6:45 pm on May 30, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Of course good catch!
I had a similar problem with a PHP site fully CSS driven
CSS has a life of its own; and the included content was somehow interfering with CSS, don’t remember how and why but that was my problem

coopster

9:11 pm on May 30, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member




I wonder why it didn't show the errors...

Although display_errors [php.net] may be set at runtime (with ini_set()), it won't have any affect if the script has fatal errors. This is because the desired runtime action does not get executed.

You can always check the log though (see error_log [php.net] and log_errors [php.net]).

Scally_Ally

8:11 am on May 31, 2006 (gmt 0)

10+ Year Member



thanks dreamcatcher... that worked a treat.

I cant believe that i didnt pick up on that type error before hand, sorry for wastin peoples time..

Thanks for all the help.

Ally

dreamcatcher

10:02 am on May 31, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ally,

You`re not wasting our time, we`ve all been there ourselves. Sometimes two pairs of eyes are better than one.

dc