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

  • SEARCH
  • Home
  • 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 80527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:19:00+00:00 2026-05-10T21:19:00+00:00

I have a basic ajax application, which will not work, instead the php code

  • 0

I have a basic ajax application, which will not work, instead the php code is displayed in the browser. The javascript and html seem fine. I have copied the code verbatim from here:

http://arief.aeroven.com/2008/07/30/first-ajax-script-tutorial-connecting-ajax-contain-pure-htmlphpand-javascript-to-mysql-database/

and this is the php:

<? session_start(); //start the session $cmd = $_GET['cmd']; $con = mysql_connect('localhost', 'root', 'indosat'); if (!con) {     die('Connection to MySQL server failed: ' . mysql_error());     //show error message (mysql_error) if connection failed } mysql_select_db('ajax', $con); //select the database, in this case our database name is 'ajax' if ($cmd === 'GetEmployee') //set command value (executed from javascript ajaxlib.js) {     sleep(10);     //give delay about 10 seconds before execute the command     //we use this sleep function so we can see the loading animation     //you can edit/remove     echo '<table border='1' width='100%'>     <tr>     <th>EmpNo</th>     <th>fName</th>     <th>lName</th>     <th>Age</th>     </tr>';     //print a table to browser to show the values     $sql = 'select * from employee';     //this is query to show all records     $result = mysql_query($sql);     //execute the query & fill it to $result variable     while ($row = mysql_fetch_array($result)) {         echo '<tr>     <td>' . $row['IdEmp'] . '</td>     <td>' . $row['fName'] . '</td>     <td> ' . $row['lName'] . '</td>     <td>' . $row['Age'] . '</td>     </tr>';         //print the record to the table     }     echo '</table>';     //close the table } mysql_close($con); //close the mysql connection     ?> 

I don’t see what the problem could be

edit: it is NOT the shorttags. they are enabled, andusing ‘long’ tags makes no difference.

  • 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. 2026-05-10T21:19:00+00:00Added an answer on May 10, 2026 at 9:19 pm

    I don’t know the answer but here’s a guide on how to solve these issues:

    1. completely remove the file
      • create a new file with the same name, containing just html
      • rewrite the contents with just a <?php echo phpinfo(); ?>

    I doubt this has anything to do with PHP and believe it’s related to Apache. Are you sure you saved the file in the right place? What is your DocumentRoot directory setting and where have you saved the file? Do all of the above steps work? I doubt that you reach (3), everything works fine in the test case but the original code breaks. It’s probably got something to do with the file extension (on Linux it’s case-sensitive) or where you’ve placed the file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 121k
  • Answers 121k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer In short - no. The purpose of the Default.png is… May 12, 2026 at 12:28 am
  • Editorial Team
    Editorial Team added an answer This looks like a good article that might help. http://www.c-sharpcorner.com/uploadfile/mahesh/user-control-in-wpf/… May 12, 2026 at 12:28 am
  • Editorial Team
    Editorial Team added an answer In some respects I think this is a good idea,… May 12, 2026 at 12:28 am

Related Questions

I have an application that I am writing that modifies data on a cached
I have a rails app that has picked up a bit of traction, but
Our current Intranet environment is a little outdated. The current stack has ASP.NET 1.1/2.0
Is there any built in support in jQuery for basic assertion checking, primarily of

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.