[PHP-DB] Re: Get Last ID Inserted

2002-11-22 Thread David Elliott
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Greetings Adam

On 21 November 2002 at 11:12:46 -0500 (which was 16:12 where I live) Adam
Voigt emanated these words of wisdom

 But if there are heavy operations on the site, will this not also pick
 up a different last inserted id, if in the split milisecond between the
 insert and the next mssql_query which has the @@identity say, another
 user does an insert?

No unless you drop the connection, but then it should give you a NULL. To
quote M$

==8=

Remarks

IDENT_CURRENT is similar to the Microsoft® SQL Server™ 2000 identity
functions SCOPE_IDENTITY and @@IDENTITY. All three functions return
last-generated identity values. However, the scope and session on which
'last' is defined in each of these functions differ.

IDENT_CURRENT returns the last identity value generated for a specific table
in any session and any scope.

@@IDENTITY returns the last identity value generated for any table in the
current session, across all scopes.

SCOPE_IDENTITY returns the last identity value generated for any table in
the current session and the current scope.

==8=

- --
 Ti2GO,___
  David   |David  Elliott|   Software Engineer|
 _| [EMAIL PROTECTED] | PGP Key ID 0x650F4534  |
| I didn't do it!  Nobody saw me do it!  You can't prove anything!|

-BEGIN PGP SIGNATURE-
Version: 6.5.8ckt http://www.ipgpp.com/

iQA/AwUBPd3zufmK8eZlD0U0EQJ37QCglnr+5j0h7CSOG39qznRq2F8fZNIAn10R
xhMTzYhlrvim4iyzB0rny48J
=DtzT
-END PGP SIGNATURE-


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] regarding multiple joins

2002-11-22 Thread Jonathan Narong
this is a problem i've been struggling with for a little while. any attempt
to find help online has not produced any useful information. this is
regarding joins, which i'm not an expert in, but hopefully one of you can
help me out.

i have an table 'articles' which has multiple fields, such as author,
editor, photographer, etc.. each of these fields contains an index number
which relates to another table 'people' that lists everyone. basically i
just want to select  everything with the names displaying, instead of id
numbers.

the way i'm currently doing this is pretty inefficient; on the display page,
i have multiple queries. first to extract everything from the articles
table, and then a query for each field (i.e. SELECT name FROM authors WHERE
(author_id = $id). This works, although I'm pretty sure there's a much more
efficient way of doing this with one query.

I know a method would be to have separate tables for authors, editors,
photographers, etc... but in this case, it would be simpler to just relate
everything to the one people table. THis is because any particular person
could take on multiple tasks, or different ones, for different articles.

Hope this all makes sense. I have a feeling aliases will be need to used,
although I'm not exactly sure how.

Thanks for any help you guys might be able to provide. ;-)

-jon



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] RE: inserting html into mysql tables

2002-11-22 Thread Jonathan Narong
5k of data is way too much for varchar, so i would use a field of type TEXT.
i do this as well (storing html data in mysql) and it works great. some say
to use addslashes() although, on my setup (3.23/4.1) it seems to addslashes
automatically - not sure exactly why that is though.

-Original Message-
From: mike karthauser [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 21, 2002 8:02 AM
To: [EMAIL PROTECTED]
Subject: inserting html into mysql tables


hi,
is there anything special i need to know in regards to creating a table to
hold html data? I am building a CMS for a site using php and mysql. The
various tables hold course information that the client wants to edit. I
imagine it will be a case of dropping the cleaned html source from
dreamweaver into a form box and posting it to the table.

What would a good varchar(?) be for say 5K of data?

cheers
mikek
--
Mike Karthauser
Managing Director - Brightstorm Ltd

Email[EMAIL PROTECTED]
Web  http://www.brightstorm.co.uk
Tel  0117 9426653 (office)
   07939 252144 (mobile)

SnailmailUnit 8, 14 King Square,
   Bristol BS2 8JJ




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] Dbase module won't work

2002-11-22 Thread J Veenhuijsen
IIS 5 Won't load php_dbase.dll
php.ini

;
; Paths and Directories ;
;
include_path =   ; UNIX: /path1:/path2  Windows:
\path1;\path2
doc_root  = ; the root of the php pages, used only if nonempty
user_dir  = ; the directory under which php opens the script using
/~username, used only if nonempty
;upload_tmp_dir = ; temporary directory for HTTP uploaded
files (will use system default if not specified)
upload_max_filesize = 2097152   ; 2 Meg default limit on file uploads
extension_dir = c:\php\ ; directory in which the loadable extensions
(modules) reside
enable_dl  = On; Whether or not to enable the dl() function.
 ; The dl() function does NOT properly work in multithreaded
 ; servers, such as IIS or Zeus, and is automatically disabled
 ; on them.
