Jump to content

Recommended Posts

Hi

I am getting the following php error that is on all my pages and it works fine on the other pages except index.php

<?php
session_start();
include 'includes/conn_db.php';
  if (isset($_POST['submit'])) {
    
    if (empty($_POST['userName'])) {
      $u = FALSE;
      $nouser = '<font color="red" size="2" face="arial">You forgot to enter your username!</font>';
    } else {
    $u = $_POST['userName'];
    }  
    if (empty($_POST['userPassword'])) {
      $p = FALSE;
      $nopass = '<font color="red" size="2" face="arial">You forgot to enter your password!</font>';
    } else {
    $p = $_POST['userPassword'];
    } 
    $errorMessage = $nouser . "<br>" . $nopass;
    if ($u && $p) {
    $query = "SELECT * from clients WHERE email = '$u' AND pword = '$p'";
$result = mysql_query($query, $conn);
while ($row = mysql_fetch_assoc($result)){
if ($u == $row["email"] && $p == $row["pword"]) {
  $query_name = "SELECT * FROM clients WHERE email = '$u' AND pword = '$p'";
    $result_name = @mysql_query ($query_name);
    while ($row_name = mysql_fetch_assoc($result_name)){
$client_id_out = $row_name['client_id'];
    $firstname_out = $row_name['firstname'];
    $lastname_out = $row_name['lastname'];
    
    


// Create sessions
$_SESSION['client_id'] = $client_id_out;
    $_SESSION['firstname'] = $firstname_out;
    $_SESSION['lastname'] = $lastname_out;
   
    
    ob_end_clean();
    header ("Location: myaccount.php");
    exit();
    }} } } }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="Content-Style-Type" content="text/css" />
    <link href="style.css" rel="stylesheet" type="text/css" />
    <link href="layout.css" rel="stylesheet" type="text/css" />

    <script src="js/jquery-1.3.2.min.js" type="text/javascript"></script>

    <script src="js/cufon-yui.js" type="text/javascript"></script>

    <script src="js/cufon-replace.js" type="text/javascript"></script>

    <script src="js/Futura_Bk_BT_400.font.js" type="text/javascript"></script>

    <script src="js/Futura_XBlk_BT_400.font.js" type="text/javascript"></script>

    <!--[if lt IE 7]>
   <script type="text/javascript" src="js/ie_png.js"></script>
   <script type="text/javascript">
       ie_png.fix('.png');
   </script>
<![endif]-->
</head>

 

Thanks

 

Lional

Link to comment
https://forums.phpfreaks.com/topic/246393-headers-already-sent/
Share on other sites

The error message, which you didn't post, states where the OUTPUT is occurring at that is causing the problem. The solution is to find and eliminate that output so that the header() statement will work.

 

If you want us to directly help, you will need to post the error message.

Thank you. For output started on line one of your main file, please read the last reply in this sticky post - http://www.phpfreaks.com/forums/index.php?topic=37442.0

 

You need to save the file without the BOM characters. Your programming editor will either have a choice in the 'file save as' menu or it will have a choice in a character encoding menu.

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.