shredder 0 Report post Posted April 12, 2006 (edited) 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 April 12, 2006 by shredder (see edit history) Share this post Link to post Share on other sites
jlhaslip 4 Report post Posted April 12, 2006 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
serverph 0 Report post Posted April 12, 2006 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. Share this post Link to post Share on other sites
shredder 0 Report post Posted April 13, 2006 (edited) 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 April 13, 2006 by shredder (see edit history) Share this post Link to post Share on other sites
jlhaslip 4 Report post Posted April 13, 2006 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 parserwhile($ 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
shredder 0 Report post Posted April 13, 2006 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 parserwhile($ 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