Re: [PHP-DB] help me JOIN 3 tables. - fixed query

2009-01-13 Thread Yves Sucaet

Oops, actually forgot my GROUP BY clause. The full query is:

SELECT e1.field1, e1.field2, l1.field3, SUM(a1.adp_amount) as amount
FROM a1
inner join e1 on (e1.loanID = a1.adp_loanID)
inner join l1 on (l1.entreID = e1.entre_ID)
WHERE e1.entre_active = 'Y'
GROUP BY e1.field1, e1.field2, l1.field3

hth,

Yves

- Original Message - 
From: "Yves Sucaet" 

To: 
Sent: Tuesday, January 13, 2009 7:49 AM
Subject: Re: [PHP-DB] help me JOIN 3 tables.



Hi Joseph,

With the sum() aggregate function you'll need to use a GROUP BY clause and 
specify which fields you want from e1 and l1. Something like this:


SELECT e1.field1, e1.field2, l1.field3, SUM(a1.adp_amount) as amount
FROM a1 inner join e1 on (e1.loanID = a1.adp_loanID) inner join l1 on 
(l1.entreID = e1.entre_ID)

WHERE e1.entre_active = 'Y'

hth,

Yves

- Original Message - 
From: "Abah Joseph" 

To: 
Sent: Tuesday, January 13, 2009 6:46 AM
Subject: [PHP-DB] help me JOIN 3 tables.



I have this SQL

SELECT e1.*, l1.* FROM e1
INNER JOIN l1 WHERE e1.entre_active = 'Y' AND l1.entreID = e1.entre_id

The above query works but i want to add the one below

SELECT SUM(a1.adp_amount) as amount FROM a1 WHERE a1.adp_loanID = 
e1.loanID;


the last part of the query is to SUM the part payment made on table 'l1' 
and

return total raised with the first query.

the whole idea is three tables, (business, loan, raised), loan referenced 
ID

from business, raised referenced ID from loan.

loan maybe $300 and it can be raised over time till completed, so all the
amount raised + the loanId will be stored inside the raised table.

Thank you





--
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] help me JOIN 3 tables.

2009-01-13 Thread Yves Sucaet

Hi Joseph,

With the sum() aggregate function you'll need to use a GROUP BY clause and 
specify which fields you want from e1 and l1. Something like this:


SELECT e1.field1, e1.field2, l1.field3, SUM(a1.adp_amount) as amount
FROM a1 inner join e1 on (a1.loanID = a1.adp_loanID) inner join l1 on 
(l1.entreID = e1.entre_ID)

WHERE e1.entre_active = 'Y'

hth,

Yves

- Original Message - 
From: "Abah Joseph" 

To: 
Sent: Tuesday, January 13, 2009 6:46 AM
Subject: [PHP-DB] help me JOIN 3 tables.



I have this SQL

SELECT e1.*, l1.* FROM e1
INNER JOIN l1 WHERE e1.entre_active = 'Y' AND l1.entreID = e1.entre_id

The above query works but i want to add the one below

SELECT SUM(a1.adp_amount) as amount FROM a1 WHERE a1.adp_loanID = 
e1.loanID;


the last part of the query is to SUM the part payment made on table 'l1' 
and

return total raised with the first query.

the whole idea is three tables, (business, loan, raised), loan referenced 
ID

from business, raised referenced ID from loan.

loan maybe $300 and it can be raised over time till completed, so all the
amount raised + the loanId will be stored inside the raised table.

Thank you





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



Re: [PHP-DB] Help me please

