473,320 Members | 2,092 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

keep variables in pagination

Hi, i'm trying to set pagination for a search i run on my website, i'll
try to explain the easiest i can:

When i click the search button on search.php, data is received and
stored in variables within results.php, MySQL structure seems to work
as expected, although i get some problems:

As soon as i click on the "Page 2" Link, i get nothing, neither results
nor page numbers.

I know why this happens: after clicking on any "Page X" link, the page
self-reloads and this changes the stored value in the VARIABLES (i
assume to 0 or nothing), therefore, MySQL structure doesn't work, since
there's no correct data to set the query.

Stating the obvious, if i set a fixed value instead of a variable my
structure perfectly works:

-> Results are displayed
-> Page numbers reflect the data stored in MySQL
-> Page numbers are fully fonctional, i can click them
in any way, and it always work.

But i cannot set a fixed value since data is defined in search.php, so
results.php cannot have a fixed values, otherwise, the search is not a
search, it's only a fixed d

So my question is how do i keep the values received from the search.php
after every self-reload of the page.

This is the code i am using:

<?php

// Database Connection
include 'db.php';

// THIS ARE THE VARIABLES TO KEEP EVERY PAGE RELOAD

$table = $_POST['table'];
$data02 = $_POST['data02'];
$data03 = $_POST['data03'];
$data04 = $_POST['data04'];
$data05 = $_POST['data05'];
$data06 = $_POST['data06'];
$data07 = $_POST['data07'];
$data08 = $_POST['data08'];
$data09 = $_POST['data09'];

// If current page number, use it if not, set one!

if(!isset($_GET['page'])){
$page = 1;
} else {
$page = $_GET['page'];
}

// Define the number of results per page

$max_results = 10;

// Figure out the limit for the query based on the current page number.

$from = (($page * $max_results) - $max_results);

// Perform MySQL query on only the current page number's results

// THIS VARIABLES DATA (DECLARED ABOVE) IS ERASED AFTER THE PAGE RELOAD
// THIS IS THE DATA I'D LIKE TO KEEP FOR EVERY RELOAD.

