web-service-learner Posted July 19, 2008 Share Posted July 19, 2008 Hi guys,So glad im , I know how copy and paste php codes now, not only that I know how to modify them , lol,,,,,, I just downloaded a code to test the mysql server I keep getting an error message says>>> Parse error: syntax error, unexpected T_ECHO in /home/aust3e7e/public_html/test.php on line 9the code is <?php$username = "aust3e7e_admin";$password = "p24ppmnbr7d5";$hostname = "http://www.australian-adscom.com"; //connection to the database$dbhandle = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL");echo "Connected to MySQL<br>";?> thank you Link to comment Share on other sites More sharing options...
Synook Posted July 19, 2008 Share Posted July 19, 2008 ! Don't post passwords in public places :)After testing, though, those details don't get me in. Pity... :)But I don't get the error. Umm... weird, I don't see anything in that code to mess up the script. Try copying it again (from this page), there may be strange characters lurking in there. Link to comment Share on other sites More sharing options...
web-service-learner Posted July 19, 2008 Author Share Posted July 19, 2008 You sure you couldn't get innnnnnnnnn? Its an empty data base anyway. Are you serious nothing wrong with code itself?Please don't ask me to copy and paste the code again, its a damn hard work.Im going to change the password b4 you hack the db mmmmmmm. Link to comment Share on other sites More sharing options...
Synook Posted July 19, 2008 Share Posted July 19, 2008 There is nothing visibly wrong with the code. However, there may be characters that look valid but are actually different. For example, one of the spaces may actually be a non-breaking space, which PHP won't recognise. This isn't probably the case as it doesn't say unexpected T_CHARACTER. But something similar...Did you try re-copying? And is that all the code? Link to comment Share on other sites More sharing options...
web-service-learner Posted July 19, 2008 Author Share Posted July 19, 2008 i didn't try to re copy the code, but i tried the localhost instead of the whole address.didn't work still.yes this all the code Link to comment Share on other sites More sharing options...
web-service-learner Posted July 19, 2008 Author Share Posted July 19, 2008 i just looked at the code again, look at the html <br> tag and its php thing is that ok? <?php$username = "aust3e7e_admin";$password = "yc1rngvn7c12.";$hostname = "localhost"; //connection to the database$dbhandle = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL");echo "Connected to MySQL<br>";?> Link to comment Share on other sites More sharing options...
Synook Posted July 19, 2008 Share Posted July 19, 2008 The break tag is quoted, then the quote ends and there is a line delimiter (, then the block ends. So it is fine. Link to comment Share on other sites More sharing options...
kingsend84 Posted July 19, 2008 Share Posted July 19, 2008 Try this.. <?php$username = "aust3e7e_admin";$password = "yc1rngvn7c12.";$hostname = "localhost";//connection to the database$dbhandle = mysql_connect($hostname, $username, $password);if(!$dbhandle){die("Unable to connect to MySQL");}echo 'Connected to MySQL<br>';?> Link to comment Share on other sites More sharing options...
just-gal Posted July 19, 2008 Share Posted July 19, 2008 use PRINT Link to comment Share on other sites More sharing options...
Synook Posted July 20, 2008 Share Posted July 20, 2008 lol Link to comment Share on other sites More sharing options...
web-service-learner Posted July 20, 2008 Author Share Posted July 20, 2008 thanks mate i tried this i got the error message >>>Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'aust3e7e_admin'@'localhost' (using password: YES) in /home/aust3e7e/public_html/test2.php on line 7Unable to connect to MySQL Try this..<?php$username = "aust3e7e_admin";$password = "yc1rngvn7c12.";$hostname = "localhost";//connection to the database$dbhandle = mysql_connect($hostname, $username, $password);if(!$dbhandle){die("Unable to connect to MySQL");}echo 'Connected to MySQL<br>';?> Link to comment Share on other sites More sharing options...
web-service-learner Posted July 20, 2008 Author Share Posted July 20, 2008 Well guys I got a question here, m I still able to use the mysql data base even with getting that error message? should I give it a try for example create new tables etc?. Link to comment Share on other sites More sharing options...
Synook Posted July 20, 2008 Share Posted July 20, 2008 No. After all, if your access is denied, how are you going to, well, access the database? :)It means the username, password or host is wrong. You probably just copied down something incorrectly - ask the host for them again or use your control panel. Link to comment Share on other sites More sharing options...
web-service-learner Posted July 20, 2008 Author Share Posted July 20, 2008 well synook your still awake that good mate, just to let you know i created that user (admin) and the password, does that make sence? but for some reason the cpanel added aust3e7e to the user name, what else should i do? do i still have to ask the host! Link to comment Share on other sites More sharing options...
destrugter Posted July 20, 2008 Share Posted July 20, 2008 Try replacing "localhost" with "mysql" that should solve your problem. Link to comment Share on other sites More sharing options...
web-service-learner Posted July 21, 2008 Author Share Posted July 21, 2008 thanks, but still the same error , Link to comment Share on other sites More sharing options...
kingsend84 Posted July 21, 2008 Share Posted July 21, 2008 thanks mate i tried this i got the error message >>>Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'aust3e7e_admin'@'localhost' (using password: YES) in /home/aust3e7e/public_html/test2.php on line 7Unable to connect to MySQLWhere I put $hostname = "localhost" you have to change it to your hosting server if you are not trying to connect to a local host. It’s the login information to Mysql that’s wrong but the code works fine, also check the password & username. Link to comment Share on other sites More sharing options...
web-service-learner Posted July 21, 2008 Author Share Posted July 21, 2008 new error now>>>Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'admin'@'75.127.108.206' (using password: YES) in /home/aust3e7e/public_html/test2.php on line 7Unable to connect to MySQLwell user name can't be wrong i created this user my self with full permission >> aust3e7e_adminpassword can't be wrong either i copy and paste it as it is.im not sure of the host name is it the same as mysql account is it aust3e7e_admin i tried that didn't wrok.is the host name australian-adscom.com ? which is my hosting account should i ask my hosting company what the mysql server name?thanks alot Link to comment Share on other sites More sharing options...
web-service-learner Posted July 21, 2008 Author Share Posted July 21, 2008 well it worked, finally thanks alot guys it was my fault with the user mame Link to comment Share on other sites More sharing options...
web-service-learner Posted July 21, 2008 Author Share Posted July 21, 2008 well rub was alright, he said check the user name and password. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.