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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T09:04:49+00:00 2026-06-07T09:04:49+00:00

Okay, so I have a register.php script written and I get an unexpected T

  • 0

Okay, so I have a register.php script written and I get an unexpected T Variable when the command tries to execute.
The error lies on line 15 at

('$_Post[username]','$_Post[sha_pass_hash]','$_Post[email]','2')";

I also have a second error in my syntax according to Dreamweaver at line 20 for

    die('Error: ' . mysql_error());

If anyone could help it would be greatly appreciated. Thank you in advance.

  • 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-07T09:04:50+00:00Added an answer on June 7, 2026 at 9:04 am

    STOP

    Inserting into a database directly from post is always a bad idea. This is the reason PHP is currently stuck with the very un-intuitive magic quotes.

    You should at the very least be using mysql_real_escape_string() to escape your data. For example:

    $link = mysql_connect('mysql_host', 'mysql_user', 'mysql_password')
    OR die(mysql_error());
    
    $query = "INSERT INTO users VALUES (
        '" . mysql_real_escape_string($_POST["username"]) . "',
        '" . mysql_real_escape_string($_POST["sha_pass_hash"]) . "',
        '" . mysql_real_escape_string($_POST["email"]) . "',
        '2'
    )";
    
    mysql_query($query);
    

    The reason you have to do this is security based. For example if some malicious set the username field to '); DROP TABLE users; without first escaping your data. You would end up blindly running the following query:

    INSERT INTO users VALUES (''); DROP TABLE users;
    

    Which of course isn’t going to end well for your application.

    This is the minimum you should be doing.

    In reality you should really be moving onto MySQLi Which is a much more modern MySQL interface.
    Here is an example

    $mysqli = new mysqli('mysql_host', 'mysql_user', 'mysql_password', 'mysql_database');
    
    $query = "INSERT INTO users VALUES (
        '" . $mysqli->real_escape_string($_POST["username"]) . "',
        '" . $mysqli->real_escape_string($_POST["sha_pass_hash"]) . "',
        '" . $mysqli->real_escape_string($_POST["email"]) . "',
        '2'
    )";
    
    $mysqli->query($query);
    

    You can even use MySQL in a procedural style. So if Object orientated programing isn’t with in your reach yet you will have no problems with MySQLi.

    Hope that helps.

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

Sidebar

Related Questions

Okay - I have a dilemma. So far my script converts page titles into
I have the following code which is executed from the command line: import cgi,time,os,json,sys,zipfile,urllib2
Okay I have the following problem. I want to get the current dateTime and
Okay I have this cool script I would like to bring to life, it
okay i have been trying to understand this for hours i am learning VB
Okay I have a large CRUD app that uses tabs with Forms embedded in
Okay I have a series of objects based on a base class which are
okay i have found the way to run a video in a image.... the
Okay I have updated my code quite a bit. I am getting a new
Okay I have updated my code a little, but I am still not exactly

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.