Jump to content

[SOLVED] Need Help...I'm new and confused


derekbelcher

Recommended Posts

I am trying to do a simple data entry form, and am getting errors.  This is my first database attempt.  See below:

 

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'p2r71184_admin'@'cp01.myhostcenter.com' (using password: YES) in /home/p2r71184/public_html/addentry.php on line 8

 

Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'nobody'@'localhost' (using password: NO) in /home/p2r71184/public_html/addentry.php on line 9

 

Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in /home/p2r71184/public_html/addentry.php on line 9

 

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

 

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

ERROR: unable to post.

 

How do I correct this stuff?

Link to comment
Share on other sites

Here is the code:

 

<HTML>

<HEAD>

  <TITLE>Add a Weblog Entry</TITLE>

</HEAD>

<BODY>

  <?php

  if ($HTTP_POST_VARS['submit']) {

    mysql_connect("mercercountyfa.org","p2r71184_admin","692134");

    mysql_select_db("p2r71184_training");

    $entrytitle=$HTTP_POST_VARS['entrytitle'];

    $entrytext=$HTTP_POST_VARS['entrytext'];

    $query ="INSERT INTO weblog (entrytitle,entrytext)";

    $query.=" VALUES ('$entrytitle','$entrytext')";

    $result=mysql_query($query);

    if ($result) echo "<b>Successfully Posted!</b>";

    else echo "<b>ERROR: unable to post.</b>";

  }

?>

  <H1>Add an Entry</H1>

  <form method="POST" action="addentry.php">

  <b>Title:</b><br>

  <input type="text" name="entrytitle"><br>

  <b>Weblog Entry:</b><br>

  <textarea cols="60" rows="6" name="entrytext">

  </textarea><br>

  <input type="submit" name="submit" value="Submit">

  </form>

</BODY>

</HTML>

Link to comment
Share on other sites

o.k.  here is the stupid question now.  My domain name is www.mercerccountyfa.org and when I put my server name as mercercountyfa.org it turns it into cp01.myhostcenter.com.  I am not sure what my server name should look like.  I am very new to this, and thought I could figure it out, but I am lost.  I am using cpanel to create the sql database.

Link to comment
Share on other sites

log into c panel and make a user i bet you havent made a user for that database ? when u make a databse you have to make a user for it too, this is done where u created teh database its simple in c panel u create the user not in phpmyadmin but in c panel and then you add the user to teh database in c panel

Link to comment
Share on other sites

o.k.  I just figured it out:  ;D I was using the wrong username.  I thought when I created the database, I had to create a username, but the database assigned a different name and I found it.  It works.  This was the first time I have been able to utilize databases...woo hoo.  Thanks for your help

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.