when i click to link and its also display data in print_r() function but it wont redirect to my list page , i am stuck on header(“location:student-list.php?id=1”); , it also dosent give me any error.
link page : href=“student-list-pagination?name=all”
Student list pagination.php
<?php include("config.php");?>
<?php include("header.php");?>
<?php
if($_REQUEST['name']=='all')
{
$q=mysql_query("SELECT * FROM userdata ORDER BY id DESC",$con);
while($row=mysql_fetch_array($q))
{
$all[]=$row;
}
$_SESSION['allstudent']=$all;
header("location:student-list.php?id=1");
}
?>
after that $_SESSION[‘allstudent’] data is printed but wont redirect on student-list page…
please give me a advise …thanku
Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include, or require, functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file.
yes But I removed every unused Space Before The Header location . but it also wont work .
And i also get $_SESSION[‘allstudent’]=$all Data but i want that data before i called header function
would eliminate that as a cause. Also have a look at either mysqli or PDO methods of accessing data - the old-style MySQL calls are deprecated so for new code, you shouldn’t really use them.
**Thank you all For The help I really appreciate your Help . After All of your Suggestions , I removed my PDO objects and upload in new server so thanks to all and also i get a new knowledge from you so thanku **