# Loging in not working!

**URL:** <https://forum.kirupa.com/t/loging-in-not-working/281351>\
**Category:** programming\
**Created:** [February 8, 2009, 5:56am UTC](https://forum.kirupa.com/t/loging-in-not-working/281351 "2009-02-08T05:56:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![drummer392](https://avatars.discourse-cdn.com/v4/letter/d/45deac/32.png) [@drummer392](https://forum.kirupa.com/u/drummer392)\
**Post date:** [February 8, 2009, 5:56am UTC](https://forum.kirupa.com/t/loging-in-not-working/281351/1 "2009-02-08T05:56:12Z")

</div>

I have tried like 3 people’s code (well one from me, and 2 others) and they are all basically the same and they all are working fine except that when I tried to log in it won’t work, it just goes straight to the error bad login. So here is my code, see if you can find the problem:

```php
<?php
$username = "hjkhjk";
$password = "hjkhjk";
$database = "hjkhjk";
$hostname = "hjkhjk"; 

//connection to the database
$handle = mysql_connect($hostname, $username, $password, $database)
 or die("");
echo "";

//select a database to work with
$selected = mysql_select_db("hjkhjk",$handle)
  or die("Could not select dhjkhj");

session_start();
$username = $_POST[‘username’];
$password = md5($_POST[‘password’]);

$query = “select * from users where username=’$username’ and password=’$password’”;

$result = mysql_query($query);

if (mysql_num_rows($result) != 1) {
$error = “Bad Login”;
    include “login.html”;

} else {
    $_SESSION[‘username’] = “$username”;
    include “memberspage.php”;
}

?>

```
