Help - Search - Members - Calendar
Full Version: Php Error
Zymic Webmaster Forums > Zymic Free Web Hosting > Zymic Free Web Hosting - General Discussion & Help
Alef
When I try to test my guetbook, i get this error
[ERROR]
Access denied for user '71757_eset'@'192.168.1.1' to database '71757_eset_mural'
[/ERROR]

Link:
http://esetfree.zxq.net/IframePages/comentarios.php

CODE
<?php
    $server ="hosting.zymic.com";
    $user="71757_eset";
    $password="*********";
    $dbname="71757_eset_mural";
    mysql_connect($server,$user,$password) or die(mysql_error());
    mysql_select_db($dbname) or die(mysql_error());
?>


I don't know what to do.

And sorry if my english is not so good.
I'm still learning. laugh.gif

Jacob - No need for passwords to be in there.
Jacob
Your file should be:
CODE
<?php
    $server ="localhost";
    $user="71757_eset";
    $password="*********";
    $dbname="71757_eset_mural";
    mysql_connect($server,$user,$password) or die(mysql_error());
    mysql_select_db($dbname) or die(mysql_error());
?>
Alef
Thanks and thanks.
1º for the help.
2º for cleaning my password.
tongue.gif
I see that this host is the best again.
Alef
I tried the code you gave me, but i still gat the error.
I'll post all my codes to see if there are errors.
Conecta.php:
CODE
<?php
    $server ="localhost";
    $user="71757_eset";
    $password="*********";
    $dbname="71757_eset_mural";
    mysql_connect($server,$user,$password) or die(mysql_error());
    mysql_select_db($dbname) or die(mysql_error());
?>


comentarios.php
CODE
<HTML>
<HEAD>
        <TITLE>GuestBook</TITLE>
    <META http-equiv="Content-Type" content="text/html; charset=utf-8"><STYLE type="text/css">
<!--
body,td,th {
    color: #333;
}
body {
    background-color: #CCC;
}
a {
    font-family: Trebuchet MS, Arial, Helvetica, sans-serif;
    font-size: 12px;
}
-->
</STYLE></HEAD>
<BODY>
        <STRONG>GuestBook</STRONG>
<FORM method="POST" action="cadastra.php">
    <P>Titulo:
  <INPUT type="text" name="titulo" />
              
              
              E-mail: <INPUT type="text" name="email" />
              
              
              Recado:
              <TEXTAREA name="recado">Deixe seu recado!</TEXTAREA>
              
              <INPUT type="submit" />          
              
            </P>
<P>Recados Postados: </P>
            <?php
                include("conecta.php");              
                $query = "SELECT * FROM recados ORDER BY id DESC";
                $resultado = mysql_query($query) or die(mysql_error());
                while ($row = mysql_fetch_array($resultado)) {
                    echo "< b>".$row["titulo"]."< /b>";
                    echo "< br/>";
                    echo $row["comentario"];
                    echo "< br/>";              
                    echo "E-mail: < b>".$row["email"]."< /b>";
                    echo "< br/>< br/>";                              
                }
                mysql_close();
            ?>
    </FORM>
</BODY>
</HTML>


cadastra.php
CODE
<?php
    include("conecta.php");
    $titulo = $_POST['titulo'];
    $email = $_POST['email'];
    $recado = $_POST['recado'];
  
  
    $query = "INSERT INTO recados (titulo,email,comentario) VALUES ('$titulo','$email','$recado')";
    mysql_query($query) or die (mysql_error());
  
    mysql_close();
  
    header("location:comentatios.php")
?>

I already have the DB"71757_eset_mural" and the table"recados".
I'm brazilian, it's my first guestbook, sorry for using your time for simple things. dry.gif
Thanks. laugh.gif
Jacob
One thing that doesn't really matter however I am getting it bashed into me quite a bit - the PHP include is a language construct not a function so it doesn't have to have parentheses.

In your script, there is a few
CODE
include("conecta.php");

You should change these to
CODE
include "conecta.php";


Also, with your SQL I notice you have:
SQL
SELECT * FROM recados ORDER BY id DESC

This would work, however, you should always use a back tick ( ` ) around your database, table and column names. Like shown below:
SQL
SELECT * FROM `recados` ORDER BY `id` DESC
Jacob
Sorry, username should be: esetfree_zxq_eset_mural (just my assumption) . Otherwise it is the form of [sitename]_[site subdomain ext]_[db username] .
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.