Jump to content

Code not showing output


mdmartiny

Recommended Posts

This is the code that I am using to make a page that is kind of like an administration area for a CMS system. When the page is loading all I get is a blank page.

 

When I remove all of the back code before the HTML code is sent. The page shows up fine. I have looked over and over the code trying to see if I missed a colon or something and I see nothing.

 

I hope that this explains everything well enough and I would appreciate any help.

 

<?php
$today = date("l, F j, Y");

$host ='';
$username = '';
$dbname ='';
$dbpassword = '';
$table = '';
$table2 = '';

$connection = mysql_connect($host, $username, $dbpassword) or die (mysql_error());
$db = mysql_select_db ($dbname, $connection) or die (mysql_error());

$sql = "SELECT * FROM $table WHERE username = '$_POST[username]' AND password = password('$_POST[password]')";	
$result = mysql_query($sql, $connection) or die(mysql_error());
$num = mysql_num_rows($result);

while ($row = mysql_fetch_array($result)) {
$f_name = $row['f_name'];
$l_name = $row['l_name'];
$username = $row['username'];
}


if ($num != 0) {
$_SESSION[auth] = "yes";
$msg = "Welcome $f_name ";
} //else {
//header("Location: index.php");
//exit;
//}

$get_count = "SELECT count(id) FROM $table2";
$get_count_res = mysql_query($get_count, $connection) or die (mysql_error());
$count = mysql_result($get_count_res, 0, "count(id)") or die (mysql_error());


?>
<!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=utf-8" />
<link rel="stylesheet" type="text/css" href="css/reset.css" media="screen" />
<link rel="stylesheet" type="text/css" href="css/admin.css" media="screen"  />
<title>Administration Area</title>
</head>
<body>
<div id="wrapper">
   <?php include('includes/header.php'); ?>
   <div id="content">
      <div class="message"><?php echo "$msg"; ?> <a href="logout.php">Logout</a><span style="float:right; "><?php echo "$today"; ?></span></div>
      <div class="admin"> <span class="top">Administration</span>
         <ul>
            <li><A href="show_add.php">Add a Ad</A></li>
            <li><a href="pick_modify.php">Modify a Add</a></li>
            <li>Delete Ad</li>
            <li><a href="user/index.php">Add a User</a></li>
            <li><a href="user/pick_user.php">Delete a User</a></li>
            <li><a href="#">View Database Records</a></li>
            <li><a href="php_info.php">PHP info</a></li>
            <li><a href="make_backup.php">Backup Database</a> </li>
            <li><a href="https://p3nlmysqladm001.secureserver.net/nl50/529/index.php?lang=en-utf-8&token=db052d2ddafce3f6ba841cfe0a6c224a">View Database</a> </li>
         </ul>
      </div>
      <div class="misc"><span class="top">miscellaneous</span>Classified
         Ads online <?php echo "$count"; ?></div>
   </div>
   <!--End #content-->
   <?php include('includes/footer.php'); ?>
</div>
<!-- End #wrapper -->
</body>
</html>

Link to comment
Share on other sites

Are you developing and debugging your code on a system with error_reporting set to E_ALL and display_errors set to ON in your master php.ini so that all the errors php detects will be reported and displayed? You will save a TON of time.

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.