Forum Moderators: coopster

Message Too Old, No Replies

Parse error: syntax error, unexpected

         

anees_a

4:36 pm on Aug 9, 2008 (gmt 0)

10+ Year Member



hi

I was moving my website to my new hosting server after copping all the files when i tried to acess my website i get ths error
Parse error: syntax error, unexpected $end in /home/the/public_html/Connections/rs.php on line 10

I found that the programer had programed 1st line of index.php file to access mysql database the the file use to access was called rs.php bellow are the contents of the file

<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_rs = "ServerIP";
$database_rs = "Database";
$username_rs = "User";
$password_rs = "Password;
$rs = mysql_pconnect($hostname_rs, $username_rs, $password_rs) or trigger_error(mysql_error(),E_USER_ERROR);
?>

thanks inadvance

cameraman

8:02 pm on Aug 9, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld, anees_a.

You're missing a double quote here:
$password_rs = "Password;

should be:
$password_rs = "Password";

anees_a

4:49 am on Aug 10, 2008 (gmt 0)

10+ Year Member



hi cameraman

as suggested by u i inserted the quotes now i am getting

Warning: mysql_pconnect() [function.mysql-pconnect]: Access denied for user 'username'@'server' (using password: YES) in /home/the/public_html/Connections/rs.php on line 9

Fatal error: Access denied for user 'username'@'server' (using password: YES) in /home/the/public_html/Connections/rs.php on line 9

the user has assigned all privileges to the database

cameraman

7:02 am on Aug 10, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That means your user name and/or password are incorrect.

anees_a

7:33 am on Aug 10, 2008 (gmt 0)

10+ Year Member



i have cpanel interface for my web hosting provider and in cpaneli have created user and asigned it to the database with all privillages. the user name displayed is something line user_user the first part is my cpanel login and the second part is db user, i have tried user and user_user still i get this error when contacted the hosting provider says

"You should create a database user and grant permissions from the MySQL section and then use that username (exactly as it appears in cpanel prefixed by your cpanel username) and password in your code and not your cpanel login / password.

Also, do not use pconnect (persistent connections) in your code"

i have PHPmyAdmin to acess the database and basically i am not a programmer yet understand the basics ths was programed bymy programmer wo is not with us any more i dont haveany other programer hence i dont know how do i do it if u can provide any help ie if u can give me the querry to run i can do it

cameraman

4:58 pm on Aug 10, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



use that username (exactly as it appears in cpanel prefixed by your cpanel username)
That's telling you to use user_user. You should also use user_databasename.

Also, do not use pconnect
That's telling you to not use the function that you're using here:
$rs = mysql_pconnect($hostname_rs, $username_rs, $password_rs)

instead use mysql_connect (take the p out)

Not being able to use persistent connections may affect the other scripts that your programmer wrote for you; it depends on how they're written - they may all make a connection, meaning worst case you might have to change a bunch of mysql_pconnect calls, but hopefully, given this script's name, this is the only place the connection is made.