[PHP-DB] Re: NEWBIE - Needs Assistance with Joins

2001-09-17 Thread Michael Egan

Cecily,

I think yuo need to specify the fields within the tables when you write
out a select query from multiple tables like this.

For example:

SELECT artist_name.*, album_title.* .
FROM artists, album_titles WHERE artist_name.artist_id = aid);
 
Hope this works,


Michael 


Cecily Walker Kidd wrote:
 
 Hello,
 
 I have two tables, one that contains an item id, album title name, and
 artist ID number. The second table is a list of artists, with an
 auto-increment artist ID.
 
 I want to join the two tables and have them output to a single PHP page.
 I was following along with the tutorial at
 http://www.webmasterbase.com/article/228/, and tried to modify it for my
 own needs.  When I do this, I get a parse error on the line that starts
 with SELECT.  Here's the code:
 
 $Link = mysql_connect ($Host, $User, $Password);
 
 $CDList =mysql_query(
 SELECT artist_name, album_title .
 FROM artists, album_titles WHERE artist_id = aid);
 
 
 What am I doing wrong?
 
 Thanks in advance.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Re: Session with php and mysql problem!

2001-07-31 Thread Michael Egan

I'm still at the start of trying to get to grips with PHP so these
comments should be treated with a healthy scepticism.

Most of the examples I have seen and used involving sessions will start
the session at the start of the script. If you want to continue checking
on a particular user's name you can then pass a variable using
session_register in order to track the user's name during the session.

In your example this might involve placing the start_session at the
start of the script and then carrying out a separate check to see if the
user is a valid user. You can then control the program flow on
subsequent sessions by again checking if the user is valid and
presenting appropriate messages to them if they are not.

Hope this helps,

Michael Egan

Koutsogiannopoulos Karolos wrote:
 
 Hello all...
 
 i have the following script which checks a username and pass from a db and
 if it is correct it starts a session..
 The problem is that when i go to next page the session is gone.!!
 What must i do to start the session and keep it permanent until the uses
 logs off???
 
 $handle=mysql_connect(localhost,root,s);
 $db = mysql_select_db(cosmonaut,$handle);
 $auth=mysql_query(select * from users where user_name='$username' and
 user_pass='$password',$handle);
 $match=mysql_num_rows($auth);
 if ($match  0)
 {
 session_start();
 $userid = session_id();
 echo $userid;
 include(index.php);
 }
 else
 {
 echo wrong pass;
 }
 
 __
 
 _
 PGP KEY ID: 0xA86600E9
 ___

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]