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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:08:32+00:00 2026-05-24T10:08:32+00:00

I was working with php and mysql and can’t seem to insert data into

  • 0

I was working with php and mysql and can’t seem to insert data into a database.
Here’s the error below:

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 ‘My Street’,’A00 1PQ’,”)’ at line 3

$username   = mysql_real_escape_string($_POST['username']);
 $pword      = mysql_real_escape_string($_POST['passwd']);
 $fname      = mysql_real_escape_string($_POST['firstname']);
 $lname      = mysql_real_escape_string($_POST['lastname']);
 $email      = mysql_real_escape_string($_POST['email']);
 $telephone  = mysql_real_escape_string($_POST['telephone']);
 $ad1        = mysql_real_escape_string($_POST['ad1']);
 $ad2        = mysql_real_escape_string($_POST['street']);
 $ad3        = mysql_real_escape_string($_POST['town']);
 $pcode      = mysql_real_escape_string($_POST['pcode']);


$con = mysql_connect("localhost","myuser","mypass");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("peoplesdb", $con);

//$description = mysql_real_escape_string($_POST[description]);

$sql="INSERT INTO members (username, pword, fname, lname, email, telephone, ad1, ad2, ad3, pcode, status)
VALUES
('$username','$pword','$fname', '$lname', '$email','$telephone','$ad1','$ad2,'$ad3','$pcode')";

The data on that line 3 are address3 and post code. Everything seem ok to me, but still can’t figure out what might be the problem.

  • 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-24T10:08:33+00:00Added an answer on May 24, 2026 at 10:08 am

    The output of mysql clearly shows a quoting problem and looking at this line I see a missing ‘ in your code after $ad2

    ('$username','$pword','$fname', '$lname', '$email','$telephone','$ad1','$ad2,'$ad3','$pcode')";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working in PHP/MySQL. I have a table in my database called hourly
PHP mysql database I have created a follow on question to this one here
Can a PHP script (which can be working with a MySQL DB) send and/or
I am using MySQL and PHP for a project I am working. I have
I'm currently working on a PHP application that uses a MySQL database for its
I started working with php and mysql today. Basically, what I have, is an
I am working with multiple databases in a PHP/MySQL application. I have development, testing,
I have a working PHP server. Now I want to use databases (MySQL or
I am working on a website, using PHP/MySQL, where users can upload videos, then,
I'm currently working on creating a private messaging system, (PHP/MySQL) in which users can

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.