Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8301101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:49:03+00:00 2026-06-08T16:49:03+00:00

I just set up a new Ubuntu 12.04 LTS 64-bit server, picking whatever package

  • 0

I just set up a new Ubuntu 12.04 LTS 64-bit server, picking whatever package for Apache it came with. I’m trying to open this index.html file in my browser:

<html><body><h1>Testing Database</h1>

<?php

$con=mysql_connect("localhost","****","****");
if(!$con) {die('Could not connect: ' . mysql_error());

mysql_select_db("Test", $con);
$result=mysql_query("SELECT * FROM main");
while($row=mysql_fetch_array($result))
{
   echo $row['id'] . " " . $row['name'];
   echo "<br />";
}

mysql_close($con);
?>

</body></html>

I had created a database and table in MySQL. I made a phpinfo.php file (containing <?php phpinfo(); ?>) that ran just fine. But for some reason, Internet Explorer only shows the title [Testing Database], and Chrome shows just the title, plus:

"; } mysql_close($con); ?>

I’m following a tutorial here, is there something wrong with my setup? I feel like I’m missing some sort of parenthesis in this tiny chunk of code, but cannot find it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T16:49:04+00:00Added an answer on June 8, 2026 at 4:49 pm

    index.html?

    .html pages won’t parse as PHP, you need to have the .php extention, or use some htaccess to force it through the PHP parser.

    Other than that, there was a syntax error in your file, change to:

    <html><body><h1>Testing Database</h1>
    
    <?php
    
    $con=mysql_connect("localhost","****","****");
    if(!$con) die('Could not connect: ' . mysql_error());
    
    mysql_select_db("Test", $con);
    $result=mysql_query("SELECT * FROM main");
    while($row=mysql_fetch_array($result))
    {
       echo $row['id'] . " " . $row['name'];
       echo "<br />";
    }
    
    mysql_close($con);
    ?>
    
    </body></html>
    

    notice the removal of the { from this line:

    if(!$con) { die('Could not connect: ' . mysql_error());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm setting up a new Ubuntu server running nginx, and I'm trying to run
I just set up a new LAMP server. I can connect to mysql through
I'm new to Linux and especially to Ubuntu 11 which I'm just trying today
I just set up a new MySQL 5.1 Database Server on a Windows XP
I've just set up a new build server with the Windows 2008 .NET 3.5
I have just set up a new Eclipse Java project. In this project I
So i have just set new Error Handlers in httpd.conf for custom error pages:
I'm fairly new to WebService developement and have just set up my own webservice
I've just created a new view based application, and now I want to set
I'm kinda new to GitHub, and I just created my account and set it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.