Forms...and WHERE in mysql

Forms...and WHERE in mysql

am 28.12.2007 10:25:35 von lukk3tt0

Hi guys,
I found this script:
http://hvassing.com/2007/simple-php-login-script-using-sessi on-and-mysql/#comment-31549

but if I try to recall, in a page I created, the variable "username"
that a user fill in the login page, it does not work.
How could I retrieve the "username", in other pages, using sessions?

I think that the answer is in the last 8 lines of code of
"manage-check.php" but I do not know how....

For example if I fill this code in "members-only.php":

---------------------------------------
$db=mysql_connect('XXXX.YYYYYYYYYYYY.ZZZ','user','123456') or
die(mysql_error());

mysql_select_db("XXXX",$db);

$result=mysql_query("SELECT * FROM members
WHERE username="$_POST[username]"");
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
while ($record = mysql_fetch_row($result)){
echo "id: ".$record[0]."
";
echo "NOME: ".$record[1]."
";
echo "
";
}
---------------------------------------

it does not work!!!
How could I retrieve "username" using "WHERE username="?????????" ???

TNX in advance!

Re: Forms...and WHERE in mysql

am 28.12.2007 14:58:06 von Jerry Stuckle

lukk3tt0 wrote:
> Hi guys,
> I found this script:
> http://hvassing.com/2007/simple-php-login-script-using-sessi on-and-mysql/#comment-31549
>
> but if I try to recall, in a page I created, the variable "username"
> that a user fill in the login page, it does not work.
> How could I retrieve the "username", in other pages, using sessions?
>
> I think that the answer is in the last 8 lines of code of
> "manage-check.php" but I do not know how....
>
> For example if I fill this code in "members-only.php":
>
> ---------------------------------------
> > $db=mysql_connect('XXXX.YYYYYYYYYYYY.ZZZ','user','123456') or
> die(mysql_error());
>
> mysql_select_db("XXXX",$db);
>
> $result=mysql_query("SELECT * FROM members
> WHERE username="$_POST[username]"");
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> while ($record = mysql_fetch_row($result)){
> echo "id: ".$record[0]."
";
> echo "NOME: ".$record[1]."
";
> echo "
";
> }
> ---------------------------------------
>
> it does not work!!!
> How could I retrieve "username" using "WHERE username="?????????" ???
>
> TNX in advance!
>
>
>

First thing you should do is enable display_errors and fix your syntax
problems.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================