Page 1 of 1

Re:not able to put querystring value in mysql query

Posted: Fri Apr 08, 2011 6:46 am
by bmarur1
HI,
I have two pages
one is a login page that initially has a querystring associated with it
like www.localhost.com/qs.php?id=3
and there is a form to be filled up

the code goes like this
qs.php
<html>
<head></head>
<body>
<?php
$q = $_GET['id'];
echo $q;
?>
<form action="login.php?id=<?php echo $q;?>" method="post">
Username <input name="username" type="text"><br/>
Password <input type="password" size="25"><br/>
<input type="submit" value="login!">
</form>
</body>
</html>
and in login page i have this code
and this page will have url like this
www.localhost.com/login.php?id=3

<?php
$k = mysql_connect('localhost','root','');
if(!$k)
{
echo 'not connecting';
}
else
{
echo 'Connecting';
}
$l = mysql_select_db('oopzie');
if(!$l)
{
echo 'not connected';
}
else
{
echo 'Successfully connected to database';
}
$p = $_POST['username'];
$r = $_GET['id'];
echo "$r";
$query = 'SELECT * FROM phone where qr = "$r"';
$s = mysql_query ($query);
while ($row = mysql_fetch_array($s))
{
echo $row['phone'];
echo '<br>';
}
echo '<br>';
echo $r;
echo '<br>';
echo $p;
?>
Iam able to echo querystring but iam not able to put that in to mysql_query
database is working fine, i have checked it
but it is not able to put that querystring value into mysql_query
can you help me out pllzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz :oops: :( :( :( :( :( :(

Re: Re:not able to put querystring value in mysql query

Posted: Fri Apr 08, 2011 10:59 am
by AbraCadaver