Jump to content

wolftone

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

wolftone's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi I am new to php and mysql. I have installed apache, php5, mysql 4.something. I want to use localhost for developing and testing things locally here is the script I am using, and all I get is a blank page... When I go to cmd console, I can access mysql and update and create and all of that good stuff.  Please help. <?php // set database server access variables: $host = "localhost"; $user = "root"; $pass = ""; $db = "test"; // open connection $connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!"); // select database mysql_select_db($db) or die ("Unable to select database!"); // create query $query = "SELECT * FROM test.groc_inventory"; // execute query $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error()); // see if any rows were returned if (mysql_num_rows($result) > 0) {     // yes     // print them one after another     echo "<table cellpadding=10 border=1>";     while($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 {     // no     // print status message     echo "No rows found!"; } // free result set memory mysql_free_result($result); // close connection mysql_close($connection); ?> Thank you in advance Martin
×
×
  • Create New...

Important Information

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.