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

The Archive Base Latest Questions

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

I developed code in PHP but it’s not working. Sometimes the code works but

  • 0

I developed code in PHP but it’s not working. Sometimes the code works but most of the time not. The problem is in showing whether the password is valid or not.sorry friends i forgot to changed that but my problem with it only show invalid even i entered valid user name and password..plz help me

if(isset($_POST['submit']))
{
$con = mysql_connect("localhost","root","");
$db = mysql_select_db("billmailid", $con);
        if (!$con)
            {
        die('Could not connect: ' . mysql_error());
            }
$username=$_POST['usernameid'];
$password=$_POST['passwordid'];

$result = mysql_query("SELECT * FROM login");


$check = mysql_query("SELECT username FROM login WHERE username = '$username' && password= '$password'") ;

$check2 = mysql_num_rows($check);

if($check2==1)
  {
   echo "valid";
  }
else
  {
  echo "invalid";
  }
}
?>
  • 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-25T10:37:04+00:00Added an answer on May 25, 2026 at 10:37 am

    Well, first off all it would be great if you rephrase the question title and body, add examples, errors and in general – make it readable.

    Second in SQL || is OR and && is AND. You should probably start from there.

    Third – you should really read about SQL Injection. And I don’t mean the XKCD comics.
    In the following link you can find few examples and guidelines about how the make clear and safe query for both your database and your users

    Forth – You better not use user empty root password and defiantly not use the “root” as the website user.

    Writing save code is sometimes pain, but the sooner you start the more natural it comes. furthermore “making” application secure is much harder than building it safe.

    enter image description here

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

Sidebar

Related Questions

I'm mostly a Rails developer but sometimes, I have to code in PHP. Because
I have some code written in PHP, but I have also developed a script
i have developed a simple php contact form, that's working fine, but i am
I'm a PHP developer and now I use Notepad++ for code editing, but lately
What are PHP 5.2 settnigs which affect compatibility with old code (developed for PHP
In this case, I've developed a CSS code for this web application ..and sometimes
I have a game site developed using flash and php. The php code contains
I've developed some web-based applications till now using PHP, Python and Java. But some
I've developed a plugin that works fine on a single site WP. But when
I am good in web development but recently started using PHP and developed few

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.