Reply to Re: Forms...and WHERE in mysql

Your name:

Reply:


Posted by sskaje on 12/28/07 14:22

On Dec 28, 6: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?
>
> 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]."<br />";
> echo "NOME: ".$record[1]."<br />";
> echo "<br />";}
>
> ---------------------------------------
>
> it does not work!!!
> How could I retrieve "username" using "WHERE username="?????????" ???
>
> TNX in advance!

The MySQL Select should be like
SELECT `field`, `field` FROM `table` WHERE `field`='value';

you need the '' unless the field is kinda int

[Back to original 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

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