
28/04/2004, 09:48
|
| | Fecha de Ingreso: noviembre-2003
Mensajes: 383
Antigüedad: 21 años, 2 meses Puntos: 2 | |
Error al conectar a PHP vs Mysql Tengo un fichero inserta.php el cual llama a un fichero conec.php para que realize la conexión con mysql.
El problema es que al ejecutarlo en mi sitio (xxxxx.webcindario.com) me da el siguiente error:
Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /home/webcindario/prepro/conec.php on line 4
INSERTA.PHP
<html>
<head>
</head>
<body>
<?php
include("conec.php");
$link=conectarse();
$sql="insert into noticia (titulo,cuerpo,fecha,fuente) values ('$titulo','$cuerpo','$fecha','$fuente')";
$result=mysql_query($sql,$link);
?>
</body>
</html>
CONEC.PHP
<?php
function conectarse()
{
if (!($link=mysql_connect("localhost","usuario","cont raseña")))
{
exit();
}
if (!mysql_select_db("nombrebasedatos",$link))
{
exit();
}
return $link;
}
?>
¿Alguna idea? |