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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:06:32+00:00 2026-06-09T05:06:32+00:00

I am trying to insert data into 4 tables ( asset, asset_details, invoice and

  • 0

I am trying to insert data into 4 tables ( asset, asset_details, invoice and location). When I submit the form, it tells me that all the data has been submitted successfully but when I check the MySQL database the information is only submitted to the location tables.

Any help will be appreciated, Thank you .

    mysql_query("START TRANSITION");

    $query1 =("INSERT INTO .asset (asset_tag, asset_number, cap_ex, asset_type_id, invoice_id, status) 
        Values(".$_POST['asset_tag'] .",,,".$_POST['asset_type'] . ",".$_POST['invoice_number']."," . $_POST['status_id'] .")");

    $query2 =("INSERT INTO .asset_details (asset_type_id, asset_tag, asset_type, physical_asset_id, manufacturer, os, os_version, make, model, serial_number, processor, ram, memory, hdd, host_name, notes)
        Values(" .",".$_POST['asset_tag']."," .$_POST['asset_type'].",,
        ,".$_POST['os'].",".$_POST['os_version'].",".$_POST['make'].",".$_POST['model'].",".$_POST['serial_number'].",".$_POST['processor'].",,".$_POST['memory'].",".$_POST['hdd'].",,".$_POST['notes'].")");

    $query3 =( "INSERT INTO .invoice (invoice_number, invoice_date, purchas_price, quantity, order_date, vender, warrenty_end, notes)   
        Values(" .$_POST['invoice_number'].",". $_POST['invoice_date'].",". $_POST['purchase_price'].",,,". $_POST['vender'].")");

    $query4 =( "INSERT INTO .location (location_name, rack, row, unit)
        Values(" .$_POST['location_name'].",".$_POST['rack'].",".$_POST['row'].",".$_POST['unit'].")");

    echo "$query1 $query2 $query3 $query4";


    $result1= mysql_query($query1);
    $result2= mysql_query($query2);
    $result3= mysql_query($query3);
    $result4= mysql_query($query4);

    $result = mysql_query("COMMIT");    

if (!$result)
{
    mysql_query("ROLLBACK");
    die('Invalid query: ' . mysql_error());
}
else
{
    echo "<script>alert('SUCCESS!');</script>";
}
}


mysql_close($con);
?>
  • 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-09T05:06:34+00:00Added an answer on June 9, 2026 at 5:06 am

    There are some strange things;

    • START TRANSITION should probably be START TRANSACTION.
    • You’re not quoting any of your string values. Strings need to be quoted using ' a’la INSERT INTO TEST VALUES ('olle');
    • An empty field cannot be indicated by just skipping it, you’re doing INSERT INTO TEST (a,b,c) VALUES (1,,2); which is not valid syntax for not setting b.

    Also, I recommend using a more modern mysql api than mysql_query, as for example PDO or mysqli, since injecting POST values into a string as you do can be pretty dangerous, you may cause SQL injection problems.

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

Sidebar

Related Questions

I have a form that is trying to insert some data into an SQL
I'm trying to insert the data into my database which has 2 tables Products
I am trying to select data from two tables and insert it into another
I am trying to insert the data into 'Order' , 'OrderDetails' tables at the
I am trying to insert the data into 'Order' , 'OrderDetails' tables at the
I'm trying to insert data into two tables in the database, one of the
I am trying to insert data into two different tables in the same database,
I am trying to insert data into a table in sorted order, for later
I am trying to insert some text data into a table in SQL Server
I am trying to insert a row of data into a table in SQL

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.