;;
; Dynamic Extensions ;
;;
; if you wish to have an extension loaded automaticly, use the
; following syntax:  extension=modulename.extension
; for example, on windows,
; extension=msql.dll
; or under UNIX,
; extension=msql.so
; Note that it should be the name of the module only, no directory
information
; needs to go here.  Specify the location of the extension with the
extension_dir directive above.


;Windows Extensions
;extension=php_nsmail.dll
;extension=php_calendar.dll
extension=php_dbase.dll
;extension=php_filepro.dll
;extension=php_gd.dll
;extension=php_dbm.dll
;extension=php_mssql.dll
;extension=php_zlib.dll
;extension=php_filepro.dll
;extension=php_imap4r2.dll
;extension=php_ldap.dll
;extension=php_crypt.dll
;extension=php_msql2.dll
;extension=php_odbc.dll
; Note that MySQL support is now built in, so no dll is needed for it.


Restarting IIS gives : unable to load dynamic library 'c:\php\php_dbase.dll'
Can't find procedure

Please help



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] Dbase module won't work

2002-11-22 Thread Griffiths, Daniel
might sound like a silly question but you do have php_dbase.dll under 
c:\php\ , when I installed php on a windows machine it put all the extentions in 
c:\php\extentions\

-Original Message-
From: J Veenhuijsen [mailto:[EMAIL PROTECTED]]
Sent: 22 November 2002 10:04
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Dbase module won't work


IIS 5 Won't load php_dbase.dll
php.ini

;
; Paths and Directories ;
;
include_path =   ; UNIX: /path1:/path2  Windows:
\path1;\path2
doc_root  = ; the root of the php pages, used only if nonempty
user_dir  = ; the directory under which php opens the script using
/~username, used only if nonempty
;upload_tmp_dir = ; temporary directory for HTTP uploaded
files (will use system default if not specified)
upload_max_filesize = 2097152   ; 2 Meg default limit on file uploads
extension_dir = c:\php\ ; directory in which the loadable extensions
(modules) reside
enable_dl  = On; Whether or not to enable the dl() function.
 ; The dl() function does NOT properly work in multithreaded
 ; servers, such as IIS or Zeus, and is automatically disabled
 ; on them.
;;
; Dynamic Extensions ;
;;
; if you wish to have an extension loaded automaticly, use the
; following syntax:  extension=modulename.extension
; for example, on windows,
; extension=msql.dll
; or under UNIX,
; extension=msql.so
; Note that it should be the name of the module only, no directory
information
; needs to go here.  Specify the location of the extension with the
extension_dir directive above.


;Windows Extensions
;extension=php_nsmail.dll
;extension=php_calendar.dll
extension=php_dbase.dll
;extension=php_filepro.dll
;extension=php_gd.dll
;extension=php_dbm.dll
;extension=php_mssql.dll
;extension=php_zlib.dll
;extension=php_filepro.dll
;extension=php_imap4r2.dll
;extension=php_ldap.dll
;extension=php_crypt.dll
;extension=php_msql2.dll
;extension=php_odbc.dll
; Note that MySQL support is now built in, so no dll is needed for it.


Restarting IIS gives : unable to load dynamic library 'c:\php\php_dbase.dll'
Can't find procedure

Please help



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Dbase module won't work

2002-11-22 Thread J Veenhuijsen
I dont' hope it does matter where to put the dll files.

I put php_dbase.dll in several other directories but is still does not work.


www.classic-showroom.nl


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Dbase module won't work

2002-11-22 Thread J Veenhuijsen
Daniel Griffiths wrote:

might sound like a silly question but you do have php_dbase.dll under 
c:\php\ , when I installed php on a windows machine it put all the extentions in c:\php\extentions\

-Original Message-
From: J Veenhuijsen [mailto:[EMAIL PROTECTED]]
Sent: 22 November 2002 10:04
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Dbase module won't work


IIS 5 Won't load php_dbase.dll
php.ini

