For Programmers: Free Programming Magazines  


Home > Archive > PHP SQL > April 2004 > Re: Help needed









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Help needed
Noel Dolan

2004-04-20, 10:42 am

Seems to be a few things wrong...

1. On your "<form..." line try the following...
<form method=post action="<?php echo $_SERVER['PHP_SELF'];?>">

2. On your "if (row["password"]==password) {..." line you've got an extra
unnecessary brace "{", same
at end of "if" statement, extra closing brace "}".

3. On line beginning print("<a href= "index.php ", you've got double quotes
within double quotes...
Try this instead...
print("<a href=index.php style='font-family: Verdana, Arial,
Helvetica,sans-serif; font-size: 10px; color: #000000;'> Click here to
finish logingin!</a> ");

Hope this helps...


Noel.

"unklematt" <matt@unklematt-dot-com.no-spam.invalid> wrote in message
news:tKSdnWMUiuzo1RndRVn_vQ@giganews.com...
> Please could you point out where I am going wrong with this script,
>
> I have this code:
>
>
> --------
>
>
>
> <form method=post action="<?echo
> PHP_SELF?>">
> <table cellpadding=2 cellspacing=0 border=0>
> <td>Username:</td><td><input
> type="text" name="username"
> size=10></td><tr>
> <td>Password:</td><td><input
> type="password" name="password"
> size=10></td><tr>
> <td> </td><td><input
> type="submit" name="submit" value="Log
> In"></td>
> </table></form>
>
> <?php
> server = "localhost";
> db_user = "#######";
> db_pass = "#######";
> database = "###";
>
> db = mysql_connect("server",
> "db_user","db_pass")
> or die("Count not connect to database");
>
> mysql_select_db("database",db) or die
> ("cant change");
>
> result=mysql_query("select * from user where
> name='username'",db) or die
> ("cant do it");
> while (row=mysql_fetch_array(result)) {
> if (row["password"]==password) {
> {
> setcookie("name","name",time()+3600);
>
> print("<a href= "index.php "
> style= "font-family: Verdana, Arial,
> Helvetica,
> sans-serif; font-size: 10px; color:
> #000000; ">Click here to
> finish loging
> in!</a> ");
>
> }
> }
> }
>
> ?>
>
>
> --------
>
>
>
> The input box works
> fine but nothing else seems to. Any help advice
> you can give will be
> greatfully accepted.
> Thnx
>
>
>
> ----------------------------------------
> The post originated from PHP Freaks:
> ----------------------------------------
> http://www.phpfreaks.com
> http://www.phpfreaks.com/forums
>
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com