$sql = mysql_query("SELECT * FROM `$table` WHERE `data02` LIKE
'%$data02%' AND `data03` LIKE '%$data03%' AND `data04` LIKE '%$data04%'
AND `data05` LIKE '%$data05%' AND `data06` LIKE '%$data06%' AND
`data07` >= $data08 AND `data07` <= $data09 ORDER BY `data07` ASC LIMIT
$from, $max_results");

echo '<table id="cssstyle">'."\n";
echo "<tr> <th>Top</th> <th>Top</th> <th>Top</th> <th>Top</th>
<th>Top</th> <th>Top</th> <th>Top</th> <th>Top</th>
<th>Top</th>"."\n"."</tr>"."\n";

while($row = mysql_fetch_array($sql)){ // Build your formatted
below.

echo '<tr>'."\n"."<td align='left'>"."\n";
echo $row['1strow'];
echo "\n"."</td>"."\n"."<td align='center'>"."\n";
echo $row['2ndrow'];
echo "\n"."</td>"."\n"."<td align='center'>"."\n";
echo $row['3rdrow'];
echo "\n"."</td>"."\n"."<td align='center'>"."\n";
echo $row['4throw'];
echo "\n"."</td>"."\n"."<td align='center'>"."\n";
echo $row['5throw'];
echo "\n"."</td>"."\n"."<td align='center'>"."\n";
echo $row['6throw'];
echo "\n"."</td>"."\n"."<td align='center'>"."\n";
echo $row['7throw'];
echo "\n"."</td>"."\n"."<td width='28%' align='left'>"."\n";
echo $row['8throw'];
echo "\n"."</td>"."\n"."<td align='center'>"."\n";
echo $row['9throw'];
echo "</a>"."\n"."</td>"."\n"."</tr>"."\n"."\n";
}
echo "</table>"."\n"."</div>"."\n"."<!-- Results-wrapper Ends
-->"."\n";

// Figure out the total number of results in DB:

// "$table" VALUE IS NOT KEEPT AFTER PAGE RELOADS.
// AND LIKE THE OTHER VALUES, IT SHOULD BE KEPT.

$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM
$table"),0);

// Figure out the total number of pages. Always round up using ceil()
$total_pages = ceil($total_results / $max_results);

// Build Page Number Hyperlinks
echo "<div id='pages'><center>Select a Page<br />";

// Build Previous Link
if($page > 1){
$prev = ($page - 1);
echo "<a
href=\"".$_SERVER['PHP_SELF']."?page=$prev\">&lt;&lt;Previous</a> ";
}

for($i = 1; $i <= $total_pages; $i++){
if(($page) == $i){
echo "$i ";
} else {
echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$i\">$i</a> ";
}
}

// Build Next Link
if($page < $total_pages){
$next = ($page + 1);
echo "<a
href=\"".$_SERVER['PHP_SELF']."?page=$next\">Next&gt;&gt;</a>";
}
echo "</center>"."\n";

?>

I hope you can help me, i'm don't master php, but i understand a lot of
it; I'm actually thinking that what might solve my problem will come
from something like:
http://www.mysite.com/results.php?pa...03=XX&var04=XX

But that's exactly what i don't know how to do U_U

Thanks, and i hope you could help me

Regards,
EOZyo.

Feb 9 '06 #1
10 7205
d
"EOZyo" <eo****@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Hi, i'm trying to set pagination for a search i run on my website, i'll
try to explain the easiest i can:

When i click the search button on search.php, data is received and
stored in variables within results.php, MySQL structure seems to work
as expected, although i get some problems:

As soon as i click on the "Page 2" Link, i get nothing, neither results
nor page numbers.

I know why this happens: after clicking on any "Page X" link, the page
self-reloads and this changes the stored value in the VARIABLES (i
assume to 0 or nothing), therefore, MySQL structure doesn't work, since
there's no correct data to set the query.

Stating the obvious, if i set a fixed value instead of a variable my
structure perfectly works:

-> Results are displayed
-> Page numbers reflect the data stored in MySQL
-> Page numbers are fully fonctional, i can click them
in any way, and it always work.

But i cannot set a fixed value since data is defined in search.php, so
results.php cannot have a fixed values, otherwise, the search is not a
search, it's only a fixed d

So my question is how do i keep the values received from the search.php
after every self-reload of the page.

This is the code i am using:

<?php

// Database Connection
include 'db.php';

// THIS ARE THE VARIABLES TO KEEP EVERY PAGE RELOAD

$table = $_POST['table'];
$data02 = $_POST['data02'];
$data03 = $_POST['data03'];
$data04 = $_POST['data04'];
$data05 = $_POST['data05'];
$data06 = $_POST['data06'];
$data07 = $_POST['data07'];
$data08 = $_POST['data08'];
$data09 = $_POST['data09'];

// If current page number, use it if not, set one!

if(!isset($_GET['page'])){
$page = 1;
} else {
$page = $_GET['page'];
}

// Define the number of results per page

$max_results = 10;

// Figure out the limit for the query based on the current page number.

$from = (($page * $max_results) - $max_results);

// Perform MySQL query on only the current page number's results

// THIS VARIABLES DATA (DECLARED ABOVE) IS ERASED AFTER THE PAGE RELOAD
// THIS IS THE DATA I'D LIKE TO KEEP FOR EVERY RELOAD.

$sql = mysql_query("SELECT * FROM `$table` WHERE `data02` LIKE
'%$data02%' AND `data03` LIKE '%$data03%' AND `data04` LIKE '%$data04%'
AND `data05` LIKE '%$data05%' AND `data06` LIKE '%$data06%' AND
`data07` >= $data08 AND `data07` <= $data09 ORDER BY `data07` ASC LIMIT
$from, $max_results");

echo '<table id="cssstyle">'."\n";
echo "<tr> <th>Top</th> <th>Top</th> <th>Top</th> <th>Top</th>
<th>Top</th> <th>Top</th> <th>Top</th> <th>Top</th>
<th>Top</th>"."\n"."</tr>"."\n";

while($row = mysql_fetch_array($sql)){ // Build your formatted
below.

echo '<tr>'."\n"."<td align='left'>"."\n";
echo $row['1strow'];
echo "\n"."</td>"."\n"."<td align='center'>"."\n";
echo $row['2ndrow'];
echo "\n"."</td>"."\n"."<td align='center'>"."\n";
echo $row['3rdrow'];
echo "\n"."</td>"."\n"."<td align='center'>"."\n";
echo $row['4throw'];
echo "\n"."</td>"."\n"."<td align='center'>"."\n";
echo $row['5throw'];
echo "\n"."</td>"."\n"."<td align='center'>"."\n";
echo $row['6throw'];
echo "\n"."</td>"."\n"."<td align='center'>"."\n";
echo $row['7throw'];
echo "\n"."</td>"."\n"."<td width='28%' align='left'>"."\n";
echo $row['8throw'];
echo "\n"."</td>"."\n"."<td align='center'>"."\n";
echo $row['9throw'];
echo "</a>"."\n"."</td>"."\n"."</tr>"."\n"."\n";
}
echo "</table>"."\n"."</div>"."\n"."<!-- Results-wrapper Ends
-->"."\n";

// Figure out the total number of results in DB:

// "$table" VALUE IS NOT KEEPT AFTER PAGE RELOADS.
// AND LIKE THE OTHER VALUES, IT SHOULD BE KEPT.

$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM
$table"),0);

// Figure out the total number of pages. Always round up using ceil()
$total_pages = ceil($total_results / $max_results);

// Build Page Number Hyperlinks
echo "<div id='pages'><center>Select a Page<br />";

// Build Previous Link
if($page > 1){
$prev = ($page - 1);
echo "<a
href=\"".$_SERVER['PHP_SELF']."?page=$prev\">&lt;&lt;Previous</a> ";
}

for($i = 1; $i <= $total_pages; $i++){
if(($page) == $i){
echo "$i ";
} else {
echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$i\">$i</a> ";
}
}

// Build Next Link
if($page < $total_pages){
$next = ($page + 1);
echo "<a
href=\"".$_SERVER['PHP_SELF']."?page=$next\">Next&gt;&gt;</a>";
}
echo "</center>"."\n";

?>

I hope you can help me, i'm don't master php, but i understand a lot of
it; I'm actually thinking that what might solve my problem will come
from something like:
http://www.mysite.com/results.php?pa...03=XX&var04=XX

But that's exactly what i don't know how to do U_U

Thanks, and i hope you could help me

Regards,
EOZyo.


Take a look at using sessions:

http://www.php.net/sessions

They allow you to store a value in one script, and then access it in later
scripts. They're very easy to use, and might be what you need.

dave
Feb 9 '06 #2
You could pass them in the query string, but that is cumbersome, You
could also put all the variables in to hidden inputs, then instead of
making the next page link href directly to the next page have it do a
javascript form.submit.

Feb 9 '06 #3
i haven't read through it ,but i wish something below can be helpful!

if(empty($_SESSION['search_sql']) && isset($_POST[submit])){
// to construct search_sql
$search_sql = ......
$SESSION[search_sql] = $search_sql;
}else{
$search_sql = $_SESSION[search_sql];
}

$per_page = 20;
$start = ($pageno-1)*$per_page;

$query = mysql_query($search_sql." LIMIT ".$start.",".$per_page,$link);
............

Feb 9 '06 #4
$_POST variables are only posted at one request, they are neither a
cookie or a session.

try using sessions :)

Feb 9 '06 #5
Well, i started working with cookies, what i did to solve the problem
is the following:

Data is sent from page.php into search.php which stores the information
in cookies and this page forwards to results.php

-> Data from page.php is sent with a search box that uses POST.
-> Data received from page.php into search.php is taken with
$_POST['table']
-> Data in results.php is retreived with $_COOKIE['table']

Do you think this is fine or should i look for something more direct?
what i mean is straight from page.php into results.php.

Everything is working PERFECTLY with this structure, i'm just wondering
if it's practical or if i'm probably repeating a step that i could
avoid.

Thank you all!

Feb 10 '06 #6

"d" <d@example.com> wrote in message
news:6%******************@text.news.blueyonder.co. uk...
"EOZyo" <eo****@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Hi, i'm trying to set pagination for a search i run on my website, i'll
try to explain the easiest i can:

When i click the search button on search.php, data is received and
stored in variables within results.php, MySQL structure seems to work
as expected, although i get some problems:

As soon as i click on the "Page 2" Link, i get nothing, neither results
nor page numbers.

I know why this happens: after clicking on any "Page X" link, the page
self-reloads and this changes the stored value in the VARIABLES (i
assume to 0 or nothing), therefore, MySQL structure doesn't work, since
there's no correct data to set the query.

Stating the obvious, if i set a fixed value instead of a variable my
structure perfectly works:

-> Results are displayed
-> Page numbers reflect the data stored in MySQL
-> Page numbers are fully fonctional, i can click them
in any way, and it always work.

But i cannot set a fixed value since data is defined in search.php, so
results.php cannot have a fixed values, otherwise, the search is not a
search, it's only a fixed d

So my question is how do i keep the values received from the search.php
after every self-reload of the page.

This is the code i am using:

<?php

// Database Connection
include 'db.php';

// THIS ARE THE VARIABLES TO KEEP EVERY PAGE RELOAD

$table = $_POST['table'];
$data02 = $_POST['data02'];
$data03 = $_POST['data03'];
$data04 = $_POST['data04'];
$data05 = $_POST['data05'];
$data06 = $_POST['data06'];
$data07 = $_POST['data07'];
$data08 = $_POST['data08'];
$data09 = $_POST['data09'];

// If current page number, use it if not, set one!

if(!isset($_GET['page'])){
$page = 1;
} else {
$page = $_GET['page'];
}

// Define the number of results per page

$max_results = 10;

// Figure out the limit for the query based on the current page number.

$from = (($page * $max_results) - $max_results);

// Perform MySQL query on only the current page number's results

// THIS VARIABLES DATA (DECLARED ABOVE) IS ERASED AFTER THE PAGE RELOAD
// THIS IS THE DATA I'D LIKE TO KEEP FOR EVERY RELOAD.

$sql = mysql_query("SELECT * FROM `$table` WHERE `data02` LIKE
'%$data02%' AND `data03` LIKE '%$data03%' AND `data04` LIKE '%$data04%'
AND `data05` LIKE '%$data05%' AND `data06` LIKE '%$data06%' AND
`data07` >= $data08 AND `data07` <= $data09 ORDER BY `data07` ASC LIMIT
$from, $max_results");

echo '<table id="cssstyle">'."\n";
echo "<tr> <th>Top</th> <th>Top</th> <th>Top</th> <th>Top</th>
<th>Top</th> <th>Top</th> <th>Top</th> <th>Top</th>
<th>Top</th>"."\n"."</tr>"."\n";

while($row = mysql_fetch_array($sql)){ // Build your formatted
below.

echo '<tr>'."\n"."<td align='left'>"."\n";
echo $row['1strow']; echo "\n"."</td>"."\n"."<td align='center'>"."\n";
echo $row['2ndrow'];
why not just simplify this to...
echo "\n</td>\n<td align='center'>\n$row[2ndrow]";
that other way looke like the hard way to do things. And if you need double
quotes in the string, just use \"
echo "\n"."</td>"."\n"."<td align='center'>"."\n";
echo $row['3rdrow'];
echo "\n"."</td>"."\n"."<td align='center'>"."\n";
echo $row['4throw'];
echo "\n"."</td>"."\n"."<td align='center'>"."\n";
echo $row['5throw'];
echo "\n"."</td>"."\n"."<td align='center'>"."\n";
echo $row['6throw'];
echo "\n"."</td>"."\n"."<td align='center'>"."\n";
echo $row['7throw'];
echo "\n"."</td>"."\n"."<td width='28%' align='left'>"."\n";
echo $row['8throw'];
echo "\n"."</td>"."\n"."<td align='center'>"."\n";
echo $row['9throw'];
echo "</a>"."\n"."</td>"."\n"."</tr>"."\n"."\n";
}
echo "</table>"."\n"."</div>"."\n"."<!-- Results-wrapper Ends
-->"."\n";

// Figure out the total number of results in DB:

// "$table" VALUE IS NOT KEEPT AFTER PAGE RELOADS.
// AND LIKE THE OTHER VALUES, IT SHOULD BE KEPT.

$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM
$table"),0);

// Figure out the total number of pages. Always round up using ceil()
$total_pages = ceil($total_results / $max_results);

// Build Page Number Hyperlinks
echo "<div id='pages'><center>Select a Page<br />";

// Build Previous Link
if($page > 1){
$prev = ($page - 1);
echo "<a
href=\"".$_SERVER['PHP_SELF']."?page=$prev\">&lt;&lt;Previous</a> ";
}

for($i = 1; $i <= $total_pages; $i++){
if(($page) == $i){
echo "$i ";
} else {
echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$i\">$i</a> ";
}
}

// Build Next Link
if($page < $total_pages){
$next = ($page + 1);
echo "<a
href=\"".$_SERVER['PHP_SELF']."?page=$next\">Next&gt;&gt;</a>";
}
echo "</center>"."\n";

?>

I hope you can help me, i'm don't master php, but i understand a lot of
it; I'm actually thinking that what might solve my problem will come
from something like:
http://www.mysite.com/results.php?pa...03=XX&var04=XX

But that's exactly what i don't know how to do U_U

Thanks, and i hope you could help me

Regards,
EOZyo.


Take a look at using sessions:

http://www.php.net/sessions

They allow you to store a value in one script, and then access it in later
scripts. They're very easy to use, and might be what you need.

dave

Feb 16 '06 #7

"EOZyo" <eo****@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Hi, i'm trying to set pagination for a search i run on my website, i'll
try to explain the easiest i can:

When i click the search button on search.php, data is received and
stored in variables within results.php, MySQL structure seems to work
as expected, although i get some problems:

As soon as i click on the "Page 2" Link, i get nothing, neither results
nor page numbers.

I know why this happens: after clicking on any "Page X" link, the page
self-reloads and this changes the stored value in the VARIABLES (i
assume to 0 or nothing), therefore, MySQL structure doesn't work, since
there's no correct data to set the query.

Stating the obvious, if i set a fixed value instead of a variable my
structure perfectly works:

-> Results are displayed
-> Page numbers reflect the data stored in MySQL
-> Page numbers are fully fonctional, i can click them
in any way, and it always work.

But i cannot set a fixed value since data is defined in search.php, so
results.php cannot have a fixed values, otherwise, the search is not a
search, it's only a fixed d

So my question is how do i keep the values received from the search.php
after every self-reload of the page.

This is the code i am using:

<?php

// Database Connection
include 'db.php';

// THIS ARE THE VARIABLES TO KEEP EVERY PAGE RELOAD

$table = $_POST['table'];
$data02 = $_POST['data02'];
$data03 = $_POST['data03'];
$data04 = $_POST['data04'];
$data05 = $_POST['data05'];
$data06 = $_POST['data06'];
$data07 = $_POST['data07'];
$data08 = $_POST['data08'];
$data09 = $_POST['data09'];

// If current page number, use it if not, set one!

if(!isset($_GET['page'])){
$page = 1;
} else {
$page = $_GET['page'];
}

// Define the number of results per page

$max_results = 10;

// Figure out the limit for the query based on the current page number.

$from = (($page * $max_results) - $max_results);

// Perform MySQL query on only the current page number's results

// THIS VARIABLES DATA (DECLARED ABOVE) IS ERASED AFTER THE PAGE RELOAD
// THIS IS THE DATA I'D LIKE TO KEEP FOR EVERY RELOAD.

$sql = mysql_query("SELECT * FROM `$table` WHERE `data02` LIKE
'%$data02%' AND `data03` LIKE '%$data03%' AND `data04` LIKE '%$data04%'
AND `data05` LIKE '%$data05%' AND `data06` LIKE '%$data06%' AND
`data07` >= $data08 AND `data07` <= $data09 ORDER BY `data07` ASC LIMIT
$from, $max_results");

echo '<table id="cssstyle">'."\n";
echo "<tr> <th>Top</th> <th>Top</th> <th>Top</th> <th>Top</th>
<th>Top</th> <th>Top</th> <th>Top</th> <th>Top</th>
<th>Top</th>"."\n"."</tr>"."\n";

while($row = mysql_fetch_array($sql)){ // Build your formatted
below.

echo '<tr>'."\n"."<td align='left'>"."\n";
echo $row['1strow'];
echo "\n"."</td>"."\n"."<td align='center'>"."\n";
echo $row['2ndrow'];
echo "\n"."</td>"."\n"."<td align='center'>"."\n";
echo $row['3rdrow'];
echo "\n"."</td>"."\n"."<td align='center'>"."\n";
echo $row['4throw'];
echo "\n"."</td>"."\n"."<td align='center'>"."\n";
echo $row['5throw'];
echo "\n"."</td>"."\n"."<td align='center'>"."\n";
echo $row['6throw'];
echo "\n"."</td>"."\n"."<td align='center'>"."\n";
echo $row['7throw'];
echo "\n"."</td>"."\n"."<td width='28%' align='left'>"."\n";
echo $row['8throw'];
echo "\n"."</td>"."\n"."<td align='center'>"."\n";
echo $row['9throw'];
echo "</a>"."\n"."</td>"."\n"."</tr>"."\n"."\n";
}
echo "</table>"."\n"."</div>"."\n"."<!-- Results-wrapper Ends
-->"."\n";

// Figure out the total number of results in DB:

// "$table" VALUE IS NOT KEEPT AFTER PAGE RELOADS.
// AND LIKE THE OTHER VALUES, IT SHOULD BE KEPT.

$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM
$table"),0);

// Figure out the total number of pages. Always round up using ceil()
$total_pages = ceil($total_results / $max_results);

// Build Page Number Hyperlinks
echo "<div id='pages'><center>Select a Page<br />";

// Build Previous Link
if($page > 1){
$prev = ($page - 1);
echo "<a
href=\"".$_SERVER['PHP_SELF']."?page=$prev\">&lt;&lt;Previous</a> ";
}

for($i = 1; $i <= $total_pages; $i++){
if(($page) == $i){
echo "$i ";
} else {
echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$i\">$i</a> ";
}
}

// Build Next Link
if($page < $total_pages){
$next = ($page + 1);
echo "<a
href=\"".$_SERVER['PHP_SELF']."?page=$next\">Next&gt;&gt;</a>";
}
echo "</center>"."\n";

?>

I hope you can help me, i'm don't master php, but i understand a lot of
it; I'm actually thinking that what might solve my problem will come
from something like:
http://www.mysite.com/results.php?pa...03=XX&var04=XX

That URL there is what you would use $_GET[] to get your form variables
with.
Even if your form method is set for post, you can still use get, but you
will notice that when people hit the back button on their browser your old
variables will come back on you, so be picky about when you use the url for.
Actually, I think it can also repost old form data too, especially if the
user hits refresh.
Use $_POST for post form vars of course.
You also have the option of using $_SESSION[]
http://us3.php.net/manual/en/function.session-start.php to keep data between
pages, which is a good way to hide it.
But that's exactly what i don't know how to do U_U

Thanks, and i hope you could help me

Regards,
EOZyo.

Feb 16 '06 #8
> why not just simplify this to...
echo "\n</td>\n<td align='center'>\n$row[2ndrow]";
that other way looke like the hard way to do things. And if you need double
quotes in the string, just use \"


Hi Jim, thanks for the advice, i've have changed everything in my
source code so it's more "legible" now :)

I'm new with PHP and i've learned everything i know from tutorials on
the net, the problem with them is that sometimes, little things (like
\', \t, \n \") are overseen and ppl ignore them since they are rookies
mistakes, but rookies (like me) well, don't know about them and we,
actually, make those mistakes :S

Thanks again for the tip :D

I have a question though, what's better to use (in a very general way)
SESSIONS or COOKIE? I mean i worked already with cookies and everything
works but if i need to learn one or the other, what would be the best?

Regards,
EOZyo

Feb 18 '06 #9
"EOZyo" <eo****@gmail.com> wrote:

I have a question though, what's better to use (in a very general way)
SESSIONS or COOKIE? I mean i worked already with cookies and everything
works but if i need to learn one or the other, what would be the best?


Every time you create a cookie, you are sending more crapola over to the
client computer, to be stored on their hard disk, and ALL of your cookies
are transmitted back to you with EVERY http request the browser makes.

With a session, PHP basically sends one cookie, and then uses that cookie
to look up information that is stored locally, on your server. The
bandwidth impact is much lower.
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Feb 18 '06 #10
Hi Tim, thanks for clarifying, i guess that switching from cookies to
sessions isn't a big mess, is it? I mean, I would only have to change
the code and settings related to $_COOKIE for $_SESSION??

What i meant is like in results.php i have $foo =
$_COOKIE['something']; i should change that for $foo =
$_SESSION['something']; obviously, setting the session_start and stuff
like that in the respective pages (the one the stores the info and the
one that retrieves it, am i right?

Thanks!
EOZyo

Every time you create a cookie, you are sending more crapola over to the
client computer, to be stored on their hard disk, and ALL of your cookies
are transmitted back to you with EVERY http request the browser makes.

With a session, PHP basically sends one cookie, and then uses that cookie
to look up information that is stored locally, on your server. The
bandwidth impact is much lower.
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.


Feb 19 '06 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Sharif T. Karim | last post by:
Anyone know of a up-to-date tutorial for pagination where I can have it like: Prev 1 2 3 4 Next Thanks. -- Sharif T. Karim ....you don't know wrath yet...
1
by: Faree | last post by:
I am workign on a news portal which needs paginaiton as usual.but all the code i got depends on the number of records that will come from database :( .it is working well too. But i need...
1
by: Kruq | last post by:
Is it possible to use pagination with DataList? Can't find it.. :( Kruq
2
by: Chris H | last post by:
I am having a problem with pagination, basically the problem is happening in the "PREV / NUMBERS / NEXT" links, it appears as if the reason is becasue the increment and decrement operators aren't...
11
by: ste | last post by:
Hi there, Further to my recent posts where I've received excellent help from Rik and Jerry, I've ended up with an image gallery on my website that displays images in a table, 3 images per row. ...
3
by: PseudoMega | last post by:
I'm working with a PHP page I wrote which searches through records in a MySQL database. I have a <form method="post"which currently passes all of search variables into the session array. I'd...
3
Unicron
by: Unicron | last post by:
Hi folks, I have been working on a property listing search for a company for a while now and have hit a roadblock. I have searched the net up and down. A lot of Google results lead to this site, but...
1
by: shalini jain | last post by:
Hi, I want to know how can we do pagination using XSL. There are number of tutorials available on pagination using PHP but nothing with XSL. i am really stuck with my code. Below is the code that...
16
by: gnawz | last post by:
I have a pagination function I am using in a file called functions.php as below<? //Pagination functions function getPagingQuery($sql, $itemPerPage = 10) { if (isset($_GET) && (int)$_GET > 0) ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.