devang23 Posted December 7, 2009 Share Posted December 7, 2009 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> Quote Link to comment https://forums.phpfreaks.com/topic/184240-mysql-error-code/ Share on other sites More sharing options...
Mchl Posted December 7, 2009 Share Posted December 7, 2009 This means either username or password you supplied for MySQL connection is incorrect. Quote Link to comment https://forums.phpfreaks.com/topic/184240-mysql-error-code/#findComment-972666 Share on other sites More sharing options...
devang23 Posted December 7, 2009 Author Share Posted December 7, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/184240-mysql-error-code/#findComment-972667 Share on other sites More sharing options...
PFMaBiSmAd Posted December 7, 2009 Share Posted December 7, 2009 On the mysql host you are trying to connect to, the username/password does not have any access. Are you sure the host name you are using is correct for your account? Most shared web hosts have multiple mysql servers. Quote Link to comment https://forums.phpfreaks.com/topic/184240-mysql-error-code/#findComment-972671 Share on other sites More sharing options...
devang23 Posted December 7, 2009 Author Share Posted December 7, 2009 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> Quote Link to comment https://forums.phpfreaks.com/topic/184240-mysql-error-code/#findComment-972672 Share on other sites More sharing options...
Mchl Posted December 7, 2009 Share Posted December 7, 2009 Instead of: or die("try again punk"); use or die(mysql_error()); This will at least display something meaningful. Quote Link to comment https://forums.phpfreaks.com/topic/184240-mysql-error-code/#findComment-972675 Share on other sites More sharing options...
devang23 Posted December 7, 2009 Author Share Posted December 7, 2009 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? Quote Link to comment https://forums.phpfreaks.com/topic/184240-mysql-error-code/#findComment-972678 Share on other sites More sharing options...
Mchl Posted December 7, 2009 Share Posted December 7, 2009 select * from User Table What are you trying to do with this? If table is called User Table (bad idea to have spaces in tablenames) it should be SELECT * FROM `User Table` Quote Link to comment https://forums.phpfreaks.com/topic/184240-mysql-error-code/#findComment-972690 Share on other sites More sharing options...
devang23 Posted December 7, 2009 Author Share Posted December 7, 2009 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? Quote Link to comment https://forums.phpfreaks.com/topic/184240-mysql-error-code/#findComment-972692 Share on other sites More sharing options...
devang23 Posted December 7, 2009 Author Share Posted December 7, 2009 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> Quote Link to comment https://forums.phpfreaks.com/topic/184240-mysql-error-code/#findComment-972696 Share on other sites More sharing options...
Mchl Posted December 7, 2009 Share Posted December 7, 2009 You're missing a " here $sql="SELECT * FROM `User Table`; Quote Link to comment https://forums.phpfreaks.com/topic/184240-mysql-error-code/#findComment-972702 Share on other sites More sharing options...
devang23 Posted December 7, 2009 Author Share Posted December 7, 2009 You're missing a " here $sql="SELECT * FROM `User Table`; i tried that it didnt do anything, still says i got osmething wrong in line 10(t_variable) Quote Link to comment https://forums.phpfreaks.com/topic/184240-mysql-error-code/#findComment-972708 Share on other sites More sharing options...
fenway Posted December 9, 2009 Share Posted December 9, 2009 You're talking about php syntax errors, not mysql problems. Quote Link to comment https://forums.phpfreaks.com/topic/184240-mysql-error-code/#findComment-974323 Share on other sites More sharing options...
devang23 Posted December 9, 2009 Author Share Posted December 9, 2009 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> Quote Link to comment https://forums.phpfreaks.com/topic/184240-mysql-error-code/#findComment-974393 Share on other sites More sharing options...
devang23 Posted December 9, 2009 Author Share Posted December 9, 2009 resource(5) of type (mysql link) Quote Link to comment https://forums.phpfreaks.com/topic/184240-mysql-error-code/#findComment-974394 Share on other sites More sharing options...
Mchl Posted December 9, 2009 Share Posted December 9, 2009 So what? That's what it's supposed to be. Quote Link to comment https://forums.phpfreaks.com/topic/184240-mysql-error-code/#findComment-974403 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.