Ver Mensaje Individual
  #1 (permalink)  
Antiguo 31/05/2007, 11:02
Borjimante
Invitado
 
Mensajes: n/a
Puntos:
Fallo al conetar con la BD

Hola, tengo este codigo php:

Cita:
?php
//AQUI CONEXION O include() DE ARCHIVO DE CONEXION CON BASE DE DATOS.

$conect;
function conectar()
{
global $conect;
$conect = mysql_connect("localhost","xxxxxxx","xxxxxxxxxx") or die (mysql_error());
mysql_select_db("xxxxxxxxxxx",$conect) or die (mysql_error());
}
function desconectar() {
mysql_close($conect);
}

function quitar($mensaje)
{
$mensaje = str_replace("<","&lt;",$mensaje);
$mensaje = str_replace(">","&gt;",$mensaje);
$mensaje = str_replace("\'","'",$mensaje);
$mensaje = str_replace('\"',"&quot;",$mensaje);
$mensaje = str_replace("\\\\","\\",$mensaje);
return $mensaje;
}

if(trim($HTTP_POST_VARS["nick"]) != "" && trim($HTTP_POST_VARS["email"]) != "")
{
$sql = "SELECT id FROM usuarios WHERE nick='".quitar($HTTP_POST_VARS["nick"])."'";
$result = mysql_query($sql);
if($row = mysql_fetch_array($result))
{
echo "Error, nick escogido por otro usuario";
}
else
{
$sql = "INSERT INTO usuarios (nick,password,nombre,email) VALUES (";
$sql .= "'".quitar($HTTP_POST_VARS["nick"])."'";
$sql .= ",'".quitar($HTTP_POST_VARS["password"])."'";
$sql .= ",'".quitar($HTTP_POST_VARS["nombre"])."'";
$sql .= ",'".quitar($HTTP_POST_VARS["email"])."'";
$sql .= ")";
mysql_query($sql);echo "Registro exitoso!";
}
mysql_free_result($result);
}
else
{
echo "Debe llenar como minimo los campos de email y password";
}
mysql_close();
?>
Y al mandarle los datos de registro me aparecen estos errores:

Cita:
Warning: mysql_query() [function.mysql-query]: Access denied for user 'nobody'@'localhost' (using password: NO) in /home/anteraso/public_html/Registro/registrar.php on line 28

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/anteraso/public_html/Registro/registrar.php on line 28

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/anteraso/public_html/Registro/registrar.php on line 29

Warning: mysql_query() [function.mysql-query]: Access denied for user 'nobody'@'localhost' (using password: NO) in /home/anteraso/public_html/Registro/registrar.php on line 41

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/anteraso/public_html/Registro/registrar.php on line 41
Registro exitoso!
Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/anteraso/public_html/Registro/registrar.php on line 43

Warning: mysql_close(): no MySQL-Link resource supplied in /home/anteraso/public_html/Registro/registrar.php on line 49
Como lo soluciono?¿

Un saludo