[PHP-DB] Help me with this someone
i get the error: Warning: mysql_pconnect() [function.mysql-pconnect]: Lost connection to MySQL server during query in /home/www/broadwaysecure.biz.nf/Index.php on line 9 Could not connect : Lost connection to MySQL server during query I have done everything to connect to my database but its not working this is my database information: host: fdb1.biz.nf or 82.197.130.17 (pinged and working) db name: 218708_accounts pass:
[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
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 (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 joefa...@gmail.com To: php-db@lists.php.net 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 JOIN 3 tables. - fixed query
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 yves.suc...@usa.net To: php-db@lists.php.net 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 joefa...@gmail.com To: php-db@lists.php.net 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 please
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 please
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
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
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
[PHP-DB] Help me please
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-DB] Help me please!!!!! (MSSQL + IIS + PHP)
Hi to every one, i have the next problem: I'm trying to connect to Microsoft SQL Server 6.5 with PHP and Internet Information Server in Microsoft Windows 2000 Professional, and everything is ok when i do it via ODBC but i want to include specific functions of SQL Server that come included with PHP so i decoment the line extension=mssql.dll in php.ini, and works but the computer becomes very slow and the memory and processor resources get very high like 300MB of memory and 90%CPU, even whitout a sql querry, nothing run, all is so slow until i shut down IIS. PLEASE HELP ME!, i heard that it can be a windows problem is it true? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] help me..!
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
Re: [PHP-DB] help me..!
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
[PHP-DB] help me
i can't use start_secsion(); in php4, it say: error : can't ofen(\tmp/4363jghsfjkhshga.. like this...
Re: [PHP-DB] help me
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
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 khacduyst@sg. To: [EMAIL PROTECTED] 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
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
[PHP-DB] HELP ME PLEASE: php not run on IIS 4.0
Hi, Im trying to install PHP 4.1.2 under Windows 2000 Server and IIS 4.0 * If I configure PHP as a MODULE, all run but SESSIONS DON'T WORK * If I configure PHP as a CGI, SESSIONS WORK but ORACLE MODULE for PHP not load Any ideas? Anybody can help me? Advanced thanks, Berli -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Help me with php script calculate Download time of file
Hi everyone, Could anyone help me giving a php code that calculates time required to download a url (including downloading of images in that particular url). if you could tell me the site also it would be great helpful to you people. Thank You E.chidmbaram For Stock Quotes, Finance News, Insurance, Tax Planners, Mutual Funds... Visit http://in.finance.yahoo.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]
[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]
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]
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.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
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 characteristics ? 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
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 characteristics ? 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]
[PHP-DB] help me with DBA
When i execute the following codes: ?php $db=dba_open(database.db,c,db2); ? an error occurs: Warning: no such handler: db2 in D:\Inetpub\WebSite/dba_test.php on line 2 -- 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] Help Me!
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]