Jump to content

MYSQL ERROR CODE


devang23

Recommended Posts

I keep getting this error code Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'a3213677'@'192.168.0.10' (using password: YES) in /home/a3213677/public_html/workpart2.php on line 5

 

i have no clue what it means, here is the short script im trying to write

 

<html><head><title>I'm a GENUIS</title></head>
<body>
<?php

$conn=mysql_connect("mysql4.000webhost.com","*****","*****") or die("try again punk");
$rs = mysql_select_db("a3213677_snorre", $conn) or die("NOOOPE");
$sql="select * from User Table";
$rs=mysql_query($sql,$conn) or die("still nada");;

$list = "<table border=\"1\" cellpadding=\"2\">";
$list.="<tr><th><First Name</th>";
$list.="<th>Last Name</th>";
$list.="<th>UserName</th>";
$list.="<th>PassWord</th></tr>";

while($row= mysql_fetch_array($rs) )
{
$list .= "<tr>";
$list .= "<td>".$row["first_name"]."</td>";
$list .= "<td>".$row["last_name"]."</td>";
$list .= "<td>".$row["username"]."</td>";
$list .= "<td>".$row["password"]."</td>";
$list .= "</tr>";
}
$list .= "<\table";

echo($list);

?>
</body><html>

 

Link to comment
Share on other sites

This means either username or password you supplied for MySQL connection is incorrect.

 

 

thats the thing though, both are correct...and it matches my username and password that i have for mysql.  im working off a 3rd party server.  do you know what would be the possible reason its not pickin up the mysql that comes with it.

Link to comment
Share on other sites

ok well i think i changed the name, and no error this time but now what comes up is MY error that i entered in for it

"still nada"

 

<html><head><title>I'm a GENUIS</title></head>
<body>
<?php

$conn=mysql_connect("mysql4.000webhost.com","a3213677_dolphin","*****") or die("try again punk");
$rs = mysql_select_db("a3213677_snorre", $conn) or die("NOOOPE");
$sql="select * from User Table";
$rs=mysql_query($sql,$conn) or die("[b]still nada[/b]");;

$list = "<table border=\"1\" cellpadding=\"2\">";
$list.="<tr><th><First Name</th>";
$list.="<th>Last Name</th>";
$list.="<th>UserName</th>";
$list.="<th>PassWord</th></tr>";

while($row= mysql_fetch_array($rs) )
{
$list .= "<tr>";
$list .= "<td>".$row["first_name"]."</td>";
$list .= "<td>".$row["last_name"]."</td>";
$list .= "<td>".$row["username"]."</td>";
$list .= "<td>".$row["password"]."</td>";
$list .= "</tr>";
}
$list .= "<\table";

echo($list);

?>
</body><html>

Link to comment
Share on other sites

Instead of:

or die("try again punk");

use

or die(mysql_error());

 

This will at least display something meaningful.

 

atleast im making some kind of progress, thanks for that, but now it said this

 

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''User Table' Where 1' at line 1

 

should i post both scripts im working with, so you have a better knowledge of what im doing?

Link to comment
Share on other sites

Im trying to set this up so ppl can input simple info, fistname,lastnight,username,password.....then i wanna store this info into mysql....and then i want to be able to pull the info that was saved and look at it.  im learning php and mysql for my business, and i want to set it up online.  im kinda new at this, and a little lost, would you like to see both scripts im working with?

 

Link to comment
Share on other sites

heres what came up when i changed the SELECT

 

Parse error: syntax error, unexpected T_STRING in /home/a3213677/public_html/workpart2.php on line 10

 

<html><head><title>I'm a GENUIS</title></head>
<body>
<?php

$conn=mysql_connect("mysql4.000webhost.com","a3213677_dolphin","hello23") or die(mysql_error());
$rs = mysql_select_db("a3213677_snorre", $conn) or die("NOOOPE");
$sql="SELECT * FROM `User Table`;
$rs=mysql_query($sql,$conn) or die(mysql_error());;

$list = "<table border=\"1\" cellpadding=\"2\">";
$list.="<tr><th><First Name</th>";
$list.="<th>Last Name</th>";
$list.="<th>UserName</th>";
$list.="<th>PassWord</th></tr>";

while($row= mysql_fetch_array($rs) )
{
$list .= "<tr>";
$list .= "<td>".$row["first_name"]."</td>";
$list .= "<td>".$row["last_name"]."</td>";
$list .= "<td>".$row["username"]."</td>";
$list .= "<td>".$row["password"]."</td>";
$list .= "</tr>";
}
$list .= "<\table";

echo($list);

?>
</body><html>

Link to comment
Share on other sites

You're talking about php syntax errors, not mysql problems.

 

 

huh its a mysql error tho

 

<html>

    <head>

        <title>Adding a User </title>

    </head>

<body>

<?php

ini_set('display_errors', '1');

error_reporting(E_ALL);

$conn = mysql_connect("mysql4.000webhost.com","a3213677_dolphin","*********")or die("Try Again Punk");

var_dump($conn);

$db = mysql_select_db("a3213677_snorre",$conn)or die("NOOPE");

 

 

$firstname = isset($_POST['firstname']) ? mysql_real_escape_string($_POST['firstname']) : '';

$lastname = isset($_POST['lastname']) ? mysql_real_escape_string($_POST['lastname']) : '';

$username = isset($_POST['username']) ? mysql_real_escape_string($_POST['username']) : '';

$password = isset($_POST['password']) ? mysql_real_escape_string($_POST['password']) : '';

 

 

if( (!$firstname) or (!$lastname) or (!$username) or (!$password) ) {

echo <<< EOS

 

Please enter all new user details

<form action="{$_SERVER['PHP_SELF']}" method="post">

First Name: <input type="text" name="firstname" value="$firstname"><br />

Last Name: <input type="text" name="lastname" value="$lastname"><br />

UserName: <input type="text" name="username" value="$username"><br />

PassWord: <input type="password" name="password"  value="$password"><br />

 

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

</form>

EOS;

}

else {

  $sql = "insert into `User Table` (`first name`,`last name`,username,password) values ('$firstname','$lastname','$username','$password')";

 

  if($result) { echo("New User $username added"); }

}

?>

</body>

</html>

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.