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:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""><html xmlns=""><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" /><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;}


// 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
$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 id="templatemo_menuleft"></div>
<div id="templatemo_menu">
<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>

<div id="templatemo_content">
<div id="templatemo_left_column">
<div class="templatemo_section2">

<p><a href="logout.php">Logout</a></p>
<br />

<div id="templatemo_right_column">


$username = $_REQUEST['catergory'] ;

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

echo "$password"




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


No comments posted yet

Your Answer:

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

php code generators

Whilst enjoying learning a new language i have come accross a number of free code generat

Select Rows as Columns..
is there a way to select COLUMN_NAME from user_tab_columns where table_name='TABLENAME';
and ha

Calling All PHPFREAKS Blackberry Users
Are you a member of PHPFreaks and have a blackberry? Well RIM just recently released Blackberry Mes

Displaying a record from mysql in a simple swf file

I have a mysql database containing information I would like to display in my swf.

Socket Server Response Headers
Earlier I had a post about my Socket Server, I wasn't able to get it to connect, now I can


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