Hi all! I'm working on a ecommerce site and had the sessions working fine, and then after vacations (30 days) try to start working with the project and received an error message: Warning: session_start(): Cannot send session cookie - headers already sent by (output started at c:\programas\easyphp1-8\www\medical\detalhe_prod.php:23) in c:\programas\easyphp1-8\www\medical\db.php on line 43 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at c:\programas\easyphp1-8\www\medical\detalhe_prod.php:23) in c:\programas\easyphp1-8\www\medical\db.php on line 43 Warning: Cannot modify header information - headers already sent by (output started at c:\programas\easyphp1-8\www\medical\detalhe_prod.php:23) in c:\programas\easyphp1-8\www\medical\db.php on line 44 I didn't change anything!!!!!!! What is going on? António Fonseca
Hi all! Thanks for the fast reply! But since I didn't change anything! Can this be possible? António Here is the complete page code: ---------------------------- <?php require_once('Connections/medical.php'); ?> <?php include("db.php"); mysql_select_db($database_medical, $medical); $query_bd = "SELECT * FROM titulos ORDER BY titulo ASC"; $bd = mysql_query($query_bd, $medical) or die(mysql_error()); $row_bd = mysql_fetch_assoc($bd); $totalRows_bd = mysql_num_rows($bd); $colname_Recordsetprod = "-1"; if (isset($_GET['cod_cat'])) { $colname_Recordsetprod = (get_magic_quotes_gpc()) ? $_GET['cod_cat'] : addslashes($_GET['cod_cat']); } ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title></title> </head> <body> <table width="741" height="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td colspan="4" align="left" valign="top"><table width="100%" height="21%" border="0" cellpadding="0" cellspacing="0"> <tr> <td rowspan="2" align="left" valign="top"><a href="index.php"><img src="images/medical2_02.gif" alt="página principal" width="168" height="129" border="0" /></a></td> <td height="89" colspan="2" align="left" valign="top"><img src="images/medical2_03.gif" width="8" height="106" /></td> <td height="89" align="left" valign="middle"><form name="search" method="get" action="pesquisar.php"> <input name="swords" type="text" size="20" maxlength="30"> <input alt=pesquisar border=0 name=submit src="images/2btn_lupa.gif" type=image> </form></td> <td height="89" align="left" valign="top"> </td> </tr> <tr> <td width="1%" align="left" valign="top"><img src="images/medical2_05.gif" width="10" height="23" /></td> <td colspan="2" align="center" valign="middle" class="bgbartop"> <a href="quemsomos.php" class="linkb">Quem Somos</a> : <a href="novidades.php" class="linkb">Novidades</a> : <a href="promo.php" class="linkb">Promoções</a> : <a href="condi.php" class="linkb">Condições de enc.</a> : <a href="enc.php" class="linkb">Enc. por Email</a> : <a href="contactos.php" class="linkb">Contactos</a> : <a href="ajuda.php" class="linkb">Ajuda</a> </td> <td width="2%" align="right" valign="top" class="bgbartop"><img src="images/medical2_08.gif" width="13" height="23" /></td> </tr> <tr> <td width="23%" align="left" valign="top"><img src="images/medical2_09.gif" width="169" height="26" align="absmiddle" /></td> <td align="left" valign="top" bgcolor="CCCCCC" class="barrasearch"></td> <td width="50%" align="left" valign="middle" bgcolor="CCCCCC" class="barrasearch"><img src="images/carro.gif" width="15" height="13" /><span class="text1"> <? print"<a href='cart.php?action=showcart()'>ver carrinho</a>" ?></span></td> <td width="24%" align="left" valign="middle" bgcolor="CCCCCC" class="text1"> </td> <td align="right" valign="top" bgcolor="CCCCCC" class="barrasearch"><img src="images/medical2_11.gif" width="1" height="26" /></td> </tr> </table></td> </tr> <tr> <td width="168" align="left" valign="top"><table width="168" height="100%" border="0" cellpadding="0" cellspacing="0" id="Table_01"> <tr> </tr> <tr> <td width="18" rowspan="2" align="right" valign="middle" class="bgjanelas"> </td> <td width="150" rowspan="2" align="left" valign="top" class="style4"> <?php do { ?> <img src="images/seta.gif" width="6" height="5" /> <?php print "<a href='produtos.php?cod_cat=$row_bd[id]'>$row_bd[titulo]</a>"; ?><br /> <?php } while ($row_bd = mysql_fetch_assoc($bd)); ?></td> </tr> <tr> </tr> <tr> <td colspan="2" align="left" valign="top"><img src="images/medical2_21.gif" width="168" height="24" /></td> </tr> <tr> <td colspan="2" align="left" valign="top"><img src="images/teste1_21.gif" width="168" height="26" alt="f" /></td> </tr> <tr> <td align="right" valign="top" class="bgjanelas2"> </td> <td align="left" valign="middle"><img src="images/seta.gif" width="6" height="5" /><span class="style4"> <a href="http://www.bastosviegas.com/" target="_blank" class="linkum">Bastos Viegas Portugal</a></span> </td> </tr> <tr> <td align="right" valign="top" class="bgjanelas2"> </td> <td align="left" valign="middle"><p class="style4"><img src="images/seta.gif" width="6" height="5" /> <a href="http://www.bastosviegas.com.br/" target="_blank" class="linkum">Bastos Viegas Brasil</a> </p></td> </tr> <tr> <td align="right" valign="top" class="bgjanelas2"> </td> <td align="left" valign="middle" class="style4"><img src="images/seta.gif" width="6" height="5" /><a href="index.php" class="linkum"> Medical Exp. Portugal </a></td> </tr> <tr> <td align="right" valign="top" class="bgjanelas2"> </td> <td align="left" valign="middle"><span class="style5"><img src="images/seta.gif" width="6" height="5" /><span class="style6"> <a href="http://www.medicalexpress.es/" target="_blank" class="linkum">Medical Exp. Espanha</a> </span></span></td> </tr> <tr> <td align="right" valign="top" class="bgjanelas2"> </td> <td align="left" valign="middle"><span class="style5"><img src="images/seta.gif" width="6" height="5" /> </span><span class="style4">Bel Express </span></td> </tr> <tr> <td align="right" valign="top" class="bgjanelas2"> </td> <td align="left" valign="middle"><span class="style5"><img src="images/seta.gif" width="6" height="5" /> </span><span class="style4">Nieto Guimarães </span></td> </tr> <tr> <td align="right" valign="top" class="bgjanelas2"> </td> <td align="left" valign="middle"><span class="style5"><img src="images/seta.gif" width="6" height="5" /> </span><span class="style4">Prev</span></td> </tr> <tr> <td colspan="2" rowspan="3" align="left" valign="top"><img src="images/medical2_26.gif" width="168" height="23" /></td> </tr> <tr> </tr> <tr> </tr> </table></td> <td width="8" align="left" valign="top" class="bglinhaleft"><img src="images/medical2_14.gif" width="9" height="3" /></td> <td width="556" align="left" valign="top"><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td colspan="4"> </td> </tr> <tr> <td colspan="4" class="linha titulo1"><?php mysql_select_db($database_medical, $medical); $result = mysql_query("SELECT * from titulos where id =$_GET[cod_cat]"); $tit = mysql_fetch_array($result); $titulo_upper= mb_strtoupper($tit['titulo']); print "$titulo_upper"; ?> <div align="right"></div></td> </tr> <tr> <td colspan="4"> </td> </tr> <tr> <td height="19" colspan="2" align="left" valign="top" class="style4"><div align="left"> <? mysql_select_db($database_medical, $medical); $query ="select * from produto where id = $_GET[ler]"; $result = mysql_query($query) or die('Error, query failed'); $campos = mysql_fetch_array($result); $logo_id = $campos['logo']; $result1 = mysql_query("select * from logo where id = $logo_id"); $campos1 = mysql_fetch_array($result1); print"<br><img src='logos/$campos1[logo].jpg'><br>"; ?> <br /> </div></td> <td height="19" colspan="2" align="right" valign="top" class="style4"><?php mysql_select_db($database_medical, $medical); $query ="select * from produto where id = $_GET[ler]"; $result = mysql_query($query) or die('Error, query failed'); $campos = mysql_fetch_array($result); $tit_up=mb_strtoupper($campos['produto']); print "<strong>$tit_up</strong><br>"; if($campos['sub_nome'] <> ""){ print"<font color='#CC0000'>$campos[sub_nome]</font><br>"; } if($campos['numero_int'] <> "" and $campos['numero_int'] <> " "){ print" <img src='bv/$campos[numero_int].gif'><br><br>"; } ?> </td> </tr> <tr> <td height="19" colspan="4" align="right" valign="top"> <div align="right"></div></td> </tr> <tr> <td width="350" height="19" align="left" valign="top" class="bglinha"><img src="images/medical2_03.gif" width="254" height="13" /></td> <td width="109" align="right" valign="bottom" class="bglinha"><div align="right"><img src="images/cod_swap2.jpg" width="108" height="21" /></div></td> <td width="17" height="19" align="right" valign="bottom" class="bglinha"><? print "<a href='detalhe_esp.php?ler=$_GET[ler]&cod_cat=$_GET[cod_cat]'><img src='images/espec_swap1.jpg' width='108' height='21' alt='especificações' border='0' /></a>" ?></td> <td width="79" align="right" valign="bottom" class="bglinha"><div align="right"><? print "<a href='detalhe_fot.php?ler=$_GET[ler]&cod_cat=$_GET[cod_cat]'><img src='images/fotos_swap2.jpg' width='78' height='21' alt='fotos' border='0' /></a>" ?></div></td> </tr> <tr> <td height="19" colspan="4" align="left" valign="top" class="style4"><br /></td> </tr> </table> <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td><form id="form2" name="form2" method="post" action=""> <span class="style4"> <? mysql_select_db($database_medical, $medical); $query = mysql_query("select * from produto where id = $_GET[ler]"); $sub = mysql_fetch_array($query); $id_sub = $sub['id']; $query1 = mysql_query("select * from sub_produto where produto = $id_sub and visible = 1 order by codigo asc"); $result = mysql_query("select * from cart inner join sub_produto on cart.itemId = sub_produto.ID where cart.cookieId = '" . GetCartId() . "' order by sub_produto.codigo asc"); print "<table width=\"100%\"><tr>"; $contador=0; while ($subprod = mysql_fetch_array($query1)) { $id=$subprod['ID']; $cod=strval($subprod['codigo']); $ref=$subprod['ref']; $sut=$subprod['sutura']; $agu=$subprod['agulha']; $fio=$subprod['fio']; $cal=$subprod['calibre']; $set=$subprod['sets']; $comp=$subprod['comprimento']; $tipo=$subprod['tipo']; $cor=$subprod['cor']; $tens=$subprod['tensao']; $capac=$subprod['capacidade']; $mod=$subprod['modelo']; $med=$subprod['medida']; $tam=$subprod['tamanho']; $per=$subprod['per_joelho']; $pun=$subprod['punho']; $nr=$subprod['nr']; $desc=$subprod['descricao']; $dim=$subprod['dimensao']; $cam=$subprod['camadas']; $uni=$subprod['uni_saco']; $diam=$subprod['diametro']; $emp=$subprod['empacotamento']; $unid=$subprod['unidades']; $gr=$subprod['gr_uni']; $clip=$subprod['clips']; $dob=$subprod['dobra']; $cab=$subprod['cabo']; $pont=$subprod['ponta']; $apli=$subprod['aplicacao']; $esp=$subprod['espessura']; $euro=$subprod['euro']; $iva=$subprod['iva']; $vis=$subprod['visible']; if ($contador%2==0){ print "<tr>"; }else{ print "<tr bgcolor='#CCCCCC'>";} //if ($vis==1){ if ($cod <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Código</strong><br><br><br>"; } print "$cod<br>"; print "</td>"; } if ($ref <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Ref.</strong><br><br><br>"; } print "$ref<br>"; print "</td>"; } if ($sut <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Sutura</strong><br><br><br>"; } print "$sut<br>"; print "</td>"; } if ($agu <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Agulha</strong><br><br><br>"; } print "$agu<br>"; print "</td>"; } if ($fio <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Fio</strong><br><br><br>"; } print "$fio<br>"; print "</td>"; } if ($cal <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Cal.</strong><br><br><br>"; } print "$cal<br>"; print "</td>"; } if ($set <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Sets</strong><br><br><br>"; } print "$set<br>"; print "</td>"; } if ($comp <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Comprimento</strong><br><br><br>"; } print "$comp<br>"; print "</td>"; } if ($tipo <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Tipo</strong><br><br><br>"; } print "$tipo<br>"; print "</td>"; } if ($cor <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Cor</strong><br><br><br>"; } print "$cor<br>"; print "</td>"; } if ($tens <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Tensão</strong><br><br><br>"; } print "$tens<br>"; print "</td>"; } if ($capac <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Capacidade</strong><br><br><br>"; } print "$capac<br>"; print "</td>"; } if ($mod <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Modelo</strong><br><br><br>"; } print "$mod<br>"; print "</td>"; } if ($med <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Medida</strong><br><br><br>"; } print "$med<br>"; print "</td>"; } if ($tam <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Tamanho</strong><br><br><br>"; } print "$tam<br>"; print "</td>"; } if ($per <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Per_joelho</strong><br><br><br>"; } print "$per<br>"; print "</td>"; } if ($pun <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Punho</strong><br><br><br>"; } print "$pun<br>"; print "</td>"; } if ($nr <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Nr.</strong><br><br><br>"; } print "$nr<br>"; print "</td>"; } if ($desc <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Descri.</strong><br><br><br>"; } print "$desc<br>"; print "</td>"; } if ($dim <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Dimensão</strong><br><br><br>"; } print "$dim<br>"; print "</td>"; } if ($cam <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Camadas</strong><br><br><br>"; } print "$cam<br>"; print "</td>"; } if ($uni <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Uni_saco</strong><br><br><br>"; } print "$uni<br>"; print "</td>"; } if ($diam <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Diametro</strong><br><br><br>"; } print "$diam<br>"; print "</td>"; } if ($emp <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Empac.</strong><br><br><br>"; } print "$emp<br>"; print "</td>"; } if ($unid <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Unidades</strong><br><br><br>"; } print "$unid<br>"; print "</td>"; } if ($gr <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Gr_uni</strong><br><br><br>"; } print "$gr<br>"; print "</td>"; } if ($clip <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Clips</strong><br><br><br>"; } print "$clip<br>"; print "</td>"; } if ($dob <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Dobra</strong><br><br><br>"; } print "$dob<br>"; print "</td>"; } if ($cab <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Cabo</strong><br><br><br>"; } print "$cab<br>"; print "</td>"; } if ($pont <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Ponta</strong><br><br><br>"; } print "$pont<br>"; print "</td>"; } if ($apli <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Aplicação</strong><br><br><br>"; } print "$apli<br>"; print "</td>"; } if ($esp <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Espessura</strong><br><br><br>"; } print "$esp<br>"; print "</td>"; } if ($euro <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Preço</strong><br><br><br>"; } print "€$euro<br>"; print "</td>"; } if ($iva <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Iva</strong><br><br><br>"; } print "$iva%<br>"; print "</td>"; //print "<td>"; //if($contador==0){ //print "<strong class='linha'>Qtd</strong><br><br>"; //} //print "<input type=text name='qtd' onKeyUp=validanum(this); size='1' maxlength='3'><br>"; //print "</td>"; print "<td>"; if($contador==0){ print "<br><br><br>"; } print "<a href='cart.php?action=add_item&id=$id&qty=1&cod=$subprod[codigo]'><img src='images/carro.gif' border='0' alt='comprar'></a>"; print "</td>"; } print "</tr>"; ++$contador; } print "</td>"; print "</tr></table>"; ?> </form> </td> </tr> </table></td> <td width="9" align="right" valign="top" class="bglinharigth"> </td> </tr> <tr> <td colspan="4" align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="23%" rowspan="2" align="right" valign="top"> </td> <td width="1%" align="left" valign="top"><img src="images/medical2_37.gif" width="9" height="35" /></td> <td width="75%" class="barfooter"><div align="center"><span class="style13"><span class="style14">©2006 Copyright</span> <span class="style17">Bastos Viegas</span>. Todos os direitos reservados. E-mail- <a href="mailto:geral@bastosviegas.com" class="linkb">geral@bastosviegas.com</a></span></div></td> <td width="1%" align="left" valign="top"><img src="images/medical2_40.gif" width="9" height="35" /></td> </tr> <tr> <td colspan="3"> </td> </tr> </table></td> </tr> </table> <span class="bglinharigth"><img src="images/medical2_16.gif" width="9" height="3" /></span> </body> </html> <?php mysql_free_result($bd); ?> Code (markup):
Hi! Thanks for the fast reply! I didn't change anything! Can this be possible? António Here is the complete page code: ---------------------------- <?php require_once('Connections/medical.php'); ?> <?php include("db.php"); mysql_select_db($database_medical, $medical); $query_bd = "SELECT * FROM titulos ORDER BY titulo ASC"; $bd = mysql_query($query_bd, $medical) or die(mysql_error()); $row_bd = mysql_fetch_assoc($bd); $totalRows_bd = mysql_num_rows($bd); $colname_Recordsetprod = "-1"; if (isset($_GET['cod_cat'])) { $colname_Recordsetprod = (get_magic_quotes_gpc()) ? $_GET['cod_cat'] : addslashes($_GET['cod_cat']); } ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title></title> </head> <body> <table width="741" height="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td colspan="4" align="left" valign="top"><table width="100%" height="21%" border="0" cellpadding="0" cellspacing="0"> <tr> <td rowspan="2" align="left" valign="top"><a href="index.php"><img src="images/medical2_02.gif" alt="página principal" width="168" height="129" border="0" /></a></td> <td height="89" colspan="2" align="left" valign="top"><img src="images/medical2_03.gif" width="8" height="106" /></td> <td height="89" align="left" valign="middle"><form name="search" method="get" action="pesquisar.php"> <input name="swords" type="text" size="20" maxlength="30"> <input alt=pesquisar border=0 name=submit src="images/2btn_lupa.gif" type=image> </form></td> <td height="89" align="left" valign="top"> </td> </tr> <tr> <td width="1%" align="left" valign="top"><img src="images/medical2_05.gif" width="10" height="23" /></td> <td colspan="2" align="center" valign="middle" class="bgbartop"> <a href="quemsomos.php" class="linkb">Quem Somos</a> : <a href="novidades.php" class="linkb">Novidades</a> : <a href="promo.php" class="linkb">Promoções</a> : <a href="condi.php" class="linkb">Condições de enc.</a> : <a href="enc.php" class="linkb">Enc. por Email</a> : <a href="contactos.php" class="linkb">Contactos</a> : <a href="ajuda.php" class="linkb">Ajuda</a> </td> <td width="2%" align="right" valign="top" class="bgbartop"><img src="images/medical2_08.gif" width="13" height="23" /></td> </tr> <tr> <td width="23%" align="left" valign="top"><img src="images/medical2_09.gif" width="169" height="26" align="absmiddle" /></td> <td align="left" valign="top" bgcolor="CCCCCC" class="barrasearch"></td> <td width="50%" align="left" valign="middle" bgcolor="CCCCCC" class="barrasearch"><img src="images/carro.gif" width="15" height="13" /><span class="text1"> <? print"<a href='cart.php?action=showcart()'>ver carrinho</a>" ?></span></td> <td width="24%" align="left" valign="middle" bgcolor="CCCCCC" class="text1"> </td> <td align="right" valign="top" bgcolor="CCCCCC" class="barrasearch"><img src="images/medical2_11.gif" width="1" height="26" /></td> </tr> </table></td> </tr> <tr> <td width="168" align="left" valign="top"><table width="168" height="100%" border="0" cellpadding="0" cellspacing="0" id="Table_01"> <tr> </tr> <tr> <td width="18" rowspan="2" align="right" valign="middle" class="bgjanelas"> </td> <td width="150" rowspan="2" align="left" valign="top" class="style4"> <?php do { ?> <img src="images/seta.gif" width="6" height="5" /> <?php print "<a href='produtos.php?cod_cat=$row_bd[id]'>$row_bd[titulo]</a>"; ?><br /> <?php } while ($row_bd = mysql_fetch_assoc($bd)); ?></td> </tr> <tr> </tr> <tr> <td colspan="2" align="left" valign="top"><img src="images/medical2_21.gif" width="168" height="24" /></td> </tr> <tr> <td colspan="2" align="left" valign="top"><img src="images/teste1_21.gif" width="168" height="26" alt="f" /></td> </tr> <tr> <td align="right" valign="top" class="bgjanelas2"> </td> <td align="left" valign="middle"><img src="images/seta.gif" width="6" height="5" /><span class="style4"> <a href="http://www.bastosviegas.com/" target="_blank" class="linkum">Bastos Viegas Portugal</a></span> </td> </tr> <tr> <td align="right" valign="top" class="bgjanelas2"> </td> <td align="left" valign="middle"><p class="style4"><img src="images/seta.gif" width="6" height="5" /> <a href="http://www.bastosviegas.com.br/" target="_blank" class="linkum">Bastos Viegas Brasil</a> </p></td> </tr> <tr> <td align="right" valign="top" class="bgjanelas2"> </td> <td align="left" valign="middle" class="style4"><img src="images/seta.gif" width="6" height="5" /><a href="index.php" class="linkum"> Medical Exp. Portugal </a></td> </tr> <tr> <td align="right" valign="top" class="bgjanelas2"> </td> <td align="left" valign="middle"><span class="style5"><img src="images/seta.gif" width="6" height="5" /><span class="style6"> <a href="http://www.medicalexpress.es/" target="_blank" class="linkum">Medical Exp. Espanha</a> </span></span></td> </tr> <tr> <td align="right" valign="top" class="bgjanelas2"> </td> <td align="left" valign="middle"><span class="style5"><img src="images/seta.gif" width="6" height="5" /> </span><span class="style4">Bel Express </span></td> </tr> <tr> <td align="right" valign="top" class="bgjanelas2"> </td> <td align="left" valign="middle"><span class="style5"><img src="images/seta.gif" width="6" height="5" /> </span><span class="style4">Nieto Guimarães </span></td> </tr> <tr> <td align="right" valign="top" class="bgjanelas2"> </td> <td align="left" valign="middle"><span class="style5"><img src="images/seta.gif" width="6" height="5" /> </span><span class="style4">Prev</span></td> </tr> <tr> <td colspan="2" rowspan="3" align="left" valign="top"><img src="images/medical2_26.gif" width="168" height="23" /></td> </tr> <tr> </tr> <tr> </tr> </table></td> <td width="8" align="left" valign="top" class="bglinhaleft"><img src="images/medical2_14.gif" width="9" height="3" /></td> <td width="556" align="left" valign="top"><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td colspan="4"> </td> </tr> <tr> <td colspan="4" class="linha titulo1"><?php mysql_select_db($database_medical, $medical); $result = mysql_query("SELECT * from titulos where id =$_GET[cod_cat]"); $tit = mysql_fetch_array($result); $titulo_upper= mb_strtoupper($tit['titulo']); print "$titulo_upper"; ?> <div align="right"></div></td> </tr> <tr> <td colspan="4"> </td> </tr> <tr> <td height="19" colspan="2" align="left" valign="top" class="style4"><div align="left"> <? mysql_select_db($database_medical, $medical); $query ="select * from produto where id = $_GET[ler]"; $result = mysql_query($query) or die('Error, query failed'); $campos = mysql_fetch_array($result); $logo_id = $campos['logo']; $result1 = mysql_query("select * from logo where id = $logo_id"); $campos1 = mysql_fetch_array($result1); print"<br><img src='logos/$campos1[logo].jpg'><br>"; ?> <br /> </div></td> <td height="19" colspan="2" align="right" valign="top" class="style4"><?php mysql_select_db($database_medical, $medical); $query ="select * from produto where id = $_GET[ler]"; $result = mysql_query($query) or die('Error, query failed'); $campos = mysql_fetch_array($result); $tit_up=mb_strtoupper($campos['produto']); print "<strong>$tit_up</strong><br>"; if($campos['sub_nome'] <> ""){ print"<font color='#CC0000'>$campos[sub_nome]</font><br>"; } if($campos['numero_int'] <> "" and $campos['numero_int'] <> " "){ print" <img src='bv/$campos[numero_int].gif'><br><br>"; } ?> </td> </tr> <tr> <td height="19" colspan="4" align="right" valign="top"> <div align="right"></div></td> </tr> <tr> <td width="350" height="19" align="left" valign="top" class="bglinha"><img src="images/medical2_03.gif" width="254" height="13" /></td> <td width="109" align="right" valign="bottom" class="bglinha"><div align="right"><img src="images/cod_swap2.jpg" width="108" height="21" /></div></td> <td width="17" height="19" align="right" valign="bottom" class="bglinha"><? print "<a href='detalhe_esp.php?ler=$_GET[ler]&cod_cat=$_GET[cod_cat]'><img src='images/espec_swap1.jpg' width='108' height='21' alt='especificações' border='0' /></a>" ?></td> <td width="79" align="right" valign="bottom" class="bglinha"><div align="right"><? print "<a href='detalhe_fot.php?ler=$_GET[ler]&cod_cat=$_GET[cod_cat]'><img src='images/fotos_swap2.jpg' width='78' height='21' alt='fotos' border='0' /></a>" ?></div></td> </tr> <tr> <td height="19" colspan="4" align="left" valign="top" class="style4"><br /></td> </tr> </table> <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td><form id="form2" name="form2" method="post" action=""> <span class="style4"> <? mysql_select_db($database_medical, $medical); $query = mysql_query("select * from produto where id = $_GET[ler]"); $sub = mysql_fetch_array($query); $id_sub = $sub['id']; $query1 = mysql_query("select * from sub_produto where produto = $id_sub and visible = 1 order by codigo asc"); $result = mysql_query("select * from cart inner join sub_produto on cart.itemId = sub_produto.ID where cart.cookieId = '" . GetCartId() . "' order by sub_produto.codigo asc"); print "<table width=\"100%\"><tr>"; $contador=0; while ($subprod = mysql_fetch_array($query1)) { $id=$subprod['ID']; $cod=strval($subprod['codigo']); $ref=$subprod['ref']; $sut=$subprod['sutura']; $agu=$subprod['agulha']; $fio=$subprod['fio']; $cal=$subprod['calibre']; $set=$subprod['sets']; $comp=$subprod['comprimento']; $tipo=$subprod['tipo']; $cor=$subprod['cor']; $tens=$subprod['tensao']; $capac=$subprod['capacidade']; $mod=$subprod['modelo']; $med=$subprod['medida']; $tam=$subprod['tamanho']; $per=$subprod['per_joelho']; $pun=$subprod['punho']; $nr=$subprod['nr']; $desc=$subprod['descricao']; $dim=$subprod['dimensao']; $cam=$subprod['camadas']; $uni=$subprod['uni_saco']; $diam=$subprod['diametro']; $emp=$subprod['empacotamento']; $unid=$subprod['unidades']; $gr=$subprod['gr_uni']; $clip=$subprod['clips']; $dob=$subprod['dobra']; $cab=$subprod['cabo']; $pont=$subprod['ponta']; $apli=$subprod['aplicacao']; $esp=$subprod['espessura']; $euro=$subprod['euro']; $iva=$subprod['iva']; $vis=$subprod['visible']; if ($contador%2==0){ print "<tr>"; }else{ print "<tr bgcolor='#CCCCCC'>";} //if ($vis==1){ if ($cod <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Código</strong><br><br><br>"; } print "$cod<br>"; print "</td>"; } if ($ref <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Ref.</strong><br><br><br>"; } print "$ref<br>"; print "</td>"; } if ($sut <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Sutura</strong><br><br><br>"; } print "$sut<br>"; print "</td>"; } if ($agu <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Agulha</strong><br><br><br>"; } print "$agu<br>"; print "</td>"; } if ($fio <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Fio</strong><br><br><br>"; } print "$fio<br>"; print "</td>"; } if ($cal <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Cal.</strong><br><br><br>"; } print "$cal<br>"; print "</td>"; } if ($set <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Sets</strong><br><br><br>"; } print "$set<br>"; print "</td>"; } if ($comp <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Comprimento</strong><br><br><br>"; } print "$comp<br>"; print "</td>"; } if ($tipo <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Tipo</strong><br><br><br>"; } print "$tipo<br>"; print "</td>"; } if ($cor <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Cor</strong><br><br><br>"; } print "$cor<br>"; print "</td>"; } if ($tens <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Tensão</strong><br><br><br>"; } print "$tens<br>"; print "</td>"; } if ($capac <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Capacidade</strong><br><br><br>"; } print "$capac<br>"; print "</td>"; } if ($mod <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Modelo</strong><br><br><br>"; } print "$mod<br>"; print "</td>"; } if ($med <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Medida</strong><br><br><br>"; } print "$med<br>"; print "</td>"; } if ($tam <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Tamanho</strong><br><br><br>"; } print "$tam<br>"; print "</td>"; } if ($per <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Per_joelho</strong><br><br><br>"; } print "$per<br>"; print "</td>"; } if ($pun <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Punho</strong><br><br><br>"; } print "$pun<br>"; print "</td>"; } if ($nr <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Nr.</strong><br><br><br>"; } print "$nr<br>"; print "</td>"; } if ($desc <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Descri.</strong><br><br><br>"; } print "$desc<br>"; print "</td>"; } if ($dim <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Dimensão</strong><br><br><br>"; } print "$dim<br>"; print "</td>"; } if ($cam <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Camadas</strong><br><br><br>"; } print "$cam<br>"; print "</td>"; } if ($uni <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Uni_saco</strong><br><br><br>"; } print "$uni<br>"; print "</td>"; } if ($diam <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Diametro</strong><br><br><br>"; } print "$diam<br>"; print "</td>"; } if ($emp <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Empac.</strong><br><br><br>"; } print "$emp<br>"; print "</td>"; } if ($unid <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Unidades</strong><br><br><br>"; } print "$unid<br>"; print "</td>"; } if ($gr <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Gr_uni</strong><br><br><br>"; } print "$gr<br>"; print "</td>"; } if ($clip <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Clips</strong><br><br><br>"; } print "$clip<br>"; print "</td>"; } if ($dob <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Dobra</strong><br><br><br>"; } print "$dob<br>"; print "</td>"; } if ($cab <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Cabo</strong><br><br><br>"; } print "$cab<br>"; print "</td>"; } if ($pont <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Ponta</strong><br><br><br>"; } print "$pont<br>"; print "</td>"; } if ($apli <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Aplicação</strong><br><br><br>"; } print "$apli<br>"; print "</td>"; } if ($esp <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Espessura</strong><br><br><br>"; } print "$esp<br>"; print "</td>"; } if ($euro <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Preço</strong><br><br><br>"; } print "€$euro<br>"; print "</td>"; } if ($iva <> ""){ print "<td>"; if($contador==0){ print "<strong class='linha'>Iva</strong><br><br><br>"; } print "$iva%<br>"; print "</td>"; //print "<td>"; //if($contador==0){ //print "<strong class='linha'>Qtd</strong><br><br>"; //} //print "<input type=text name='qtd' onKeyUp=validanum(this); size='1' maxlength='3'><br>"; //print "</td>"; print "<td>"; if($contador==0){ print "<br><br><br>"; } print "<a href='cart.php?action=add_item&id=$id&qty=1&cod=$subprod[codigo]'><img src='images/carro.gif' border='0' alt='comprar'></a>"; print "</td>"; } print "</tr>"; ++$contador; } print "</td>"; print "</tr></table>"; ?> </form> </td> </tr> </table></td> <td width="9" align="right" valign="top" class="bglinharigth"> </td> </tr> <tr> <td colspan="4" align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="23%" rowspan="2" align="right" valign="top"> </td> <td width="1%" align="left" valign="top"><img src="images/medical2_37.gif" width="9" height="35" /></td> <td width="75%" class="barfooter"><div align="center"><span class="style13"><span class="style14">©2006 Copyright</span> <span class="style17">Bastos Viegas</span>. Todos os direitos reservados. E-mail- <a href="mailto:geral@bastosviegas.com" class="linkb">geral@bastosviegas.com</a></span></div></td> <td width="1%" align="left" valign="top"><img src="images/medical2_40.gif" width="9" height="35" /></td> </tr> <tr> <td colspan="3"> </td> </tr> </table></td> </tr> </table> <span class="bglinharigth"><img src="images/medical2_16.gif" width="9" height="3" /></span> </body> </html> <?php mysql_free_result($bd); ?> Code (markup):
Sorry sent the wrong page! The error is in the db.php António --------------------------------- <?php require_once('Connections/medical.php'); ?> <?php mysql_select_db($database_medical, $medical); // This page contains the connection routine for the // database as well as getting the ID of the cart, etc $dbServer = "localhost"; $dbUser = "root"; $dbPass = ""; $dbName = "medical"; function ConnectToDb($server, $user, $pass, $database) { //Connect to the database and return // true/false depending on whether or // not a connection could be made. $s = @mysql_connect($server, $user, $pass); $d = @mysql_select_db($database, $s); if(!$s || !$d) return false; else return true; } function GetCartId() { // This function will generate an encrypted string and // will set it as a cookie using set_cookie. This will // also be used as the cookieId field in the cart table if(isset($_COOKIE["cartId"])) { return $_COOKIE["cartId"]; } else { // There is no cookie set. We will set the cookie // and return the value of the users session ID session_start(); setcookie("cartId", session_id(), time() + ((3600 * 24) * 30)); return session_id(); } } ?> PHP:
Hi, The GetCartId() function is called from the line: $result = mysql_query("select * from cart inner join sub_produto on cart.itemId = sub_produto.ID where cart.cookieId = '" . GetCartId() . "' order by sub_produto.codigo asc"); PHP: The thing is that you should not call session_start() after data has been sent. At the place of the function call, half of the HTML page has already been sent. Try placing the session_start(); call at the top of your file. Before all the includes etc. When is the cookie actually set? Thomas