2004-11-08 Thread Petrus Ali Saputra
Bastien Koert wrote:
have you created a dsn for this connection?
Bastien
From: Petrus Ali Saputra <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Help me please
Date: Mon, 08 Nov 2004 10:55:45 +0700
Can anyone here help me how to connect to an ODBC data?
Here is my code: $odbc = odbc_connect("Ta Fara","","");
And this is the result: Warning: odbc_connect(): SQL error: 
[Microsoft][ODBC Driver Manager] Data source name not found and no 
default driver specified, SQL state IM002 in SQLConnect in d:\my 
documents\my webs\projects\ta fara\main\admin\config.php on line 2

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Problem solved. Thanks for the help.
--
Petrus Ali Saputra
==
Addr. : Karang Empat Besar 76
Surabaya 60133
East Java, Indonesia
Phone : 62-31-381-7866
62-31-6010-2653
62-81-23000-254
--
A professional web hosting for your business and corporate
URL   : http://attractive.as/hostmania
--
Mau kredit mobil baru/bekas dengan bunga rendah?
URL   : http://fantastic.as/kreditmobil
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Help me please

2004-11-08 Thread Petrus Ali Saputra
Arné klopper wrote:
Have you set up a ODBC connection ?
 
You must set up a ODBC connection in the ODBC Sources that is usually in you Control Panel or Administrator Tools.
 
You must put it as a System DNS and set up the connection, so your local system know where to find the database.
 
I already have and it's been tested from Delphi before. There's no 
problem with the connection from Delphi.

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


RE: [PHP-DB] Help me please

2004-11-08 Thread Bastien Koert
have you created a dsn for this connection?
Bastien
From: Petrus Ali Saputra <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Help me please
Date: Mon, 08 Nov 2004 10:55:45 +0700
Can anyone here help me how to connect to an ODBC data?
Here is my code: $odbc = odbc_connect("Ta Fara","","");
And this is the result: Warning: odbc_connect(): SQL error: 
[Microsoft][ODBC Driver Manager] Data source name not found and no default 
driver specified, SQL state IM002 in SQLConnect in d:\my documents\my 
webs\projects\ta fara\main\admin\config.php on line 2

--
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] Help me please

2004-11-08 Thread Arné Klopper
Have you set up a ODBC connection ?
 
You must set up a ODBC connection in the ODBC Sources that is usually in you 
Control Panel or Administrator Tools.
 
You must put it as a System DNS and set up the connection, so your local system 
know where to find the database.
 
 
 
 
 
Kind Regards
Arné Klopper
 

NetCB Solutions (Pty) Ltd.
www.netcb.com
Office: +27 12 997 3007
Fax: 27 12 997 3629
Mobile: +27 84 513 4119

>>> Petrus Ali Saputra <[EMAIL PROTECTED]> 2004/11/08 05:55:45 AM >>>

Can anyone here help me how to connect to an ODBC data?
Here is my code: $odbc = odbc_connect("Ta Fara","","");
And this is the result: Warning: odbc_connect(): SQL error: 
[Microsoft][ODBC Driver Manager] Data source name not found and no 
default driver specified, SQL state IM002 in SQLConnect in d:\my 
documents\my webs\projects\ta fara\main\admin\config.php on line 2

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





Re: [PHP-DB] help me..!

2003-03-24 Thread ps_jkt

there are a million sample php script in links...

http://www.php.net




   

  "muhammad_wahyu" 

  <[EMAIL PROTECTED]To:   <[EMAIL PROTECTED]>  
  
  il.com>  cc: 

   Subject:  [PHP-DB] help me..!   

  25/03/03 15:02   

   

   





dear all,

I'm a new user for PHP programing,I'm confused with syntax in those
script.So
I want all of you can help me.friend i need 1.Example of PHP (guest
book,e-commerce,db with PHP,etc)

Thank's all

akhi wahyu

--
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] help me

2003-01-09 Thread Snijders, Mark

when using start_session

the code tries to write a file to the tmp dir...

think you are working under windows

so make in c: a \tmp dir !!!

then it should work



-Original Message-
From: khac duy [mailto:[EMAIL PROTECTED]]
Sent: vrijdag 10 januari 2003 1:08
To: [EMAIL PROTECTED]
Subject: [PHP-DB] help me


  i can't use start_secsion(); in php4, it say:
 error : can't ofen(\tmp/4363jghsfjkhshga.. like this...



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




Re: [PHP-DB] help me

2003-01-09 Thread rblack

Are you running on windows or Linux???

