troubleshooting Question

Retrieving SQL Data via HTML

Avatar of Hollie18502
Hollie18502 asked on
Microsoft SQL ServerHTMLPHP
7 Comments1 Solution418 ViewsLast Modified:
I am trying to create a table by retrieving data from sql table via html page.  this is what i am using... could you please tell me what's wrong?

      <title>Retrieve data from database </title>

      // Connect to database server
      mysql_connect("livp3qtm01", "userid", "password") or die (mysql_error ());

      // Select database
      mysql_select_db("dept225") or die(mysql_error());

      // SQL query
      $strSQL = "SELECT director FROM auditplanitems";

      // Execute the query (the recordset $rs contains the result)
      $rs = mysql_query($strSQL);
      // Loop the recordset $rs
      // Each row will be made into an array ($row) using mysql_fetch_array
      while($row = mysql_fetch_array($rs)) {

         // Write the value of the column FirstName (which is now in the array $row)
        echo $row['director'] . "<br />";


      // Close the database connection
Randy Downs

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros