"Bennett Haselton" <bennett@peacefire.org> wrote in message
news:e614455c.0312131520.6e146ec3@posting.google.c om...[color=blue]
> 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
>[/color]
http://hotwired.lycos.com/webmonkey/...tutorial4.html[color=blue]
>
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[/color]
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.