This looks like a Windows problem - you have to set your
"SESSION_SAVE_PATH" in php.ini AND make sure the folder you specify exists
and is accessible to PHP.

HTH,

Richy

==
Richard Black
Senior Developer, DataVisibility Ltd - http://www.datavisibility.com
Tel: 0141 951 3481
Email: [EMAIL PROTECTED]


   

"khac duy" 



netnam.vn>   cc:   

 Subject: [PHP-DB] help me 

10/01/2003 

00:07  

   

   





  i can't use start_secsion(); in php4, it say:
 error : can't ofen(\tmp/4363jghsfjkhshga.. like this...




This email has been scanned for all viruses by the MessageLabs SkyScan
service. For more information on a proactive anti-virus service working
around the clock, around the globe, visit http://www.messagelabs.com





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




Re: [PHP-DB] help me

2003-01-09 Thread Martin Hudec
Hello khac,

hmm what platform are you running on? what are PHP settings for
writing sessions? Check out permissions for /tmp directory, check out
free space on disk.

-- 
Best regards,
 Martin  mail   [EMAIL PROTECTED]
 mobile +421.907.303.393
 icq34358414
 wwwhttp://www.corwin.sk

PGP key fingerprint  21365ca05ecfd8aeb1cf19c838fff033

"In those days spirits were brave, the stakes were high, 
 men were real men, women were real women and small furry 
 creatures from Alpha Centauri were real small furry creatures 
 from Alpha Centauri."

by Douglas Adams

Friday, January 10, 2003, 1:07:54 AM, you wrote:

kd>   i can't use start_secsion(); in php4, it say:
kd>  error : can't ofen(\tmp/4363jghsfjkhshga.. like this...


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




RE: [PHP-DB] help me on projecting some tables

2001-11-16 Thread Rick Emery

1.  Don't know answer to question.  However, surround the INSERTs with
LOCK/UNLOCK Table commands to prevent the problem you desecribe.
Or, the script (PHP,PERL,C,Python...) can insert product record, retrieve
the product_id, then use that for the product_id into the traits table.

