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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:30:48+00:00 2026-06-13T11:30:48+00:00

I am creating a simple mysql database but I get the following error: Parse

  • 0

I am creating a simple mysql database but I get the following error: Parse error: syntax error, unexpected 'aasda' (T_STRING) on line: VALUES ("aasda", "sa", "asda", 43, "ada")");

Here is the code:

$con=mysql_connect("localhost","root","");

if (!$con)
{
    die ("Could not connect: " . mysql_error());
}
if (mysql_query("CREATE DATABASE my_db",$con))
  {
  echo "Database created";
  }
else
{
die("not");
}
mysql_select_db("my_db", $con);
$sql = "CREATE TABLE Users
(
username varchar(20),
firstname varchar(15),
lastname varchar(15),
age int,
emailadress varchar(20)
)";

mysql_query($sql,$con);

mysql_query("INSERT INTO Users (username, firstname, lastname, age, emailadress)
VALUES ("aasda", "sa", "asda", 43, "ada")");


mysql_close($con);

I don’t understant what I am doing wrong. Thank you for youre help and patience!

  • 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-13T11:30:49+00:00Added an answer on June 13, 2026 at 11:30 am

    use single quote

    mysql_query("INSERT INTO Users (username, firstname, lastname, age, emailadress)
                 VALUES ('aasda', 'sa', 'asda', 43, 'ada')");
    

    and one more thing, your query is vulnerable against SQL Injection, please take timet read article below to protect yourself against SQLInjection

    • How can I prevent SQL injection in PHP?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problem with creating a simple MySQL trigger in C#. I'm using StringBuilder
i am creating simple call filter application which restrict unwanted calls. i use following
Creating a simple RPG game, first time using XNA. Trying to get my character
Creating simple php login scripts is easy, with simple one table mysql integration. I
I am creating a classifieds website. Im storing all ads in mysql database, in
Im creating a simple message board with php/mysql. Users enter their name and a
I'm creating a simple app (PHP & MYSQL) that collects information about an event,
After dynamically creating a client-side table based on SELECT information retrieved from MySql database,
I've been practising php & mysql and at the moment I'm creating a simple
I have a non-Drupal site which authenticates with a simple MySQL user database. I

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.