Jump to content

Recommended Posts

Hello everyone,

 

I have this error comming up in the hosting server and not in my local box. I know this is a simple error but i am not able to find a fix even after a lot of googling. Can some one help me to fix this issue. Its very urgent.

 

Thanks in advance for your advices.

 

Error

*****

Cannot modify header information - headers already sent by (output started at /home/carnatik/public_html/apothem/library/config.php:6) in /home/carnatik/public_html/apothem/login.php on line 14

 

 

Code

****

<?php

session_start();

$errorMessage = '';

if (isset($_POST['schoolname']))

{

  include 'library/config.php';

  include 'library/opendb.php';

  $schoolname = $_POST['schoolname'];

  $sql = "SELECT schoolname FROM registration WHERE schoolname = '$schoolname'";

  $result = mysql_query($sql) or die('Query failed.' . mysql_error());

  if (mysql_num_rows($result) == 1)

  {

      $_SESSION['db_is_logged_in'] = true;

  header('Location: schoollist.php');

      exit;

}

  else

  {

      $errorMessage = 'Error: Please check the school name / Register again';

  }

  include 'library/closedb.php';

}

?>

Link to comment
https://forums.phpfreaks.com/topic/61678-solved-need-help-very-urgent/
Share on other sites

Dear xylex & dg,

 

Thanks for your response. These are my include files

 

config.php

********

<?php

$dbhost = 'localhost';

$dbuser = 'carnatik_root';

$dbpass = '';

$dbname = 'carnatik_apothem';

?>

opendb.php

*********

<?php

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');

mysql_select_db($dbname);

?>

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.