By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,009 Members | 1,487 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,009 IT Pros & Developers. It's quick & easy.

PHP tutorial for building user-login sites

P: n/a
I'm looking for a PHP tutorial that specializes in how to build sites
that are based around user logins. i.e. the user logs in on the front
page, and are taken to a main login page where fields on the page are
populated with values from some server-side database. Ideally, there
would be a server-side "user" database table, with fields such as
"age", so that you could insert a short tag in the PHP source like:

Your age is: <?php [something goes here] ?>

and the "age" value from the user table would be interpolated, such
that the "[something goes here]" in the example above would be
something short like "user.age", and not something clunky like an
entire SQL query statement. (Preferably the database lookup of the
user's record would be done just once per page load, or even once per
user login, so that it wouldn't require a separate database query to
populate every value on the page.) Also, ideally, a way to do queries
against other tables in the server-side database, so you could have
something in the page source like:

Your ordered items are: <?php [whatever goes here] ?>

which would query against another MySQL table like "orders" for orders
whose user_id field matched the "ID" field of the user in your "user"
table, and display the results in a table format according to some
specified template. Again, it would be elegant if the stuff in
"[whatever goes here]" could be brief (the bare minimum you'd need to
specify would be the "orders" table and the name of the template that
controls the formatting of the results), instead of having to be an
entire SQL query.

Can PHP do this? The first few sites that I found when searching for
"PHP tutorial":

http://www.php.net/tut.php
http://hotwired.lycos.com/webmonkey/...tutorial4.html
http://www.gimpster.com/wiki/PhpTutorial

didn't talk much about building a user-login site like the one I'm
describing. Is there a tutorial which specializes in how to build
that kind of site with PHP?

-Bennett
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

"Bennett Haselton" <be*****@peacefire.org> wrote in message
news:e6**************************@posting.google.c om...
I'm looking for a PHP tutorial that specializes in how to build sites
that are based around user logins. i.e. the user logs in on the front
page, and are taken to a main login page where fields on the page are
populated with values from some server-side database. Ideally, there
would be a server-side "user" database table, with fields such as
"age", so that you could insert a short tag in the PHP source like:

Your age is: <?php [something goes here] ?>

and the "age" value from the user table would be interpolated, such
that the "[something goes here]" in the example above would be
something short like "user.age", and not something clunky like an
entire SQL query statement. (Preferably the database lookup of the
user's record would be done just once per page load, or even once per
user login, so that it wouldn't require a separate database query to
populate every value on the page.) Also, ideally, a way to do queries
against other tables in the server-side database, so you could have
something in the page source like:

Your ordered items are: <?php [whatever goes here] ?>

which would query against another MySQL table like "orders" for orders
whose user_id field matched the "ID" field of the user in your "user"
table, and display the results in a table format according to some
specified template. Again, it would be elegant if the stuff in
"[whatever goes here]" could be brief (the bare minimum you'd need to
specify would be the "orders" table and the name of the template that
controls the formatting of the results), instead of having to be an
entire SQL query.

Can PHP do this? The first few sites that I found when searching for
"PHP tutorial":

http://www.php.net/tut.php
http://hotwired.lycos.com/webmonkey/...tutorial4.html http://www.gimpster.com/wiki/PhpTutorial

didn't talk much about building a user-login site like the one I'm
describing. Is there a tutorial which specializes in how to build
that kind of site with PHP?

-Bennett


Your description sounds unnecessarily difficult. I must be missing
something.
What is wrong with having the person log in - and then storing session
variable $userID as $resultSet["userId"] ?
userId is of course your unique field from your table -
USERS(USERID,USERNAME,PASSWORD).
You are then free to use this id wherever you want, with any sql syntax you
want - simple or complicated.


Jul 17 '05 #2

P: n/a
be*****@peacefire.org (Bennett Haselton) wrote in message news:<e6**************************@posting.google. com>...
I'm looking for a PHP tutorial that specializes in how to build sites
that are based around user logins.
<snip>
Can PHP do this? The first few sites that I found when searching for
"PHP tutorial":

http://www.php.net/tut.php
http://hotwired.lycos.com/webmonkey/...tutorial4.html
http://www.gimpster.com/wiki/PhpTutorial

didn't talk much about building a user-login site like the one I'm
describing. Is there a tutorial which specializes in how to build
that kind of site with PHP?


1. http://www.google.com/search?&q=php+login+script
2. http://martin.f2o.org/php/login

--
"Silence is the only right answer for many wrong questions" --
G.K.Moopanar, Politician
Email: rrjanbiah-at-Y!com
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.