;
; Paths and Directories ;
;
include_path =   ; UNIX: /path1:/path2  Windows:
\path1;\path2
doc_root  = ; the root of the php pages, used only if nonempty
user_dir  = ; the directory under which php opens the script using
/~username, used only if nonempty
;upload_tmp_dir = ; temporary directory for HTTP uploaded
files (will use system default if not specified)
upload_max_filesize = 2097152   ; 2 Meg default limit on file uploads
extension_dir = c:\php\ ; directory in which the loadable extensions
(modules) reside
enable_dl  = On; Whether or not to enable the dl() function.
 ; The dl() function does NOT properly work in multithreaded
 ; servers, such as IIS or Zeus, and is automatically disabled
 ; on them.
;;
; Dynamic Extensions ;
;;
; if you wish to have an extension loaded automaticly, use the
; following syntax:  extension=modulename.extension
; for example, on windows,
; extension=msql.dll
; or under UNIX,
; extension=msql.so
; Note that it should be the name of the module only, no directory
information
; needs to go here.  Specify the location of the extension with the
extension_dir directive above.


;Windows Extensions
;extension=php_nsmail.dll
;extension=php_calendar.dll
extension=php_dbase.dll
;extension=php_filepro.dll
;extension=php_gd.dll
;extension=php_dbm.dll
;extension=php_mssql.dll
;extension=php_zlib.dll
;extension=php_filepro.dll
;extension=php_imap4r2.dll
;extension=php_ldap.dll
;extension=php_crypt.dll
;extension=php_msql2.dll
;extension=php_odbc.dll
; Note that MySQL support is now built in, so no dll is needed for it.


Restarting IIS gives : unable to load dynamic library 'c:\php\php_dbase.dll'
Can't find procedure

Please help




I just tested the same settings with another webserver (Sambar 5.0)
And everything works just fine.

Jochem


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [Fwd: Re: [PHP-DB] how to update a text BLOB in ODBC?]

2002-11-22 Thread Nick Gorham
Jeff Stern wrote:


it turns out it is probably a bug -- firebird does not have this 
behavior, but interbase does. they do not think it is an easysoft issue. 
they think if we juse use firebird here we will be fine.

but we cannot risk switching to firebird, here. my IP dept would never 
go for it.  maybe an upgrade to ib 7 would fix it, i don't know.. i am 
still looking further into it. anyone have any contacts at interbase?

I don't know anything about BLOBs under ODBC, but I could help you with
direct Interbase connectivity, which I use extensively (but not for text
fields - it makes it difficult and slow to search).
Let me know if you need help with direct connection BLOB handling under
Interbase. I am using Firebird, not that it should make any difference.



Just to sum up the problem, Interbase 6 and 6.5 (not sure about 7, I 
will check) does not allow you to do a literal insert into a blob, ie

insert into blob_table ( blob_column ) values( 'hello' );

The only way it can be done, is via a bound parameter, that allows the 
ODBC driver, to catch the fact its a blob, and to use the correct 
methods to create and insert the blob.

I only discovered that firebird supported this, when I was about to 
demonstrate to someone here, how the problem happened, and to my 
suprise, it didn't.

The only other way I could suggest would involve adding support in 
php_odbc for binding parameters, that wouldn't be that difficult, but as 
the last few changes I did to php_odbc have either been backed out or 
altered to fit different drivers, I don't know what the developers want 
to do.

---
Nick Gorham
Easysoft Limited


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Forums?

2002-11-22 Thread Paul Ihrig
hey guys.

a friend want help setting up a forum.

what are some good easy to use ones out there?

thanks
-paul


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] Forums?

2002-11-22 Thread Neil Lathwood
Paul Ihrig wrote:

 hey guys.
 
 a friend want help setting up a forum.
 
 what are some good easy to use ones out there?

I have used http://www.phpbb.com/ b4 and it is very good for free ;)

Neil


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] INSERT question. 2 pointers.

2002-11-22 Thread Hutchins, Richard
Actually, according to the MySQL manual and experience, if you don't want to
insert data into each column in a table, you can specify the columns you DO
want to insert data into. See below:

$sql = INSERT INTO myTable (col1,col3,col4) VALUES
('$val1','$val2','$val3');

As you can see, the above query would only insert data into three out of
four columns. Your list of VALUES must exactly match the number of columns
specified in the list. Any columns for which a value is not provided will be
set to their default value.

