Doc #69432 [Opn->Nab]: not able to use header
| From: | peehaa@php.net | Date: | Mon, 13 Apr 2015 08:06:22 +0000 |
| Subject: | Doc #69432 [Opn->Nab]: not able to use header | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-12138@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69432&edit=1
ID: 69432
Updated by: peehaa@php.net
Reported by: vijayjames003 at gmail dot com
Summary: not able to use header
-Status: Open
+Status: Not a bug
Type: Documentation Problem
Package: Output Control
Operating System: windows7
PHP Version: 5.5.23
Block user comment: N
Private report: N
New Comment:
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)
Previous Comments:
------------------------------------------------------------------------
[2015-04-12 18:09:43] 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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69432&edit=1