-Original Message-
From: Tim Foster [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 16, 2001 9:42 AM
To: PHP DB
Subject: RE: [PHP-DB] help me on projecting some tables


A couple of questions:

> INSERT INTO traits  VALUES("Added Chemicals",LAST_INSERT_ID(),"Sugar");

1. Will LAST_INSERT_ID() work reliably in a multi-user environment? What
happens if you're
in the middle of inserting a dozen records and someone else inserts a
record? Does MySQL
keep the LAST_INSERT_ID()s separate (since the web application will see both
transactions
as being done by the same "user")?

2. Is there any benefit to having a 3rd table to keep track of
"characteristic"s ? I guess
that quesiton is best answered by examining the business needs. If the
characteristics are
few and don't change often, it seems to me that you'd want a 3rd table to
keep them. That
way, the spelling is similar, etc, and therefore you can do (accurate)
queries based on
the characteristics (if the need ever came up)


TIM
-Whenever you hear a man speak of his love for his country, it
is a sure sign he expects to be paid for it.


> -Original Message-
> From: Rick Emery [mailto:[EMAIL PROTECTED]]

> CREATE TABLE products(
> product_id int auto_increment primary key,
> description char(50) default "",
> quantity int not null,
> unit enum ("each","lb","ounce","gallon","quart"),
> price decimal(5,2) not null
> )
>
> CREATE TABLE traits(
> characteristic char(25) default "",
> product_id int,
> description char(25)
> )
>
> In the above example, when you wanted to add  a characteristic for a
> particular product, you simply add a record into traits and set
> traits.product_id equal to products.product_id.  This will make it REAL
EASY
> doing joins on this combo as well.  For example:
>
> INSERT INTO products VALUES(NULL, "Coca Cola",1,"ounce",0.39);
> INSERT INTO traits  VALUES("Liquid",LAST_INSERT_ID(),"Seltzer-based");
> INSERT INTO traits  VALUES("Added Chemicals",LAST_INSERT_ID(),"Sugar");
> INSERT INTO traits  VALUES("Added Chemicals",LAST_INSERT_ID(),"Brown
Dye");
> INSERT INTO traits  VALUES("Added Chemicals",LAST_INSERT_ID(),"Caramel
> coloring");




-- 
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 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]




RE: [PHP-DB] help me on projecting some tables

2001-11-16 Thread Tim Foster

A couple of questions:

> INSERT INTO traits  VALUES("Added Chemicals",LAST_INSERT_ID(),"Sugar");

1. Will LAST_INSERT_ID() work reliably in a multi-user environment? What happens if 
you're
in the middle of inserting a dozen records and someone else inserts a record? Does 
MySQL
keep the LAST_INSERT_ID()s separate (since the web application will see both 
transactions
as being done by the same "user")?

2. Is there any benefit to having a 3rd table to keep track of "characteristic"s ? I 
guess
that quesiton is best answered by examining the business needs. If the characteristics 
are
few and don't change often, it seems to me that you'd want a 3rd table to keep them. 
That
way, the spelling is similar, etc, and therefore you can do (accurate) queries based on
the characteristics (if the need ever came up)


TIM
-Whenever you hear a man speak of his love for his country, it
is a sure sign he expects to be paid for it.


> -Original Message-
> From: Rick Emery [mailto:[EMAIL PROTECTED]]

> CREATE TABLE products(
> product_id int auto_increment primary key,
> description char(50) default "",
> quantity int not null,
> unit enum ("each","lb","ounce","gallon","quart"),
> price decimal(5,2) not null
> )
>
> CREATE TABLE traits(
> characteristic char(25) default "",
> product_id int,
> description char(25)
> )
>
> In the above example, when you wanted to add  a characteristic for a
> particular product, you simply add a record into traits and set
> traits.product_id equal to products.product_id.  This will make it REAL EASY
> doing joins on this combo as well.  For example:
>
> INSERT INTO products VALUES(NULL, "Coca Cola",1,"ounce",0.39);
> INSERT INTO traits  VALUES("Liquid",LAST_INSERT_ID(),"Seltzer-based");
> INSERT INTO traits  VALUES("Added Chemicals",LAST_INSERT_ID(),"Sugar");
> INSERT INTO traits  VALUES("Added Chemicals",LAST_INSERT_ID(),"Brown Dye");
> INSERT INTO traits  VALUES("Added Chemicals",LAST_INSERT_ID(),"Caramel
> coloring");




-- 
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]




RE: [PHP-DB] help me on projecting some tables

2001-11-16 Thread matt stewart

yep, that first example was roughly what i was getting at, don't think i
explained it anywhere near as well as Rick though.

-Original Message-
From: Rick Emery [mailto:[EMAIL PROTECTED]]
Sent: 16 November 2001 14:17
To: PHP DB
Subject: RE: [PHP-DB] help me on projecting some tables


Carlo,

Your question is the reason for the invention of the relational database.
Please do NOT add columns for "planned expansion".  How many extra columns
would you need? 4? 10? 25? 100?  Such a schema is wasteful of storage.

There are several ways to go about this.  For example:

CREATE TABLE products(
product_id int auto_increment primary key,
description char(50) default "",
quantity int not null,
unit enum ("each","lb","ounce","gallon","quart"),
price decimal(5,2) not null
)

CREATE TABLE traits(
characteristic char(25) default "",
product_id int,
description char(25)
)

In the above example, when you wanted to add  a characteristic for a
particular product, you simply add a record into traits and set
traits.product_id equal to products.product_id.  This will make it REAL EASY
doing joins on this combo as well.  For example:

INSERT INTO products VALUES(NULL, "Coca Cola",1,"ounce",0.39);
INSERT INTO traits  VALUES("Liquid",LAST_INSERT_ID(),"Seltzer-based");
INSERT INTO traits  VALUES("Added Chemicals",LAST_INSERT_ID(),"Sugar");
INSERT INTO traits  VALUES("Added Chemicals",LAST_INSERT_ID(),"Brown Dye");
INSERT INTO traits  VALUES("Added Chemicals",LAST_INSERT_ID(),"Caramel
coloring");

To get all the characteristics for a given product:
SELECT * FROM products LEFT JOIN traits  USING(product_id) ORDER BY
char_1.characteristic

In another example, if multiple products will come in multiple styles, you
would create a table called STYLES and insert a record for each style
available:

CREATE TABLE styles(
color char(10) default "",
product_id int,
)

INSERT INTO products VALUES(NULL,"Bread",1,"each",1.49);
INSERT INTO styles VALUES( "White",LAST_INSERT_ID() );
INSERT INTO styles VALUES( "Black",LAST_INSERT_ID() );
INSERT INTO styles VALUES( "Wheat",LAST_INSERT_ID() );
INSERT INTO styles VALUES( "Hawaiian",LAST_INSERT_ID() );

-Original Message-
From: matt stewart [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 16, 2001 5:55 AM
To: 'Carlo Loiudice'; PHP DB
Subject: RE: [PHP-DB] help me on projecting some tables


not really sure how to do this, other than planning for as much as you can
in your original tables, then have a spare table with four columns - Row_ID,
Characteristic_Name, Characteristic_Value, and Product_Refer_ID.
so then if you get a new characteristic (eg colour) then you could have
values 1, colour, blue, 4(the product with this characteristic).
then the next line might be 2,colour,green,8
then 2,density,45kg/m3,8

etc.
not sure this is the best way, but the only way i can think of to have
various additional characteristics for some products.
hope it helps??
Matt

-Original Message-
From: Carlo Loiudice [mailto:[EMAIL PROTECTED]]
Sent: 16 November 2001 10:48
To: PHP DB
Subject: [PHP-DB] help me on projecting some tables


Hi,
I've to store in a BD some alimentary product, and
there are lot of informations like chemical, physical,
nutritional characteristics , ...
I don't know how to store this info.
So I've a lot of product with a lot of corresponding
characteristics.

I've thought about to create a table where to store
all chemical characteristics, a table for nutritional,
ecc. and put in the product table the refer ID to all
this caracteristic tables. 
But in this way, there's the problem that now I'm
storing 3 chemical charact. but tomorrow I'd like to
add a new charact., and I wouldn't change tha table
structure adding a new column every time I've a new
field that I haven't expected.

Can someone show me the right strategy to resolve this
kind of problem?

Ciao, Carlo

__

Abbonati a Yahoo! ADSL con Atlanet!
Naviga su Internet ad alta velocità, e senza limiti di tempo! 
Per saperne di più vai alla pagina http://adsl.yahoo.it

-- 
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]

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.295 / Virus Database: 159 - Release Date: 01/11/01
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.295 / Virus Database: 159 - Release Date: 01/11/01
 

-- 
PHP Database Mailing List (http://www

RE: [PHP-DB] help me on projecting some tables

2001-11-16 Thread Rick Emery

Carlo,

Your question is the reason for the invention of the relational database.
Please do NOT add columns for "planned expansion".  How many extra columns
would you need? 4? 10? 25? 100?  Such a schema is wasteful of storage.

There are several ways to go about this.  For example:

CREATE TABLE products(
product_id int auto_increment primary key,
description char(50) default "",
quantity int not null,
unit enum ("each","lb","ounce","gallon","quart"),
price decimal(5,2) not null
)

CREATE TABLE traits(
characteristic char(25) default "",
product_id int,
description char(25)
)

In the above example, when you wanted to add  a characteristic for a
particular product, you simply add a record into traits and set
traits.product_id equal to products.product_id.  This will make it REAL EASY
doing joins on this combo as well.  For example:

INSERT INTO products VALUES(NULL, "Coca Cola",1,"ounce",0.39);
INSERT INTO traits  VALUES("Liquid",LAST_INSERT_ID(),"Seltzer-based");
INSERT INTO traits  VALUES("Added Chemicals",LAST_INSERT_ID(),"Sugar");
INSERT INTO traits  VALUES("Added Chemicals",LAST_INSERT_ID(),"Brown Dye");
INSERT INTO traits  VALUES("Added Chemicals",LAST_INSERT_ID(),"Caramel
coloring");

To get all the characteristics for a given product:
SELECT * FROM products LEFT JOIN traits  USING(product_id) ORDER BY
char_1.characteristic

In another example, if multiple products will come in multiple styles, you
would create a table called STYLES and insert a record for each style
available:

CREATE TABLE styles(
color char(10) default "",
product_id int,
)

INSERT INTO products VALUES(NULL,"Bread",1,"each",1.49);
INSERT INTO styles VALUES( "White",LAST_INSERT_ID() );
INSERT INTO styles VALUES( "Black",LAST_INSERT_ID() );
INSERT INTO styles VALUES( "Wheat",LAST_INSERT_ID() );
INSERT INTO styles VALUES( "Hawaiian",LAST_INSERT_ID() );

-Original Message-
From: matt stewart [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 16, 2001 5:55 AM
To: 'Carlo Loiudice'; PHP DB
Subject: RE: [PHP-DB] help me on projecting some tables


not really sure how to do this, other than planning for as much as you can
in your original tables, then have a spare table with four columns - Row_ID,
Characteristic_Name, Characteristic_Value, and Product_Refer_ID.
so then if you get a new characteristic (eg colour) then you could have
values 1, colour, blue, 4(the product with this characteristic).
then the next line might be 2,colour,green,8
then 2,density,45kg/m3,8

etc.
not sure this is the best way, but the only way i can think of to have
various additional characteristics for some products.
hope it helps??
Matt

-Original Message-
From: Carlo Loiudice [mailto:[EMAIL PROTECTED]]
Sent: 16 November 2001 10:48
To: PHP DB
Subject: [PHP-DB] help me on projecting some tables


Hi,
I've to store in a BD some alimentary product, and
there are lot of informations like chemical, physical,
nutritional characteristics , ...
I don't know how to store this info.
So I've a lot of product with a lot of corresponding
characteristics.

I've thought about to create a table where to store
all chemical characteristics, a table for nutritional,
ecc. and put in the product table the refer ID to all
this caracteristic tables. 
But in this way, there's the problem that now I'm
storing 3 chemical charact. but tomorrow I'd like to
add a new charact., and I wouldn't change tha table
structure adding a new column every time I've a new
field that I haven't expected.

Can someone show me the right strategy to resolve this
kind of problem?

Ciao, Carlo

__

Abbonati a Yahoo! ADSL con Atlanet!
Naviga su Internet ad alta velocità, e senza limiti di tempo! 
Per saperne di più vai alla pagina http://adsl.yahoo.it

-- 
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]

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.295 / Virus Database: 159 - Release Date: 01/11/01
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.295 / Virus Database: 159 - Release Date: 01/11/01
 

-- 
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 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]




RE: [PHP-DB] help me on projecting some tables

2001-11-16 Thread matt stewart

not really sure how to do this, other than planning for as much as you can
in your original tables, then have a spare table with four columns - Row_ID,
Characteristic_Name, Characteristic_Value, and Product_Refer_ID.
so then if you get a new characteristic (eg colour) then you could have
values 1, colour, blue, 4(the product with this characteristic).
then the next line might be 2,colour,green,8
then 2,density,45kg/m3,8

etc.
not sure this is the best way, but the only way i can think of to have
various additional characteristics for some products.
hope it helps??
Matt

-Original Message-
From: Carlo Loiudice [mailto:[EMAIL PROTECTED]]
Sent: 16 November 2001 10:48
To: PHP DB
Subject: [PHP-DB] help me on projecting some tables


Hi,
I've to store in a BD some alimentary product, and
there are lot of informations like chemical, physical,
nutritional characteristics , ...
I don't know how to store this info.
So I've a lot of product with a lot of corresponding
characteristics.

I've thought about to create a table where to store
all chemical characteristics, a table for nutritional,
ecc. and put in the product table the refer ID to all
this caracteristic tables. 
But in this way, there's the problem that now I'm
storing 3 chemical charact. but tomorrow I'd like to
add a new charact., and I wouldn't change tha table
structure adding a new column every time I've a new
field that I haven't expected.

Can someone show me the right strategy to resolve this
kind of problem?

Ciao, Carlo

__

Abbonati a Yahoo! ADSL con Atlanet!
Naviga su Internet ad alta velocità, e senza limiti di tempo! 
Per saperne di più vai alla pagina http://adsl.yahoo.it

-- 
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]

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.295 / Virus Database: 159 - Release Date: 01/11/01
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.295 / Virus Database: 159 - Release Date: 01/11/01
 

--
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]




RE: [PHP-DB] Help Me Fix My User Defined Funtion

2001-04-19 Thread Mark Roedel

> -Original Message-
> From: SOHH.com Webmaster [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 19, 2001 4:45 PM
> To: Mark Roedel
> Cc: [EMAIL PROTECTED]
> Subject: RE: [PHP-DB] Help Me Fix My User Defined Funtion
> 
> 
> However, since posting my question, I have solved it by doing 
> the following:
> 
>  while($row_listbyreads = mysql_fetch_array($result_listbyreads)) {
>   $sectionID = $row_listbyreads["sectionID"];
>   $contentcount = $row_listbyreads["contentcount"];
>   $contentheadline = 
> stripslashes($row_listbyreads["contentheadline"]);
>   $contentID = $row_listbyreads["contentID"];
> 
> ?>
> 
> 
> 
> 
>  }
> ?>
> 
> Which works but what if I wanted to use the results to do 
> something else?  Like take the string ($link) and count the
> lenght of it (just an example).

You can keep calling the function every time you need the value

$stringlength =
strlen(generatesectionlink($sectionID,$contentID);

OR

you could just assign the return-value of the function to a variable and
use that for the remainder of that run through the loop.

$thislink = generatesectionlink($sectionID,$contentID);
$linklength = strlen($thislink);
echo $thislink;


---
Mark Roedel   | "The most overlooked advantage to owning a
Systems Programmer|  computer is that if they foul up there's no
LeTourneau University |  law against whacking them around a little."
Longview, Texas, USA  |  -- Owen Porterfield 

--
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]




RE: [PHP-DB] Help Me Fix My User Defined Funtion

2001-04-19 Thread SOHH.com Webmaster

Ok, fair enough.

Basically the top had all my MySQL calls and then it's followed by -








However, since posting my question, I have solved it by doing the following:








Which works but what if I wanted to use the results to do something else?
Like take the string ($link) and count the lenght of it (just an example).

Steven

-Original Message-
From: Mark Roedel [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 19, 2001 11:21 AM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Help Me Fix My User Defined Funtion


> -Original Message-
> From: SOHH.com Webmaster [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 19, 2001 3:32 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Help Me Fix My User Defined Funtion
>
>
> I created a funciton to pass two variables and create a
> dynamic link.  It doesn't give me an error, but it doesn't
> give me the results either.  What am I missing in my
> function?  (It's down below)

The function itself looks fine to me...is it possible there's a problem
in the way you're calling it?  (How 'bout a code snippet showing that as
well...)


---
Mark Roedel ([EMAIL PROTECTED])  ||  "There cannot be a crisis next week.
Systems Programmer / WebMaster  ||   My schedule is already full."
 LeTourneau University  ||-- Henry Kissinger


-- 
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]




Re: [PHP-DB] Help Me!

2001-02-02 Thread Stas Trefilov

Hello, "Sridhar Ranganathan"!
You wrote:

> What should I do?
> 

See the strip_tags() function.

-- 
Piloteers do it on the road


-- 
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]




Re: [PHP-DB] Help Me!

2001-01-31 Thread Beau Lebens

the way i have attacked a similar situation in the past was to create my 
own formatting system - kind of a pseudo-html set-up, which made use of 
conventions like;

**bold**
%%italic%%
__underline__
!!titlefont!!

etc etc
then you can save the article directly into the DB, as a text or whatever, 
and when you print it out, do something like;

echo specialTxtFormat($articleBody);

a function which would include a call to nl2br() as well as the replacement 
of things like

**bold** for bold

enjoy

At 04:13 AM 2/1/01 +, Sridhar Ranganathan wrote:
>Hi Netlanders
>
>I have just undertaken a web site construction project. It is a devshed 
>like site that serves articles on various topics. I am using LAMP - 
>Linux/Apache/MySQL/PHP 4. I have a table that contains info about each 
>article. I think I have three options...(or do I have more that I dont 
>know of?!)
>
> 1. Store the article body in the database as a LONGTEXT or BLOB
> 2. Separate plain text file
> 3. Separate HTML formatted file
>
>No matter whether the file is in the database or as a separate file, 
>should it be formatted?
>If it is plain text, how do I make distinctions between bold text and 
>normal text?
>(Will fread() using PHP give me '\n' and other such characters too?)
>If it is HTML formatted, I would loose some control over the look and I 
>would have to copy and paste the plain text article and make it a HTML file.
>
>What should I do?
>
>I know I have already asked this question and got some answers. But, when 
>I proceeded with the project, I kept comming back to this one point. A 
>long answer might help. Looking forward to your help.
>
>Regards
>Srinivasan Ranganathan
>_
>Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>
>
>--
>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]

-- 
Beau Lebens - Web Master
Insurance My Way, Your Friendly Online Broker
(08) 9226 5888
http://www.insurancemyway.com.au/


-- 
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]




Re: [PHP-DB] Help Me!

2001-01-31 Thread phobo

Why bother with pseudo ?

Just only have , , and  allowed in the database. Also, storing the
 and  tags may be important. Be sure not to do things like allowing
font color or face; although relative size might be ok (FONT SIZE="-1") etc.

Siggy

- Original Message -
From: "Beau Lebens" <[EMAIL PROTECTED]>
To: "Sridhar Ranganathan" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Thursday, February 01, 2001 5:46 PM
Subject: Re: [PHP-DB] Help Me!


> the way i have attacked a similar situation in the past was to create my
> own formatting system - kind of a pseudo-html set-up, which made use of
> conventions like;
>
> **bold**
> %%italic%%
> __underline__
> !!titlefont!!
>
> etc etc
> then you can save the article directly into the DB, as a text or whatever,
> and when you print it out, do something like;
>
> echo specialTxtFormat($articleBody);
>
> a function which would include a call to nl2br() as well as the
replacement
> of things like
>
> **bold** for bold
>
> enjoy
>
> At 04:13 AM 2/1/01 +, Sridhar Ranganathan wrote:
> >Hi Netlanders
> >
> >I have just undertaken a web site construction project. It is a devshed
> >like site that serves articles on various topics. I am using LAMP -
> >Linux/Apache/MySQL/PHP 4. I have a table that contains info about each
> >article. I think I have three options...(or do I have more that I dont
> >know of?!)
> >
> > 1. Store the article body in the database as a LONGTEXT or BLOB
> > 2. Separate plain text file
> > 3. Separate HTML formatted file
> >
> >No matter whether the file is in the database or as a separate file,
> >should it be formatted?
> >If it is plain text, how do I make distinctions between bold text and
> >normal text?
> >(Will fread() using PHP give me '\n' and other such characters too?)
> >If it is HTML formatted, I would loose some control over the look and I
> >would have to copy and paste the plain text article and make it a HTML
file.
> >
> >What should I do?
> >
> >I know I have already asked this question and got some answers. But, when
> >I proceeded with the project, I kept comming back to this one point. A
> >long answer might help. Looking forward to your help.
> >
> >Regards
> >Srinivasan Ranganathan
> >_
> >Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
> >
> >
> >--
> >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]
>
> --
> Beau Lebens - Web Master
> Insurance My Way, Your Friendly Online Broker
> (08) 9226 5888
> http://www.insurancemyway.com.au/
>
>
> --
> 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 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]