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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
43 - 18 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Sat Apr 20 00:01:27 2024 UTC