If you need more information, check the MySQL manual under the heading
INSERT Syntax.

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Friday, November 22, 2002 1:11 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] INSERT question. 2 pointers.
 
 
 hi Scott,
 
 1. When you are using an insert where you dont want to use 
 all columns:
 use this:
 $query = INSERT INTO accounts VALUES('.$accnts[0].',
 'TIMESTAMP(10)','','','','',);
 (never have empty comma strings with nothing inside.)
 
 2. Secondly, when you get errors, and you dont know where the error is
 do this:
 before executing the query,
 print out the query on the browser (comment out the query 
 execution code) 
 and then copy paste the query from the browser
 and then run the same in your mysql client, 
 and you will know exactly where is the problem from the error 
 generated.
 regards,
 
 ***
 Amit Wadhwa 
 Dell International Services
 ***
 
 -Original Message-
 From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, November 21, 2002 12:46 AM
 To: '[EMAIL PROTECTED]'
 Subject: [PHP-DB] INSERT question...
 
 
   I have an INSERT statement that I cannot quiet get working.  The
 table that this data is being put into has 7 columns, but I 
 only care about
 putting in the data from the first two columns at this time.  
 The first
 column is an array element, and the second column needs to be 
 a timestamp.
 Here is the INSERT statement:
 
 $query = INSERT INTO accounts VALUES('.$accnts[0].', 
 'TIMESTAMP(10)', , ,
 , ,);
 
   Here is the error being displayed on the web page:
 
 You have an error in your SQL syntax near ' , , ,)' at line 1
   Thanks in advance for the help.
 
 Scott Nipp
 Phone:  (214) 858-1289
 E-mail:  [EMAIL PROTECTED]
 Web:  http:\\ldsa.sbcld.sbc.com
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] autoupload

2002-11-22 Thread Edward Peloke

I am currently creating a php/mysql site for a client.  Many of the
customers who will be using this site also use a vb/access program to store
a lot of the same data.  The client asked me last night if we could write an
app that would run on the customers machine that would routinely take data
from the access db on their machine and automatically upload it to our mysql
site.  Any ideas on how this can be accomplished?

Thanks,
Eddie


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] autoupload

2002-11-22 Thread 1LT John W. Holmes
 I am currently creating a php/mysql site for a client.  Many of the
 customers who will be using this site also use a vb/access program to
store
 a lot of the same data.  The client asked me last night if we could write
an
 app that would run on the customers machine that would routinely take data
 from the access db on their machine and automatically upload it to our
mysql
 site.  Any ideas on how this can be accomplished?

You'd have to write a little vB or C program to do it, unless you're going
to install PHP on every computer.

---John Holmes...


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] Re: Access Violation in ISAPI version

2002-11-22 Thread quest
Hi, there...

I had seen that error message in my PC (with windows 2000 Server + php4.2.3
+ Oracle9i)

if you are using PHP on IIS(, I recommend that you should check
session.save_path = c:/temp in your php.ini.
(this file normally located in c:\winnt directory)

some developers discussed this problem being related with
session.save_path property...

Please, check these article in...

http://www.php.net/manual/sk/printwn/function.session-save-path.php

If it can't fix your problem... sorry for bothering you...
Good luck.

Ryan Jameson [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Has anyone else had problems with the error PHP has encountered an Access
Violation at 098029AE ...

It's talked about at:
http://bugs.php.net/bug.php?id=15333


The most frustrating thing is our ISP went above the call of duty to install
PHP for me, and now his response is... well read for yourselves:


I read through all the stuff at php.net.  The long and short of it is this:
Nobody really knows what is causing the problem.
It appears to be a problem with a dual-processor machine (which is what
you're using)
It is believed that 4.2.3 solves the problem (that is the latest version and
the version we are using)
Setting the security model to low on the site helps in many cases (doesn't
eliminate the problem, just reduces how often it occurs)

Ergo, this has been my problem with public domain scripting languages such
as PHP.  There is not a single source that can be held accountable for
ensuring a problem is solved.  It is the reason that we have standardized on
CF, because when it's bad, Macromedia HAS to fix it.

All that being said, and consistent with our terms of installation, I will
take some time to see if I can trim up the configuration and improve the
situation.  However, because this problem crashes the server completely, if
we can't find a resolution soon, I will opt to remove it from the system.

One of our key responsibilities is system stability and reliability.  Again,
I'll see if I can modify the config to alleviate this, however, the php
resource was very little help.


I'm pretty disappointed that this hasn't been fixed yet. Has anyone had any
luck fixing it?

Thanks!
 Ryan



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] MySQL connectiviy

2002-11-22 Thread Jeremy Wood
Hello all,
I'm new to PHP and would like to start using mySQL (or postgresql) but I keep having 
one problem. 
In a php file i have a simple call to the function
mysql_connect()

but i constantly get the error
Fatal error: Call to undefined function: mysql_connect() 

MySQL support was installed with
--with-mysql=shared,/usr' 
This is the redhat 8.0 default. I guess it just can't find the function library.

Any pointers any one could give would be really appreciated.
Thanks,
Jeremy Wood



RE: [PHP-DB] MySQL connectiviy

2002-11-22 Thread Pedro M. S. Oliveira
Hi Jeremy,
Probably you don't have all of php installed; you can pick it up in
php.net and install the full php libs.
Or in your php ini file, the php lib path can be incorrect, well these
are just thoughts as I don't use red hat for some time (SuSE Forever).
Hope you figure it out,
Pedro


-Original Message-
From: Jeremy Wood [mailto:[EMAIL PROTECTED]] 
Sent: sexta-feira, 22 de Novembro de 2002 18:35
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MySQL connectiviy

Hello all,
I'm new to PHP and would like to start using mySQL (or postgresql) but I
keep having one problem. 
In a php file i have a simple call to the function
mysql_connect()

but i constantly get the error
Fatal error: Call to undefined function: mysql_connect() 

MySQL support was installed with
--with-mysql=shared,/usr' 
This is the redhat 8.0 default. I guess it just can't find the function
library.

Any pointers any one could give would be really appreciated.
Thanks,
Jeremy Wood



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] MySQL connectiviy

2002-11-22 Thread Jason Wong
On Saturday 23 November 2002 02:34, Jeremy Wood wrote:
 Hello all,
 I'm new to PHP and would like to start using mySQL (or postgresql) but I
 keep having one problem. In a php file i have a simple call to the function
 mysql_connect()

 but i constantly get the error
 Fatal error: Call to undefined function: mysql_connect()

 MySQL support was installed with
 --with-mysql=shared,/usr'
 This is the redhat 8.0 default. I guess it just can't find the function
 library.

 Any pointers any one could give would be really appreciated.

Have you installed the php-mysql*.rpm ?

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *


/*
Computer programs expand so as to fill the core available.
*/


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] MySQL connectiviy

