Jump to content
xisto Community
Sign in to follow this  
shredder

Permissions?

Recommended Posts

hi guys ive set up a db through phpadmin and and have created a php script which should connect and upload data from the db. ive uploaded the script into my file transfer folder.The problem being is when i run my site, i recieve this message""You don't have permission to access / on this server."Any ideas??

Edited by shredder (see edit history)

Share this post


Link to post
Share on other sites

Yes, somewhere in the script you are referencing a file which is stored at the root folder as indicated by the slash '/' and you do not have permission to do that on the Xisto server. Probably was okay on the local machine used to write and test the script,but the reference will have to be re-written for the trap.Of course, I could be wrong...

Share this post


Link to post
Share on other sites

check MySQL databases from your cpanel, and properly grant permissions to a valid existing MySQL user. this is mostly missed oftentimes, and unless proper permission is given to the user you have in your script configuration, you'll end up with errors of this kind. :angry:

Share this post


Link to post
Share on other sites

ok. heres my php script at the moment. Obviously i will need to change my username and password back when running the script.

can you see any error with the connection request??

<?php// open connection to MySQL server$connection = mysql_ connect('localhost', 'username', 'password') ~or die ('Unable to connect!');// select database for usemysql_ select_ db('db_name') or die ('Unable to select database!');// create and execute query$query = 'SELECT * FROM Bars';$result = mysql_ query($ query) ~or die ('Error in query: $query. ' . mysql_ error());// check if records were returnedif (mysql_ num_ rows($ result) > 0){// print HTML tableecho '<table width= 100% cellpadding= 10 cellspacing= 0 border= 1>';echo'<tr>< td>< b> ID</ b></ td>< td>< b> Name</ b></ td>< td>< b> Price</ b></ td></ tr>';// iterate over record set// print each fieldwhile($ row = mysql_ fetch_ row($ result)){echo '<tr>';echo '<td>' . $row[ 0] . '</td>';echo '<td>' . $row[ 1] . '</td>';echo '<td>' . $row[ 2] . '</td>';echo '</tr>';}echo '</table>';}else{// print error messageecho 'No rows found!';}// once processing is complete// free result setmysql_ free_ result($ result);// close connection to MySQL servermysql_ close($ connection);?>

Edited by shredder (see edit history)

Share this post


Link to post
Share on other sites

Nothing to do with the problem posted, but what's with the tilde at the end of this line?

$connection = mysql_ connect('localhost', 'username', 'password') ~or die ('Unable to connect!');

And the spaces in the variable names aren't going to go well with the php parser
while($ row = mysql_ fetch_ row($ result))$result = mysql_ query($ query) ~ // another tilde chaacter here???if (mysql_ num_ rows($ result) > 0)

Share this post


Link to post
Share on other sites

Nothing to do with the problem posted, but what's with the tilde at the end of this line?

$connection = mysql_ connect('localhost', 'username', 'password') ~or die ('Unable to connect!');

And the spaces in the variable names aren't going to go well with the php parser
while($ row = mysql_ fetch_ row($ result))$result = mysql_ query($ query) ~ // another tilde chaacter here???if (mysql_ num_ rows($ result) > 0)

dont ask me. im just a php newbie. following a php book at the moment.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.