You are here: Re: Forms...and WHERE in mysql « PHP Programming Language « IT news, forums, messages
Re: Forms...and WHERE in mysql

Posted by jodleren on 12/28/07 13:51

On Dec 28, 12:13 pm, lukk3tt0 <lu...@ghjghjhg.ll> wrote:
> Hi guys,
> I found this script:http://hvassing.com/2007/simple-php-login-script-using-session-and-my...
>
> 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?

hmmm cannot quite follow, but a common thing (which even I made when
using sessions first time :-|) is to forget to user start_session()
every time. It does not start the sesstion, just gives you access to
it.

> $result=mysql_query("SELECT * FROM members
> WHERE username="$_POST[username]"");

Gee... I have been wondering whether the post can be in there, but
*just in case* I have always used it like this

$result=mysql_query("SELECT * FROM members WHERE username=\"".
$_POST["username"]."\"");
or
$result=mysql_query("SELECT * FROM members WHERE username=\"".
$_SESSTION["username"]."\"");

say
if(isset($_SESSTION["username"]))
$result=mysql_query("SELECT * FROM members WHERE username=\"".
$_SESSTION["username"]."\"");
else
$result=mysql_query("SELECT * FROM members WHERE username=\"".
$_POST["username"]."\"");

WBR
Sonnich

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация