Tema: Conex
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 06/02/2006, 12:38
Avatar de calavera
calavera
 
Fecha de Ingreso: diciembre-2005
Mensajes: 113
Antigüedad: 18 años, 2 meses
Puntos: 0
Conex

amigos,
se puede llamar a dos tablas, para ke se muestren en una misma pag., si es asi como puedo hacerlo, ya ke lo e intentado y me genera un error ya ke estoy llamando 2 veces a conex.php lo cual me genera un error ke
dice:Fatal error: Cannot redeclare conectarse() (previously declared in c:\wamp\www\root\conex.php:4) in c:\wamp\www\root\conex.php on line 15


Código PHP:
 <td width="650" height="10" valign="top" bgcolor="#999966"> 
      <div align="center"><font color="#CCCC00" size="2" face="Courier New, Courier, mono"><strong>.:PROBLEMAS:.</strong></font></div></td>
  </tr>
</table>
<?php
   
include("conex.php");
   
$link=Conectarse();
   
$result=mysql_query("select * from Problemas",$link);
?>
   <TABLE width="650px" BORDER="1" CELLSPACING="1" CELLPADDING="1" >
      <TR><TD>&nbsp;<B>ACCIONES</B></TD> 
            <TD>&nbsp;<B>Rut_Asignado</B></TD> 
          <TD>&nbsp;<B>Prioridad</B>&nbsp;</TD>
          <TD>&nbsp;<B>Estado</B>&nbsp;</TD>
          <TD>&nbsp;<B>Sistema Operativo</B>&nbsp;</TD>
          <TD>&nbsp;<B>Categoría</B>&nbsp;</TD>
          <TD>&nbsp;<B>Descripción</B>&nbsp;</TD>
          <TD>&nbsp;<B>Error</B>&nbsp;</TD>
     </TR>

<?php      


echo("<form name='form1' method='post' action='MensajesRecientesEliminaMultiple.php'>");
echo(
"<input name='submit' type='submit' value='Borrar Seleccionado'>");  

   while(
$row mysql_fetch_array($result)) { 
   
           echo (
"<tr><td><input type='checkbox' name='Rut_Asignado[]' value='$row[Rut_Asignado]'><a onclick='confirmDel();' href=\"MensajesRecientesElinminaSQL.php?Rut_Asignado=".$row["Rut_Asignado"]."\">Eliminar</a></td>
        <td>"
.$row["Rut_Asignado"]."</td><td>".$row["Prioridad"]."</td><td>".$row["Estado"]."</td><td>".$row["Sistema"]."</td>
            <td>"
.$row["Categoria"]."</td><td>".$row["Descripcion"]."</td><td>".$row["Error"]."</td></tr>"); 
            }
echo(
"</form>");
   
mysql_free_result($result);
   
mysql_close($link);   
?> 
</table>
<table width="650" border="1" cellpadding="" cellspacing="">
  <!--DWLayoutTable-->
  <tr> 
    <td width="650" height="10" valign="top" bgcolor="#999966"> 
      <div align="center"><font color="#CCCC00" size="2" face="Courier New, Courier, mono"><strong>.:PROBLEMAS:.</strong></font></div></td>
  </tr>
</table>

<?php
   
include("conex.php");
   
$link=Conectarse();
   
$result=mysql_query("select * from Correo",$link);
?>
   <TABLE width="650px" BORDER="1" CELLSPACING="1" CELLPADDING="1" >
      <TR><TD>&nbsp;<B>ACCIONES</B></TD> 
            <TD>&nbsp;<B>Id_Correo</B></TD> 
          <TD>&nbsp;<B>Para</B>&nbsp;</TD>
          <TD>&nbsp;<B>De</B>&nbsp;</TD>
          <TD>&nbsp;<B>Asunto</B>&nbsp;</TD>
          <TD>&nbsp;<B>Mensaje</B>&nbsp;</TD>
     </TR>

<?php      


echo("<form name='form1' method='post' action='MensajesRecientesEliminaMultiple.php'>");
echo(
"<input name='submit' type='submit' value='Borrar Seleccionado'>");  

   while(
$row mysql_fetch_array($result)) { 
   
           echo (
"<tr><td><input type='checkbox' name='Rut_Asignado[]' value='$row[Rut_Asignado]'><a onclick='confirmDel();' href=\"MensajesRecientesElinminaSQL.php?Rut_Asignado=".$row["Rut_Asignado"]."\">Eliminar</a></td>
        <td>"
.$row["Id_Correo"]."</td><td>".$row["Para"]."</td><td>".$row["De"]."</td><td>".$row["Asunto"]."</td>
            <td>"
.$row["Mensaje"]."</td></tr>"); 
            }
echo(
"</form>");
   
mysql_free_result($result);
   
mysql_close($link);   
?> 
</table>
Código PHP:
<?php 
function Conectarse() 

   if (!(
$link=mysql_connect("localhost","root"))) 
   { 
      echo 
"Error conectando a la base de datos."
      exit(); 
   } 
   if (!
mysql_select_db("test",$link)) 
   { 
      echo 
"Error seleccionando la base de datos."
      exit(); 
   } 
   return 
$link
}
?>