php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #69432 not able to use header
Submitted: 2015-04-12 18:09 UTC Modified: 2015-04-13 08:06 UTC
From: vijayjames003 at gmail dot com Assigned:
Status: Not a bug Package: Output Control
PHP Version: 5.5.23 OS: windows7
Private report: No CVE-ID: None
 [2015-04-12 18:09 UTC] vijayjames003 at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/mysqli.query
---


Test script:
---------------
<?php
function redirect($page = 'deleteStudent.php'){
 header("Location: $page");
 exit;
}
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "loyola";
$uniqueid=$_POST['uniqueid'];
session_start();
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 

$sql = "DELETE FROM `studentdetails` WHERE `uniqueid` = '$uniqueid'" ;

$result = $conn->query($sql);
if(!$result )
{
echo "Deleted data successfully\n";
header('Location:deleteStudent.php');
}
else
{
echo('error<br/>');
  echo('Could not delete the Uniqueid entered doesnot Exists: ' );

}
?>

Expected result:
----------------
i wanted to delete the record and redirect the page

Actual result:
--------------
im getting  output as below:

error
Could not delete the Uniqueid entered doesnot Exists: 
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\deleteStudent1.php:29) in C:\xampp\htdocs\deleteStudent1.php on line 31

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-04-13 08:06 UTC] peehaa@php.net
-Status: Open +Status: Not a bug
 [2015-04-13 08:06 UTC] peehaa@php.net
This is not a bug in the documentation (or PHP for that matter).

For more information see:

- http://php.net/support.php (general support information)
- http://php.net/manual/en/class.mysqli.php (the mysqli documentation pages)
- http://php.net/manual/en/function.header.php (the header documentation)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 15:01:32 2024 UTC