Jump to content

Only showing white pages...


dean7

Recommended Posts

Hi all, On my website i have things like a news page and forum etc, but when i try to view that page it just displays a white page.

 

But im not to sure why it does this...

This is a example of one of my codes that displays the white page:

 

<?php 
session_start();
include "style.css";
include_once"includes/config.php";
if(!isset($_SESSION['username']) || !isset($_SESSION['password'])){
header("Location: index.php");
}else{
$fetch_users_data = mysql_fetch_object(mysql_query("SELECT * FROM `users` WHERE username='".$_SESSION['username']."'"));
}

$username = $fetch_users_data->username;
?>
<center><table width="50%" height="" cellpadding="0" cellspacing="0" border="1px" bordercolor="#000000" bgcolor="#333333">
<tr>
<td>
Last News:
</td>
</tr>
<tr>
<td>
<?php
$getnews = mysql_query("SELECT * FROM news ORDER BY id DEC");
while ($news = mysql_fetch_object($getnews)){

echo "$news->news<p>";
echo " Added by: <a href='profile.php?veiwuser=$new->username'>$new->username</a> Date: $news->time";
echo "<br />";
}
?>
</td>
</tr>
</table>
<br />
<br />
<br />
<?php
if ($fetch->userlevel == "4"){
if (strip_tags($_POST['submit']) && (strip_tags($_POST['update'] != "0"))){
$newsupdate = strip_tags($_POST['update'];
$date = gmdate('Y-m-d h:i:s');
mysql_guery ("INSERT INTO `news` ( `id` , `username`, `date` , `update` ) VALUES ( '', '$username', '$date', '$update')");
echo "<table width='30%' height='' cellpadding='0' cellspacing='0' border='1px' bordercolor='#000000'>";
echo "<tr><td class='header'><b><center>News Added:</center></b></td></tr>";
echo "<tr><td>News Added! Please Refresh To Veiw Your Posted News.</td></tr></table>";
}
}
?>
<form name="form1" method="post" action="">
  <table width="25%" border="1px" align="center" cellpadding="0" cellspacing="0" bordercolor="#000000" bgcolor="#333333">
    <tr> 
      <td><table width="89%" border="0" cellspacing="3" cellpadding="0">
          <tr>
            <td height=29 bordercolor="#000000" border="1px" bgcolor="#333333"><center>Add News!</center></td>
          </tr>
          <tr> 
            <td bordercolor="#000000" bgcolor="#333333"> <center>
                <textarea name="update" cols="80" rows="5" bgcolor="black" id="update"></textarea>
              </center></td>
          </tr>
          <tr> 
            <td bordercolor="#000000" bgcolor="#333333"><center>
              <input name="submit" type="submit" id="submit" class="button" value="Add!">
            </center></td>
          </tr>
        </table></td>
    </tr>
  </table>
</form>

 

I dont think there is much if anything wrong with my code because i havent tryed it becuase it shows the white page.

 

Anyone got an idea why it does it?

 

Thanks

Link to comment
Share on other sites

Well very quickly on line 39 you have the following code which is missing an end bracket

 

$newsupdate = strip_tags($_POST['update'];

 

The above is what you have and the below is what you should have

 

$newsupdate = strip_tags($_POST['update']);

 

Now that would not cause it to only show a white page and there is nothing in that code which could cause a fatal error, what I'm thinking is that something in your config.php file is causing a fatal error and somewhere you probably have turned off show all errors.

 

Look for something like this below in your code

 

error_reporting(0);

 

and change it to

 

error_reporting(E_ALL);

 

This will then display an error on your page as well as all warnings. You may also have this featured turned off in your php.ini file, double check that file for the code below.

 

error_reporting = off

 

You can also try to turn your error reporting on by using the below code

 

ini_set("display_errors", 1);

 

This way if you have error reporting on and you still see a white blank page, we can rule out any hidden PHP errors and where they are coming from, if it does still display a blank page, try loading it up in a different browser and see what happens.

 

However if it does display an error after you turn reporting on then post the error here or look at the file (and the line in that file) which is causing the fatal error.

 

I hope that helps you out a bit.

 

Link to comment
Share on other sites

P.S. there are a couple other minor syntax errors in the script but I just noticed the following which is hard to see upon first look, just below that line I fixed for you you'll find this

 

mysql_guery

 

Notice anything about that spelling? It should be

 

mysql_query

 

That is what is most likely your major cause of your problems.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.