FAQ
hi,

Can any one help find the bug of the following code for me? I am new in
MySQL and PHP, and trying to varify the user ID and password.

help is appreciated.

batu,

************


<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><title>Customer Details</title></head>
<body bgcolor="green">
<h1>Customer Details</h1>


<?php

$nickname = $HTTP_POST_VARS['nickname'];
if(empty($nickname))
echo '<br>nickname field should not be blank.';

$password = $HTTP_POST_VARS['password'];
if(empty($password))
echo '<br>password field should not be blank.';
?>

<?php

$connection=mysql_connect("localhost","csc3223","abdasa");

mysql_select_db("csc3223",$connection);


$result=mysql_query("SELECT nickname,password,status FROM Exam_Provider
WHERE (n
ickname = $nickname) and (password = $password)", $connection);


while ($row = mysql_fetch_array($result))

{
echo "you have not been approved yet";
}

mysql_close($connection);

?>


<a href="form.html"><br><br>Return to the customer form</a>
</body>
</html>

_________________________________________________________________
Watch high-quality video with fast playback at MSN Video. Free!
http://click.atdmt.com/AVE/go/onm00200365ave/direct/01/

Search Discussions

  • Electroteque at Feb 28, 2004 at 6:04 am
    well dude u never showed what the parser returned, i am pretty sure u need
    curly brackets if u are including more than one line in an if statement

    -----Original Message-----
    From: Togochog Enhebatu
    Sent: Saturday, February 28, 2004 2:53 PM
    To: mysql@lists.mysql.com
    Subject: help on PHP code


    hi,

    Can any one help find the bug of the following code for me? I am new in
    MySQL and PHP, and trying to varify the user ID and password.

    help is appreciated.

    batu,

    ************


    <!DOCTYPE HTML PUBLIC
    "-//W3C//DTD HTML 4.0 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head><title>Customer Details</title></head>
    <body bgcolor="green">
    <h1>Customer Details</h1>


    <?php

    $nickname = $HTTP_POST_VARS['nickname'];
    if(empty($nickname))
    echo '<br>nickname field should not be blank.';

    $password = $HTTP_POST_VARS['password'];
    if(empty($password))
    echo '<br>password field should not be blank.';
    ?>

    <?php

    $connection=mysql_connect("localhost","csc3223","abdasa");

    mysql_select_db("csc3223",$connection);


    $result=mysql_query("SELECT nickname,password,status FROM Exam_Provider
    WHERE (n
    ickname = $nickname) and (password = $password)", $connection);


    while ($row = mysql_fetch_array($result))

    {
    echo "you have not been approved yet";
    }

    mysql_close($connection);

    ?>


    <a href="form.html"><br><br>Return to the customer form</a>
    </body>
    </html>

    _________________________________________________________________
    Watch high-quality video with fast playback at MSN Video. Free!
    http://click.atdmt.com/AVE/go/onm00200365ave/direct/01/


    --
    MySQL General Mailing List
    For list archives: http://lists.mysql.com/mysql
    To unsubscribe:
    http://lists.mysql.com/mysql?unsub=daniel@electroteque.org
  • Nitin Mehta at Feb 28, 2004 at 7:24 am
    WHERE (nickname = '$nickname') and (password = '$password')", $connection);

    remember to place quotes around the value

    nickname = $nickname wont work but
    nickname = '$nickname' will do

    Hope that helps

    Nitin


    ----- Original Message -----
    From: "electroteque" <daniel@electroteque.org>
    To: "Togochog Enhebatu" <enhebatu@hotmail.com>; <mysql@lists.mysql.com>
    Sent: Saturday, February 28, 2004 2:54 AM
    Subject: RE: help on PHP code

    well dude u never showed what the parser returned, i am pretty sure u need
    curly brackets if u are including more than one line in an if statement

    -----Original Message-----
    From: Togochog Enhebatu
    Sent: Saturday, February 28, 2004 2:53 PM
    To: mysql@lists.mysql.com
    Subject: help on PHP code


    hi,

    Can any one help find the bug of the following code for me? I am new in
    MySQL and PHP, and trying to varify the user ID and password.

    help is appreciated.

    batu,

    ************


    <!DOCTYPE HTML PUBLIC
    "-//W3C//DTD HTML 4.0 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head><title>Customer Details</title></head>
    <body bgcolor="green">
    <h1>Customer Details</h1>


    <?php

    $nickname = $HTTP_POST_VARS['nickname'];
    if(empty($nickname))
    echo '<br>nickname field should not be blank.';

    $password = $HTTP_POST_VARS['password'];
    if(empty($password))
    echo '<br>password field should not be blank.';
    ?>

    <?php

    $connection=mysql_connect("localhost","csc3223","abdasa");

    mysql_select_db("csc3223",$connection);


    $result=mysql_query("SELECT nickname,password,status FROM Exam_Provider
    WHERE (n
    ickname = $nickname) and (password = $password)", $connection);


    while ($row = mysql_fetch_array($result))

    {
    echo "you have not been approved yet";
    }

    mysql_close($connection);

    ?>


    <a href="form.html"><br><br>Return to the customer form</a>
    </body>
    </html>

    _________________________________________________________________
    Watch high-quality video with fast playback at MSN Video. Free!
    http://click.atdmt.com/AVE/go/onm00200365ave/direct/01/


    --
    MySQL General Mailing List
    For list archives: http://lists.mysql.com/mysql
    To unsubscribe:
    http://lists.mysql.com/mysql?unsub=daniel@electroteque.org



    --
    MySQL General Mailing List
    For list archives: http://lists.mysql.com/mysql
    To unsubscribe:
    http://lists.mysql.com/mysql?unsub=nitinmehta@kappa.net.in
    >
  • James Moe at Feb 28, 2004 at 6:13 pm

    electroteque wrote:
    well dude u never showed what the parser returned, i am pretty sure u need
    curly brackets if u are including more than one line in an if statement
    well dude u r like totally wrong.

    --
    jimoe at sohnen-moe dot com

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupmysql @
categoriesmysql
postedFeb 28, '04 at 3:52a
activeFeb 28, '04 at 6:13p
posts4
users4
websitemysql.com
irc#mysql

People

Translate

site design / logo © 2021 Grokbase