Doc #69432 [NEW]: not able to use header
| From: | vijayjames003 at gmail dot com | Date: | Sun, 12 Apr 2015 18:09:44 +0000 |
| Subject: | Doc #69432 [NEW]: not able to use header | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-12135@lists.php.net to get a copy of this message | ||
From: vijayjames003 at gmail dot com
Operating system: windows7
PHP version: 5.5.23
Package: Output Control
Bug Type: Documentation Problem
Bug description:not able to use header
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 bug report at https://bugs.php.net/bug.php?id=69432&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69432&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69432&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69432&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=69432&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=69432&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=69432&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=69432&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=69432&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=69432&r=support
Expected behavior: https://bugs.php.net/fix.php?id=69432&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=69432&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=69432&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=69432&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69432&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=69432&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=69432&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=69432&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=69432&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=69432&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=69432&r=mysqlcfg