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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:22:49+00:00 2026-05-31T04:22:49+00:00

I am trying to insert emails into a MYSQL table, and I am getting

  • 0

I am trying to insert emails into a MYSQL table, and I am getting an error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘ 19, ‘blah@gmail.com’)’ at line 1

I’ve looked over the internet, and tried different combinations of collations and codes, but nothing will work. Is the ‘@’ the problem here? I am getting this email address from decoding Facebook’s JSON user object. Here are snippets from my code:

$user = json_decode(file_get_contents($jsonurl));
$userid = $user->id;
if($user->gender == "male") $usergender = TRUE;
else $usergender = FALSE;
$useremail = $user->email;

mysql_select_db("kirkstat", $con);
$result = mysql_query("INSERT INTO table (id, access, gender, age, email) VALUES ($userid, '$access_token', $usergender, 19, '$useremail')");
if (!$result){
    echo("error.\n");
    die('Invalid query: ' . mysql_error());
}

id is a bigint, access is a varchar, gender is a binary, age is an int, and email is a varchar.

Thanks for your help!

  • 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-31T04:22:50+00:00Added an answer on May 31, 2026 at 4:22 am

    false casts as a string to an empty string. An empty string is not valid in SQL for an integer column (or a column value of any kind since it won’t have a ” either).

    Instead of false/true use 0/1.

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

Sidebar

Related Questions

I'm trying to INSERT INTO a mySQL database and I'm getting this error on:
Ok, when trying to insert into the database I'm getting this error You have
Am trying to insert XML into XML Column.. getting following error: . Msg 6819,
I'm getting this error when trying to insert data from a form into a
I'm trying to make this information insert into my table in mysql database with
I am facing a really weird error,while trying to insert into a table called
I am trying to INSERT INTO a table using the input from another table.
Hi I'm trying to submit a webform and insert the data into mysql. The
I'm trying to insert some data into a table with shell_exec (on localhost). Here's
I'm trying to insert information into multiple tables within a database, i have managed

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.