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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:57:41+00:00 2026-05-27T03:57:41+00:00

I am creating a login part to my web page. When a new person

  • 0

I am creating a login part to my web page. When a new person registers their details, pressing the register button goes to a register_ok part, showing below:

case 'register_ok':



if (!$_POST['client_username'] || !$_POST['client_password'] ||
     !$_POST['client_email']) {
    die('You did not fill in a required field.');
}

// check if username exists in database.

if (!get_magic_quotes_gpc()) {
    $_POST['client_username'] = addslashes($_POST['client_username']);
}

$qry = "SELECT client_username FROM client WHERE client_username = '".$_POST['client_username']."'";
$result = mysql_query($qry);
    if($result) {
        if(mysql_num_rows($result) > 0) {
    die('Sorry, the username: <strong>'.$_POST['client_username'].'</strong>'
      . ' is already taken, please pick another one.');
    }

}


// check e-mail format

if (!preg_match("/.*@.*..*/", $_POST['client_email']) ||
     preg_match("/(<|>)/", $_POST['client_email'])) {
    die('Invalid e-mail address.');
}

// no HTML tags in username, website, location, password

$_POST['client_username'] = strip_tags($_POST['client_username']);
$_POST['client_password'] = strip_tags($_POST['client_password']);



// now we can add them to the database.
// encrypt password

$_POST['client_password'] = md5($_POST['client_password']);

if (!get_magic_quotes_gpc()) {
    $_POST['client_password'] = addslashes($_POST['client_password']);
    $_POST['client_email'] = addslashes($_POST['client_email']);

}



$insert = "INSERT INTO client (
        client_username, 
        client_password, 
        client_name, 
        client_email, 
        client_last_access)

        VALUES (
        '".$_POST['client_username']."', 
        '".$_POST['client_password']."',  
        '".$_POST['client_name']."', 
        '".$_POST['client_email']."',
        'now()'
        )";

        if(!mysql_query($sql,$con)) {
            die('Error: ' . mysql_error());
        }

        else{

$id= mysql_insert_id();

session_start();


            echo '<script>alert("You May Now Login");</script>';
            echo '<meta http-equiv="Refresh" content="0;URL=pv.php">';
        }


break;
}

When I register a new person, I get the following error:

Error: Query was empty

Why is this?

  • 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-27T03:57:42+00:00Added an answer on May 27, 2026 at 3:57 am

    In the line if(!mysql_query($sql,$con)) {, do you mean $insert instead of $sql?

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

Sidebar

Related Questions

I am creating a login register page which contains two edit text boxes(one for
I am creating a login/register part to a site. And the login and register
We are new to ROR, We have issue in creating Login/Logout process in ROR
I am creating a login system for a web application using PHP. My question
I learned about $_SESSION about several weeks ago when creating a login page. I
I have just finished creating an entire login and register systsem in PHP, but
I am creating few pages (including login page) which should only be accessible by
I implemented Forms authentication by creating Default.aspx and custom login page named login.aspx .
I'm creating a 2 part log in, where the user enters their username in
For a project, I am creating a web app, in which, login will be

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.