Jump to content

MySQL and PHP


web-service-learner

Recommended Posts

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

! 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

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

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

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

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

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

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

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
Where 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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...