2002-11-22 Thread Jeremy Wood
No, I was unable to find a new version of it. Is there a version for php 4.2
?



Jeremy



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] autoupload

2002-11-22 Thread Peter Lovatt
A little more detail

Install MyODBC - you will need it on all machines

In Access

File - Get external data - Link tables -ODBC data sources - MyODBC data
source

You now have a direct link from Access to MySql and can run an Access query
to load the data straight into MySql.

I did this a while ago and can't remember more detail, but I hope this will
point you in the right direction.


Peter

---
Excellence in internet and open source software
---
Sunmaia
Birmingham
UK
www.sunmaia.net
tel. 0121-242-1473
International +44-121-242-1473
---

-Original Message-
From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]]
Sent: 22 November 2002 14:30
To: Edward Peloke; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] autoupload


 I am currently creating a php/mysql site for a client.  Many of the
 customers who will be using this site also use a vb/access program to
store
 a lot of the same data.  The client asked me last night if we could write
an
 app that would run on the customers machine that would routinely take data
 from the access db on their machine and automatically upload it to our
mysql
 site.  Any ideas on how this can be accomplished?

You'd have to write a little vB or C program to do it, unless you're going
to install PHP on every computer.

---John Holmes...


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] RE: regarding multiple joins

2002-11-22 Thread Jonathan Narong
that worked perfectly! thank you so much!

-jon

-Original Message-
From: Rick Widmer [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 22, 2002 6:08 PM
To: Jonathan Narong; David Elliott; Jonathan Narong on PHP-DB
Subject: Re: [PHP-DB] RE: regarding multiple joins


At 05:26 PM 11/22/02 -0800, Jonathan Narong wrote:
sorry for my confusing email... i'll try to clarify what i was asking:

i have two tables (i shortened them to only show the parts relating to what
i'm trying to do now) ...

CREATE TABLE articles (
   id smallint(4) unsigned zerofill NOT NULL auto_increment,
   title varchar(40) NOT NULL default '',
   public char(1) NOT NULL default 'y',
   author smallint(6) default NULL,
   editor smallint(6) default NULL,
   photog1 smallint(6) default NULL,
   photog2 smallint(6) default NULL,

CREATE TABLE people (
   id tinyint(3) unsigned NOT NULL auto_increment,
   name varchar(30) NOT NULL default '',

Try this...

SELECT title, a.name AS AuthorName, b.name AS EditorName,
c.name AS Photog1Name, d.name AS Photog2Name
FROM articles, people a, people b, people c people d
WHERE author = a.id AND editor = b.id
   AND photog1 = c.id AND photog2 = d.id
   AND what ever else you want in the where clause;


Rick



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php