We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

PHP bug in code - assistance needed.

error77
error77 asked
on
Medium Priority
346 Views
Last Modified: 2012-05-11
Hi all,

I'm having some problem with some code.
This problem is that it's showing up on the page as text (displaying the php code as text) instead of listing the db data.

 Here is the code:

Thanks
<?php
    try
      {
       $connection = mysql_connect("localhost","username","password");
       mysql_select_db("database-name", $connection);
       $result = mysql_query("SELECT * FROM my-table");
 
      while($row = mysql_fetch_array($result))
        {
         echo "<li>";
	 echo "<h2>" . $row['date'] . "</h2>";
	 echo  . $row['textarea'] . "<p class='ui-li-aside'>" . $row['date'] . "<strong></p>";
        }
 
        mysql_close($connection);
           }
          catch(Exception $e)
             {
               echo $e->getMessage();
             }
   ?>

Open in new window

Comment
Watch Question

Commented:
PHP is running correclty?

Author

Commented:
Yes, I think it's a syntax error in the code but I haven't been about to spot it yet.
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:
I managed to sort me problem out. Solution added.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.