enay Posted November 20, 2009 Share Posted November 20, 2009 Hi, I'm new to php, and have copied an execise codes from a tutorial web page. I cannot get the code to run successfully. I don't understand the error and would greatly appreciate any help I can get. here are the tutorial codes that I copied but slight modified to my environment. =================================================================== html> <head> <basefont face="Arial"> </head> <body> <?php // set database server access variables: $host = "localhost"; $user = "root"; $pass = "password"; $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 testdb"; // 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); ?> </body> </html> ======================================================================= This is the output that I received from the on the web page; ============================================== "; while($row = mysql_fetch_row($result)) { echo ""; echo "".$row[0].""; echo "" . $row[1].""; echo "".$row[2].""; echo ""; } echo ""; } else { // no // print status message echo "No rows found!"; } // free result set memory mysql_free_result($result); // close connection mysql_close($connection); ?> ================================================= Systems installed; Windows XP with IIS 6 php 5.3 mysql ================== The Db is set up correctly with data and I can verify this in MySQL. Can someone please help me? Eam Quote Link to comment https://forums.phpfreaks.com/topic/182236-understanding-error-from-the-code/ Share on other sites More sharing options...
taquitosensei Posted November 20, 2009 Share Posted November 20, 2009 IIS is not setup to parse php so instead of actually doing something with it it just spits it out as text. Here's a site looks like it does a pretty good job walking you through getting it configured http://www.plus2net.com/php_tutorial/php_iis_installation.php Quote Link to comment https://forums.phpfreaks.com/topic/182236-understanding-error-from-the-code/#findComment-961625 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.