Jump to content
xisto Community

shredder

Members
  • Content Count

    3
  • Joined

  • Last visited

  1. dont ask me. im just a php newbie. following a php book at the moment.
  2. 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);?>
  3. 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??
×
×
  • 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.