Passing Variables from one php doc to another

From: Date: Thu, 21 Nov 2002 04:53:12 +0000
Subject: Passing Variables from one php doc to another
Groups: php.general 
Request: Send a blank email to php-general+get-125376@lists.php.net to get a copy of this message
Hi people, I’m in a lot of trouble, I’m doing a paging for a mySql database result it was going well until I tried it out. It shows the right amount of registries and it shows the next page link, but when I click on the next page it says it is missing a variable, it is the one that is sent by the form witch is the first, but I’m allready sending one variable and I need to send this one also, any ideas? By the way I already trried & , +... and I’m out of ideeas, please help. The code in under my name. Rodrigo <? $id = mysql_connect("localhost","rodrigo","rodrigo"); $con = mysql_select_db("db_mp",$id); $sql = mysql_query("SELECT * FROM tb_base WHERE processo='$processo'"); $rpp =10;//resultado por página ($lpp) $total = mysql_num_rows($sql);//retorna o total de linhas na tabela $pagina = ceil($total / $rpp);//retorna o resultado total de páginas da tabela if(!isset($pagina)){ $pagina = 0; }//// Especifica uma valor para variavel pagina caso a mesma não esteja setada $inicio = $pagina * $rpp;// Retorna qual será a primeira linha a ser mostrada no MySQL $fim = $inicio + $rpp;// Retorna qual será a última linha a ser mostrada no MySQL $resultado = mysql_query("SELECT * FROM tb_base WHERE processo='$processo' LIMIT $inicio,$fim"); // Executa a query no MySQL com o limite de linhas. while($l = mysql_fetch_array($sql)) { echo $l[0]."\n".$l[1]."\n".$l[2]."\n".$l[3]."\n".$l[4]."\n".$l[5]."\n".$l[6]. "\n".$l[7]."\n".$l[8]."<br>\n"; } if($pagina > 0) { $menos = $pagina - 1; $url = "$PHP_SELF?pagina=$menos"; echo "<a href=".$url.">Anterior</a>"; // Vai para a página anterior } for($i=0;$i<$pagina;$i++) { // Gera um loop com o link para as páginas $url = "$PHP_SELF?pagina=$i"; echo " | <a href=".$url.">$i</a>"; } if($pagina < ($pagina - 1)) { $mais = $pagina + 1; $url = "$PHP_SELF?pagina=$mais"; echo " | <a href=".$url.>Próxima</a>"; } ?>

« previous php.general (#125376) next »