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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:27:26+00:00 2026-06-11T14:27:26+00:00

So i have php code to insert form data in a table. Here’s the

  • 0

So i have php code to insert form data in a table. Here’s the code:

$link = @mysql_connect("***", "***", "****");
if (!$link) {
 echo "save_failed";
 return; 
}
mysql_select_db("***", $link);

$sql="INSERT INTO Conference (`First Name`, `Last Name`)
VALUES ('$_POST[fname]', '$_POST[lname]')";

mysql_close($link);

The *** are replaced with the actual values in the real code, obviously. But is there anything wrong with the above code? I tried to run it, it didn’t have any errors with connection but it also didn’t insert anything. Here’s is what my mysql table looks like:
Mysql table

Also, I need the table to have an auto incremented number so that each entry is unique with it’s own index value. Any ideas on either problem? Thanks

  • 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-11T14:27:27+00:00Added an answer on June 11, 2026 at 2:27 pm

    You haven’t executed the query, which should be done as it follows:

    mysql_query($sql, $link);
    

    Also, please consider using mysqli or even better PDO as the mysql package is deprecated (see the red box), i.e. mysql_query().

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

Sidebar

Related Questions

Here my code, I need to insert into mysql database I have mysql,php,android 1)
I have an input form for a sample php. <form action=insert.php method=post> <table> <tr>
In my cakephp form I have following code <p> <?php echo $form->input('option[]',array('size'=>13)); ?> </p>
I have PHP code which connects to MySql and encodes data to JSON. Later
I have some PHP code that generates dynamic tables of data on the fly.
I have to post a value via form post and insert it into table,
I have some (php) code that performs critical updates on an InnoDB table. I'm
I have php code that puts some values into an Array as follows: $hunter=addslashes($MessageArray[1]);
I have a php code like this,and I need to convert it to .NET
I have this PHP code to highlight the Query on search results. if (isset($_REQUEST['k'])){

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.