Re:not able to put querystring value in mysql query

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bmarur1
Forum Newbie
Posts: 1
Joined: Fri Apr 08, 2011 6:35 am

Re:not able to put querystring value in mysql query

Post 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: :( :( :( :( :( :(
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

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

Post by AbraCadaver »

mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Post Reply