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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:37:25+00:00 2026-05-30T13:37:25+00:00

So I have this $name = $_GET[‘fullname’]; $username = $_GET[‘username’]; $password = $_GET[‘password’]; $gender

  • 0

So I have this

$name = $_GET['fullname'];
$username = $_GET['username'];
$password = $_GET['password'];
$gender = $_GET['gender'];

$query = "INSERT INTO main (name, username, password,gender) VALUES (" . $name . "," .  $username . "," . $password . ", " . $gender . ");";

mysql_query($query) or die(mysql_error());

and I pass in the url as:
http://my.website.com/submit_user_info.php?fullname=myfullname&username=myusername&password=mypassword&gender=m

If I rewrite the $query to have hardcoded values such as VALUES (myfullname,"...etc. it works fine, but my query with the $_GETs gives me the error:

Unknown column 'myfullname' in 'field list'

Why would this be happening? How do I fix this? I don’t normally do PHP/MySQL so I’m not too familiar.

  • 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-30T13:37:27+00:00Added an answer on May 30, 2026 at 1:37 pm

    You need quotes around all the variables:

    // Sanitize with mysql_real_escape_string()
    $name = mysql_reaL_escape_string($_GET['fullname']);
    $username = mysql_reaL_escape_string($_GET['username']);
    $password = mysql_reaL_escape_string($_GET['password']);
    $gender = mysql_reaL_escape_string($_GET['gender']);
    
    // Escaped values can be interpolated in the double-quoted string.
    $query = "INSERT INTO main (name, username, password,gender) VALUES ('$name','$username','$password','$gender');";
    

    Since you are using a double-quoted string, you can simply include the variables in the string surrounded by single-quotes to be correctly interpolated, rather than concatenating them in with . Not everyone agrees with the practice of interpolating variables in double-quoted strings, but it adds a lot of readability for a case like this, and might have made it easier to debug.

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

Sidebar

Related Questions

Currently I have this: [SomeCustomAttribute] public string Name { get; set; } However, I
I have a class like this, public class person { name Name {set; get;}
I have this JavaScript: var Type = function(name) { this.name = name; }; var
I have this table : Name | money_earned _______________________ john | 100 paul |
In mysql database i have this column called: Name: Date Type: datetime I have
We have this JAXB annotation: @XmlElement(name = Strategy, required = true) protected List<Strategy> strategy;
I have this method for grabbing the file name from a string URI. What
I have a table like this: name code group john 12 smith 15 how
I have this code struct Student { char name[48]; float grade; int marks[10,5]; char
I have this class: public class UploadFile : INotifyPropertyChanged { private string name; public

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.