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 6151061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:42:54+00:00 2026-05-23T19:42:54+00:00

I installed MAMP on my mac to run sql and apache server on my

  • 0

I installed MAMP on my mac to run sql and apache server on my local machine to host a website i am working on. Now i am using phpmyadmin to control and create my database tables. I am running into a couple of issues with inserting values into the tables. I have two pages namely, test.html and test.php. test.html has a form with username and password and it calls a javascript to post the values to test.php.Following is code snippet of how i am posting the value on test.html.

$.post("test1.php",
 {
 username: username,
     password: password

  },
 function( dataFromServer ){
     alert(dataFromServer);     
 }
);

I am unable to insert the two values in the table. When i click submit, i receive the following error in firefox:

POST http://localhost:8888//test1.php
500 Internal Server Error

Following is code snippet of how i insert values on test.php:

include('config.php');
$tbl_name="table1";
$username=$_POST['username'];
$password=$_POST['password'];

$sql="INSERT INTO $tbl_name(col1,col2)VALUES('$username','$password')";
$result=mysql_query($sql);

Can anybody point the mistake here. I am new to web coding so this might be really trivial.

Thanks,
-B

  • 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-05-23T19:42:55+00:00Added an answer on May 23, 2026 at 7:42 pm

    500 internal error means there is something wrong in your php file.
    Check the following things

    1.Is there any syntax error in your php file.

    2.

    $sql="INSERT INTO $tbl_name(col1,col2)VALUES('$username','$password')"; 
    

    should be written as

    $sql ="INSERT INTO $tbl_name(col1,col2)VALUES('".$username."','".$password."')";
    

    Also,always sanitize data before you use it.

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

Sidebar

Related Questions

I setup a local website using mamp, there are other sites I run in
I'm working on Mac 10.6.6. with php 5.3 installed with MAMP. I've run into
I recently installed MAMP version 1.6 on my MAC OS 10.5.7. Now I am
I've installed MAMP on my Mac. Then, I put my website into the htdocs
Well, I have MAMP installed on my Mac OS X, and I've got PostGres
hi i am using mac osx with mamp and i was wondering how i
I have MySQL installed (MAMP, Mac OS X) but need to call it by
I have MAMP installed in my Applications folder on my Mac, and the project
I always used MAMP with a Mac, so mysql was already installed in it.
I have Codeigniter and Ion Auth installed on MAMP. I have the libraries working

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.