Code doesn't print what i wanted it too. Please help!


Posted on 16th Feb 2014 07:03 pm by admin

Hi there,

I wrote this code to mae it so that in the form before it that the user said their username and then on this page it matches up the username with the username on the database and then uses the password of that users as $password. I am new to php and i thought that this would do the trick. But it doesn't. Instead of printing the password it prints "Resource id #6".

Here's the code:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Radio Ilam | Radio of the Suburbs</title><meta name="keywords" content="music note, free template, website template, CSS, XHTML" /><meta name="description" content="Music Note - free CSS template provided by templatemo.com" /><link href="templatemo_style.css" rel="stylesheet" type="text/css" /><style type="text/css">
.style1 {
text-align: center;
}
.style2 {
font-weight: bold;
color: #C32929;
}
.style3 {color: #FF0000}

td {padding: 2px; vertical-align:top; border-top: 1px solid #CCC;}
</style></head>

<body>










<?php
// Connects to your Database
mysql_connect("removed", "removed", "removed") or die(mysql_error());
mysql_select_db("a1408362_data") or die(mysql_error());


//checks cookies to make sure they are logged in
if(isset($_COOKIE['ID_my_site']))
{
}
$username = $_COOKIE['ID_my_site'];

if ($username <> "administrator")


{ header("Location: members.php");
}

else {}

?>









<div id="templatemo_container_wrapper">
<div id="templatemo_container">
<div id="templatemo_header">
<div id="templatemo_site_title">Radio<span class="style2">Ilam</span></div>
<div id="templatemo_site_slogan">Radio of the Suburbs</div>
</div>

<div id="templatemo_menuleft"></div>
<div id="templatemo_menu">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="competitions.php">Competitions</a></li>
<li><a href="#">Lates Music</a></li>
<li><a href="#" class="current">Members</a></li>
<li><a href="#">Listen Live</a></li>
<li><a href="#">Contact Us</a></li>
</ul>
</div>

<div id="templatemo_content">
<div id="templatemo_left_column">
<div class="templatemo_section2">
<h1>Administrator</h1>
<p>Welcome

<p><a href="logout.php">Logout</a></p>
</div>
<br />
&nbsp;
</div>

<div id="templatemo_right_column">

<?php

$username = $_REQUEST['catergory'] ;

$password = mysql_query("SELECT password FROM users WHERE username = '$username'");

echo "$password"

?>

<h1>User</h1>

<p>





</p>
</div>
</div>
<div id="templatemo_footer">Copyright © 2009 RadioIlam<a href="#"></a></div>

</div>
</div>
</body>
</html>

No comments posted yet

Your Answer:

Login to answer
147 Like 15 Dislike
Previous forums Next forums
Other forums

Problem in OnClientClick and OnClick sync
Hi,Strange and irritating problem: I have below button declaration in markup of the aspx page:

Results from Db outputted twice
Hey guys.. for come reason my data is outputted twise shown in the image below and i cant figure out

my login script page is not working on remote computers
hi my login is working on my computer, but when i tried 2 computers from 2 different locations, they

Run function every 5 mins ??
I have a function PostMessage()

How can I run it every 5 mins ??

Sending CC Info by email
I am a little bit less knowledgable in the security area as most developers and I know I have a lot

help with mysql_error()
Hi,

I am trying to insert data into a table, but I am not able to insert it. I wanted to see

Call db table from any PHP file
Hi,

I want to be able to call a database table that will be setup in another file called init

If a record matches an existing record do nothing
So I don't know if I should put this here or in mysql, but what my script is for is for people to ad

Help! refer to a friend script with captcha code
Hi guys, I am posting on here in desperate need for some help with an ongoing search I have been doi

Update Database
Hi All,


I have a problem with this:

Code: [Select]<?php
session_start();

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash