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>

147 Like 15 Dislike
Previous php-forum Next php-forum
Other php-forum

small inaccuracies
I have this code to convert fractional base 10 into base 2:

while($num > 0)

PHP/Database issue
My friend is helping me make a database where you go to a certain webpage of my site and the page wi

how to get IP address?
hey guys,

i have this code which is supposed to get me the IP address of my site visitors:

How to replace search button with link?
hi to everbody.
i have a search submit form and button like this :

<form id="f

Writting a script to arrange images........ need some help
Ok so here is the link

http://hmtotc.com/dev/projects/vrassociates/jeweler_dev/admin/index.ph

Can php detect connection speed and thereafter swap out elements?
No code to post, lads, yet. Just looking for a yay or nay at this stage:

Can a php script be

Need help with some php code :)
Hey! I'm quite new to this whole thing, so please don't fire me with shait on this one =D

I'm

Required to login help
I'm trying to set up my site so users have to be logged into the forum to access the site.I've been

Windows 7
Windows 7 default user account control worries experts. Corporate IT departments should be pleased w

pass form variables straight to email, no database required?
hello all,

im working on this form...

http://www.adobedayevents.com/project_request/pr

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