Ver Mensaje Individual
  #1 (permalink)  
Antiguo 28/12/2003, 11:50
Beldar
 
Fecha de Ingreso: julio-2002
Mensajes: 40
Antigüedad: 21 años, 9 meses
Puntos: 0
Fallo con 2 conexions a la base de datos

Tay haciendo unas cuantas aplicaciones en php y mysql. Tengo varias hechas, entre ellas un gestor de contenidos y un sistema de encuestas. Cuando kiero ke se muestren los 2 simultaneamente en la misma pagina me da error en el segundo.Aqui pongo los codigos de los 2 archivos que se muestran en la misma pagina mediante include("path/to/herramienta.php");

Gestor contenidos:

<?php
include("db/conex.php");
$link=Conectarse();
$result=mysql_query("SELECT * FROM new ORDER BY fecha DESC LIMIT 0, 5",$link);
?>
<?php

while ($row = mysql_fetch_array($result)) {
printf("<table border=0 cellspacing=0 cellpadding=0 align=center width=344>
<tr>
<td class=head align=left background=/public_html/img/boxheadb.jpg height=33>&nbsp;&nbsp;&nbsp;&nbsp;<b>%s&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&nbsp;%s</b></td>
</tr>
<tr><td background=/public_html/img/boxbodyb.jpg align=center width=344><table border=0 cellspacing=0 cellpadding=0 align=center width=300><tr>
<td class=txt align=left>%s</td><td><img src=%s></td>
<tr><td colspan=2 align=left><br><a href=/public_html/fullnew.php?id_new=%s class=link>Leer mas...</a></td></tr>
</tr></table></td></tr>
<tr>
<td background=/public_html/img/boxfootb.jpg width=344 height=25>&nbsp;</td>
</tr>
</table><br>", $row["title"], $row["fecha"], $row["shorttxt"], $row["imgpath"], $row["id_new"]);
}
mysql_free_result($result);
mysql_close($link);
?>

Sistema de encuestas:

<?php
include("db/conex.php");
$link=Conectarse();
$result=mysql_query("SELECT * FROM poll ORDER BY `poll_id` DESC LIMIT 1",$link);


while ($row = mysql_fetch_array($result)) {
printf("<form action=vote.php method=get><table border=0 cellspacing=0 cellpadding=0 width=200>
<tr>
<td width=24>&nbsp;</td>
<td width=176>%s?</td>
</tr>
<tr>
<td><input name=voto type=radio value=a></td>
<td>%s</td>
</tr>
<tr>
<td><input name=voto type=radio value=b></td>
<td>%s</td>
</tr>
<tr>
<td><input name=voto type=radio value=c></td>
<td>%s</td>
</tr>
<tr>
<td>&nbsp;</td>
<td align=right><input type=submit name=Submit value=Votar></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>Numero de votos: %s </td>
</tr>
<tr>
<td>&nbsp;</td>
<td><a href=result.php>Resultados</a></td>
</tr>
</table>
</form><br>", $row["ask"], $row["atext"], $row["btext"], $row["ctext"], $row["total"]);
}
mysql_free_result($result);
mysql_close($link);
?>

Aqui pongo el error que me da:
Fatal error: Cannot redeclare conectarse() (previously declared in /srv/www/htdocs/public_html/db/conex.php:4) in /srv/www/htdocs/public_html/db/conex.php on line 2

Ese error se me muestra en lugar de la encuesta. Si kito el gestor de contenidos y dejo la encuesta no me da el error, pero las 2 herramientas a la vez sale ese error.