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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:03:59+00:00 2026-06-07T03:03:59+00:00

I am trying to write a simple INSERT statement to add new users to

  • 0

I am trying to write a simple INSERT statement to add new users to the database and it is not working, meaning, none of the data I am trying to insert to the table gets inserted. I have been trying to troubleshoot this issue for hours now, with no success. My attempts to write the insert statements are below, and they look correct to me, so it is hard for me to troubleshoot. All columns in the insert statements exist in my table and are in that exact order. I would appreciate it if someone could advice what might be the problem.

My Connection

//Create mysql connect variable
$conn = mysql_connect('1122334455.host.com', 'john', 'password');

//kill connection if error occurs
if(!$conn){

    die('Error: Unable to connect.' . '<br>' . mysql_error());
}
//connect to mysql database
mysql_select_db("jefffffff89", $conn);

The INSERT statements that I have tried so far:

Attempt 1:

mysql_query("INSERT INTO users (id, email, company-name, city, state, phone, password, first, last)
           VALUES('','hello@gmail.com','johnnys inc','main','NY','443-333-3444','1234567','matt','williams')",$conn);

Attempt 2:

$query = "INSERT INTO users (id, email, company-name, city, state, phone, password, first, last)
               VALUES('','hello@gmail.com','johnnys inc','main','NY','443-333-3444','1234567','matt','williams')";
        mysql_query($query,$conn);

I was able to easily add a record to the following table as follows and it works just fine (so, I followed the same logic to insert above, but it does not successfully insert):

mysql_query("INSERT INTO log (log_id, txn_id, email) VALUES('','hello','world')", $conn);       
  • 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-07T03:04:00+00:00Added an answer on June 7, 2026 at 3:04 am

    One of your column names contains a hyphen:

    mysql_query("INSERT INTO users (id, email, company-name, city, ...");
    

    Assuming that’s intentional, you need to escape it with backticks:

    mysql_query("INSERT INTO users (id, email, `company-name`, city, ...");
    #                                          ^            ^
    

    However it would be better to change your column to have a name that doesn’t contain a hyphen.

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

Sidebar

Related Questions

I'm trying to write a simple stock check program, and I have a Table
Ive spent 4 hours trying to write a simple insert a datetime into a
I'm trying to do a simple write to database with an HTML form, using
Trying to simple update a row in an SQLiteDatabase Database. I can insert records
I'm new in objective-c, and I'm now trying to write a simple user-sign-in program
I am using MYSQL 5.1, I am trying to write an insert statement in
I am currently trying to simply insert a new row into my SQLite3 database
I'm trying to write simple proxy server for some purpose. In it I use
I trying to write a simple function to call unmanaged code from managed code.
I'm trying to write a simple AppleScript to do some text manipulation on the

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.