RE: [PHP-DB] newbie help
This may be overkill for what you're doing, but based upon your layout, you might consider a nested set. Since you're a newb, it may be too complex to code: http://dev.mysql.com/tech-resources/articles/hierarchical-data.html This is how you setup products and categories for example I think your solution is much simpler and could simply use a few "glue tables" and some flags so you know which table to look in (reseller, customer, etc) > -Original Message- > From: nhadie [mailto:[EMAIL PROTECTED] > Sent: Thursday, September 27, 2007 8:31 PM > To: php-db@lists.php.net > Subject: [PHP-DB] newbie help > > Hi All, > > I would like to setup a system something like this > > > > customer A > > > /\ > > > cust 1cust 2 > > > / \ \ > > cust B cust C cust D > > customer A has customer 1 and 2, cust 1 has cust B and C etc, etc. > what i'm after is when a customer user logs in he can only > see record > of its customer, e.g cust A logs in, it can only see records > of cust 1 and cust 2, > if cust 2 is login it can only see cust D and so on > > how would i approach this? should every customer have it's > own database, > consisting of all tables i need e.g customer detail table, > and i will use the database name as session variable, so > that when they > add records it be inserted on table under that database? > > sorry if my questions are confusing, hope anyone can help me, i just > need help on how to approach it at the beginning so it will > not be messy > later on. Thank you. > > Regards, > Nhadie > > -- > 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] newbie help
I'd like to apologize to both of you, this is my fault as i did not really clear what my requirements are . basically it will be for my VoIP system, Customer A (which is me) will have customers that may also be a reseller, so this is where Cust 1 will have Cust B. Each customer will have a login name, that they can use to check cdr's, view their rates, create rates for their customers (if customer is a reseller, so that they can top-up whatever rate was assigned to it by its parent) billing (sending invoice via e-mail) and trouble ticket. that's what is in the plan for now. Thank you Regards, Nhadie TG wrote: Nice blanket statements, Bob. What, exactly, is wrong with what I'm describing? What I've tried to do, without having more information about the type of data and how he intends to use it, is give a high level idea of things that could be tried. There's no way I can give an exact breakdown of exactly how to configure anything without more information. All I did was outline some general schemes that COULD be used on a high level. Not trying to start a fight, but your message is borderline trolling (and of course I'm responding... falling for it.. but I assume it wasn't meant as a troll post). It's not the BEST advice I could give because I don't have all the information. Not saying I'm the smartest person on this list, but when someone is looking for ideas, some ideas to try.. so you can grow and learn at the very least.. are better than none. If a better idea comes along, all the better. Hopefully the better solution will get posted to the list. I'm not sure anything I said is as backwards as you make it out to be. So let's keep it constructive. If you can point out clearly what I said that's terribly wrong and give a better solution, please enlighten. Always willing to learn new things if they are, indeed, better. -TG - Original Message - From: "Bob Chatman" <[EMAIL PROTECTED]> To: TG <[EMAIL PROTECTED]> Cc: nhadie <[EMAIL PROTECTED]>, php-db@lists.php.net Date: Fri, 28 Sep 2007 23:23:41 -0700 Subject: Re: [PHP-DB] newbie help This is definitely not the best advice in the world. The truth is you could staple your eye lids open and never blink, but it wouldn't be very beneficial. I highly suggest you invest some of your time in reading about databases and how relational databases work, and more than that how they work well, instead of trying to create some monster that will end up causing you more stress than income. I would also suggest you sit down and try to plan out whatever the hell you are trying to do before you get too crazy. If you code like you describe things here you are bound to confuse variable names and thats just crazy. Try to clean up your idea and ill gladly direct you to some of your options. and most of all, dont try to do this as TG has described here. On 9/28/07, TG <[EMAIL PROTECTED]> wrote: How resource intensive it is depends a lot on how much data you have and what you're doing with it. You want to reduce the number of connections and disconnects, since those are really intensive, but if everything is on the same server, you can do cross database queries. As for the table size exceeding the OS limit, that'd take quite a bit of data to do. With proper database design, that shouldn't be too much of an issue. If you have 2+gb of data in a single table, that's one monster table. Some info here about table size restrictions for MySQL: http://dev.mysql.com/doc/refman/4.1/en/full-table.html You could create a table and stuff it full of thousands of records and try to check the physical file size of that table's file and see how tricky it would be to actually 'fill' a table. Ideally, for your 'customer' table would contain just the data that was unique to that customer. Typically data that all your customers are going to have a single entry for so you don't have a lot of empty spots. Anything that you have multiple entries for or are unique to a single customer, you could put in another table as meta data (additional information that didn't fit in the main table). You probably want to ignore my original parent/child threading idea. I was just illustrating a way that you COULD do it. What you may want to do is have a 'customers' table, which contain your customers, then another table for the base information for your customer's customers with an ID field that matches the entry in your 'customers' table. For additional tables in the database, you could do something like you meantioned... have "custname1_tablename1" and use a code in your "customers" table to indicate the table prefix. This kind of thing is used a lot in systems like phpBB, Gallery, etc so you can have multiple copies installe
Re: [PHP-DB] newbie help
Nice blanket statements, Bob. What, exactly, is wrong with what I'm describing? What I've tried to do, without having more information about the type of data and how he intends to use it, is give a high level idea of things that could be tried. There's no way I can give an exact breakdown of exactly how to configure anything without more information. All I did was outline some general schemes that COULD be used on a high level. Not trying to start a fight, but your message is borderline trolling (and of course I'm responding... falling for it.. but I assume it wasn't meant as a troll post). It's not the BEST advice I could give because I don't have all the information. Not saying I'm the smartest person on this list, but when someone is looking for ideas, some ideas to try.. so you can grow and learn at the very least.. are better than none. If a better idea comes along, all the better. Hopefully the better solution will get posted to the list. I'm not sure anything I said is as backwards as you make it out to be. So let's keep it constructive. If you can point out clearly what I said that's terribly wrong and give a better solution, please enlighten. Always willing to learn new things if they are, indeed, better. -TG - Original Message - From: "Bob Chatman" <[EMAIL PROTECTED]> To: TG <[EMAIL PROTECTED]> Cc: nhadie <[EMAIL PROTECTED]>, php-db@lists.php.net Date: Fri, 28 Sep 2007 23:23:41 -0700 Subject: Re: [PHP-DB] newbie help > This is definitely not the best advice in the world. The truth is you could > staple your eye lids open and never blink, but it wouldn't be very > beneficial. I highly suggest you invest some of your time in reading about > databases and how relational databases work, and more than that how they > work well, instead of trying to create some monster that will end up causing > you more stress than income. > > I would also suggest you sit down and try to plan out whatever the hell you > are trying to do before you get too crazy. If you code like you describe > things here you are bound to confuse variable names and thats just crazy. > Try to clean up your idea and ill gladly direct you to some of your options. > and most of all, dont try to do this as TG has described here. > > On 9/28/07, TG <[EMAIL PROTECTED]> wrote: > > > > > > How resource intensive it is depends a lot on how much data you have and > > what > > you're doing with it. You want to reduce the number of connections and > > disconnects, since those are really intensive, but if everything is on the > > same server, you can do cross database queries. > > > > As for the table size exceeding the OS limit, that'd take quite a bit of > > data > > to do. With proper database design, that shouldn't be too much of an > > issue. If you have 2+gb of data in a single table, that's one monster > > table. > > > > Some info here about table size restrictions for MySQL: > > http://dev.mysql.com/doc/refman/4.1/en/full-table.html > > > > You could create a table and stuff it full of thousands of records and try > > to > > check the physical file size of that table's file and see how tricky it > > would be to actually 'fill' a table. > > > > > > Ideally, for your 'customer' table would contain just the data that was > > unique to that customer. Typically data that all your customers are going > > to have a single entry for so you don't have a lot of empty spots. > > Anything that you have multiple entries for or are unique to a single > > customer, you could put in another table as meta data (additional > > information that didn't fit in the main table). > > > > You probably want to ignore my original parent/child threading idea. I > > was > > just illustrating a way that you COULD do it. > > > > What you may want to do is have a 'customers' table, which contain your > > customers, then another table for the base information for your customer's > > customers with an ID field that matches the entry in your 'customers' > > table. > > > > For additional tables in the database, you could do something like you > > meantioned... have "custname1_tablename1" and use a code in your > > "customers" table to indicate the table prefix. > > > > This kind of thing is used a lot in systems like phpBB, Gallery, etc so > > you > > can have multiple copies installed on the same server. It'd be the same > > idea when dealing with multiple customers. > > > > Just make sure tha
Re: [PHP-DB] newbie help
This is definitely not the best advice in the world. The truth is you could staple your eye lids open and never blink, but it wouldn't be very beneficial. I highly suggest you invest some of your time in reading about databases and how relational databases work, and more than that how they work well, instead of trying to create some monster that will end up causing you more stress than income. I would also suggest you sit down and try to plan out whatever the hell you are trying to do before you get too crazy. If you code like you describe things here you are bound to confuse variable names and thats just crazy. Try to clean up your idea and ill gladly direct you to some of your options. and most of all, dont try to do this as TG has described here. On 9/28/07, TG <[EMAIL PROTECTED]> wrote: > > > How resource intensive it is depends a lot on how much data you have and > what > you're doing with it. You want to reduce the number of connections and > disconnects, since those are really intensive, but if everything is on the > same server, you can do cross database queries. > > As for the table size exceeding the OS limit, that'd take quite a bit of > data > to do. With proper database design, that shouldn't be too much of an > issue. If you have 2+gb of data in a single table, that's one monster > table. > > Some info here about table size restrictions for MySQL: > http://dev.mysql.com/doc/refman/4.1/en/full-table.html > > You could create a table and stuff it full of thousands of records and try > to > check the physical file size of that table's file and see how tricky it > would be to actually 'fill' a table. > > > Ideally, for your 'customer' table would contain just the data that was > unique to that customer. Typically data that all your customers are going > to have a single entry for so you don't have a lot of empty spots. > Anything that you have multiple entries for or are unique to a single > customer, you could put in another table as meta data (additional > information that didn't fit in the main table). > > You probably want to ignore my original parent/child threading idea. I > was > just illustrating a way that you COULD do it. > > What you may want to do is have a 'customers' table, which contain your > customers, then another table for the base information for your customer's > customers with an ID field that matches the entry in your 'customers' > table. > > For additional tables in the database, you could do something like you > meantioned... have "custname1_tablename1" and use a code in your > "customers" table to indicate the table prefix. > > This kind of thing is used a lot in systems like phpBB, Gallery, etc so > you > can have multiple copies installed on the same server. It'd be the same > idea when dealing with multiple customers. > > Just make sure that the prefix you use for a customer doesn't use > characters > that are bad for table names. > > What kind of data are you thinking about storing for your customers and > your > customer's customers? And what other data do you need to store for > whatever your webapp does? > > -TG > > > - Original Message - > From: nhadie <[EMAIL PROTECTED]> > To: php-db@lists.php.net > Date: Fri, 28 Sep 2007 23:49:23 +0800 > Subject: Re: [PHP-DB] newbie help > > > Thanks for your reply, which solution would be faster and not put too > > much load on the resources of the server? single or multiple database? > > If i use a single database, would i be having same tables for each > > customer, e.g. if i have customerinfo table for customers of A, > > would i also have customerinfo table on customer 1 and 2 and so on, but > > changing the name by prefixing something to the table name e.g > > cust1_customerinfo. > > i'm thinking if i use only a single table for, then i might have > > problems on the file size limit of the OS, would i have that problem? > > > > thanks again for your help, i really,really appreciate it. > > > > regards, > > nhadie > > > > > > > > > > TG wrote: > > > You could do separate databases if you want. It all depends on how > you > > want > > > to organize your data (keeping in mind data backup strategies and > stuff). > > > > > > Using separate databases on the same server, you might have another > > database > > > for the 'common' data. Any variables you store in the database that > > don't > > > really change and are common to all databases. Or if you log anything > &
Re: [PHP-DB] newbie help
How resource intensive it is depends a lot on how much data you have and what you're doing with it. You want to reduce the number of connections and disconnects, since those are really intensive, but if everything is on the same server, you can do cross database queries. As for the table size exceeding the OS limit, that'd take quite a bit of data to do. With proper database design, that shouldn't be too much of an issue. If you have 2+gb of data in a single table, that's one monster table. Some info here about table size restrictions for MySQL: http://dev.mysql.com/doc/refman/4.1/en/full-table.html You could create a table and stuff it full of thousands of records and try to check the physical file size of that table's file and see how tricky it would be to actually 'fill' a table. Ideally, for your 'customer' table would contain just the data that was unique to that customer. Typically data that all your customers are going to have a single entry for so you don't have a lot of empty spots. Anything that you have multiple entries for or are unique to a single customer, you could put in another table as meta data (additional information that didn't fit in the main table). You probably want to ignore my original parent/child threading idea. I was just illustrating a way that you COULD do it. What you may want to do is have a 'customers' table, which contain your customers, then another table for the base information for your customer's customers with an ID field that matches the entry in your 'customers' table. For additional tables in the database, you could do something like you meantioned... have "custname1_tablename1" and use a code in your "customers" table to indicate the table prefix. This kind of thing is used a lot in systems like phpBB, Gallery, etc so you can have multiple copies installed on the same server. It'd be the same idea when dealing with multiple customers. Just make sure that the prefix you use for a customer doesn't use characters that are bad for table names. What kind of data are you thinking about storing for your customers and your customer's customers? And what other data do you need to store for whatever your webapp does? -TG - Original Message ----- From: nhadie <[EMAIL PROTECTED]> To: php-db@lists.php.net Date: Fri, 28 Sep 2007 23:49:23 +0800 Subject: Re: [PHP-DB] newbie help > Thanks for your reply, which solution would be faster and not put too > much load on the resources of the server? single or multiple database? > If i use a single database, would i be having same tables for each > customer, e.g. if i have customerinfo table for customers of A, > would i also have customerinfo table on customer 1 and 2 and so on, but > changing the name by prefixing something to the table name e.g > cust1_customerinfo. > i'm thinking if i use only a single table for, then i might have > problems on the file size limit of the OS, would i have that problem? > > thanks again for your help, i really,really appreciate it. > > regards, > nhadie > > > > > TG wrote: > > You could do separate databases if you want. It all depends on how you > want > > to organize your data (keeping in mind data backup strategies and stuff). > > > > Using separate databases on the same server, you might have another > database > > for the 'common' data. Any variables you store in the database that > don't > > really change and are common to all databases. Or if you log anything > and > > want to keep the log data in one central location, you could put it in > the > > 'common' database. > > > > > > If you wanted to store all the data in one database, you could use > something > > like forum threading techniques to show a parent/child relationship for > the > > customers. > > > > > > id nameparent > > 1 customerANULL > > 2 cust11 > > 3 cust21 > > 4 custB 2 > > 5 custC 2 > > 6 custD 3 > > > > > > Then it's just a matter of drilling down, collecting a list of ID's for > that > > customer and the sub-customers. > > > > Lotsof ways to tackle this problem. > > > > -TG > > > > > > > > - Original Message - > > From: nhadie <[EMAIL PROTECTED]> > > To: php-db@lists.php.net > > Date: Fri, 28 Sep 2007
Re: [PHP-DB] newbie help
Thanks for your reply, which solution would be faster and not put too much load on the resources of the server? single or multiple database? If i use a single database, would i be having same tables for each customer, e.g. if i have customerinfo table for customers of A, would i also have customerinfo table on customer 1 and 2 and so on, but changing the name by prefixing something to the table name e.g cust1_customerinfo. i'm thinking if i use only a single table for, then i might have problems on the file size limit of the OS, would i have that problem? thanks again for your help, i really,really appreciate it. regards, nhadie TG wrote: You could do separate databases if you want. It all depends on how you want to organize your data (keeping in mind data backup strategies and stuff). Using separate databases on the same server, you might have another database for the 'common' data. Any variables you store in the database that don't really change and are common to all databases. Or if you log anything and want to keep the log data in one central location, you could put it in the 'common' database. If you wanted to store all the data in one database, you could use something like forum threading techniques to show a parent/child relationship for the customers. id nameparent 1 customerANULL 2 cust11 3 cust21 4 custB 2 5 custC 2 6 custD 3 Then it's just a matter of drilling down, collecting a list of ID's for that customer and the sub-customers. Lotsof ways to tackle this problem. -TG - Original Message - From: nhadie <[EMAIL PROTECTED]> To: php-db@lists.php.net Date: Fri, 28 Sep 2007 11:30:42 +0800 Subject: [PHP-DB] newbie help Hi All, I would like to setup a system something like this customer A /\ cust 1cust 2 / \ \ cust B cust C cust D customer A has customer 1 and 2, cust 1 has cust B and C etc, etc. what i'm after is when a customer user logs in he can only see record of its customer, e.g cust A logs in, it can only see records of cust 1 and cust 2, if cust 2 is login it can only see cust D and so on how would i approach this? should every customer have it's own database, consisting of all tables i need e.g customer detail table, and i will use the database name as session variable, so that when they add records it be inserted on table under that database? sorry if my questions are confusing, hope anyone can help me, i just need help on how to approach it at the beginning so it will not be messy later on. Thank you. Regards, Nhadie -- 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] newbie help
You could do separate databases if you want. It all depends on how you want to organize your data (keeping in mind data backup strategies and stuff). Using separate databases on the same server, you might have another database for the 'common' data. Any variables you store in the database that don't really change and are common to all databases. Or if you log anything and want to keep the log data in one central location, you could put it in the 'common' database. If you wanted to store all the data in one database, you could use something like forum threading techniques to show a parent/child relationship for the customers. id nameparent 1 customerANULL 2 cust11 3 cust21 4 custB 2 5 custC 2 6 custD 3 Then it's just a matter of drilling down, collecting a list of ID's for that customer and the sub-customers. Lotsof ways to tackle this problem. -TG - Original Message - From: nhadie <[EMAIL PROTECTED]> To: php-db@lists.php.net Date: Fri, 28 Sep 2007 11:30:42 +0800 Subject: [PHP-DB] newbie help > Hi All, > > I would like to setup a system something like this > > > customer A > > /\ > > > cust 1cust 2 > > > / \ \ > > cust B cust C cust D > > customer A has customer 1 and 2, cust 1 has cust B and C etc, etc. > what i'm after is when a customer user logs in he can only see record > of its customer, e.g cust A logs in, it can only see records of cust 1 and > cust 2, > if cust 2 is login it can only see cust D and so on > > how would i approach this? should every customer have it's own database, > consisting of all tables i need e.g customer detail table, > and i will use the database name as session variable, so that when they > add records it be inserted on table under that database? > > sorry if my questions are confusing, hope anyone can help me, i just > need help on how to approach it at the beginning so it will not be messy > later on. Thank you. > > Regards, > Nhadie > > -- > 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] newbie help
Hi All, I would like to setup a system something like this customer A /\ cust 1cust 2 / \ \ cust B cust C cust D customer A has customer 1 and 2, cust 1 has cust B and C etc, etc. what i'm after is when a customer user logs in he can only see record of its customer, e.g cust A logs in, it can only see records of cust 1 and cust 2, if cust 2 is login it can only see cust D and so on how would i approach this? should every customer have it's own database, consisting of all tables i need e.g customer detail table, and i will use the database name as session variable, so that when they add records it be inserted on table under that database? sorry if my questions are confusing, hope anyone can help me, i just need help on how to approach it at the beginning so it will not be messy later on. Thank you. Regards, Nhadie -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Newbie help
http://www.php.net/manual/en/install.windows.php -Original Message- From: Nicola Hartland [mailto:[EMAIL PROTECTED] Sent: Saturday, September 06, 2003 4:29 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Newbie help I need some help to install and configure php I have tried downloading it a dozen times to configure it on Apache on xp but I cannot seem to get it to talk to my sql could someone provide me with an idiots guide to installing it please? Thanks in advance Nicci -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Newbie help
I need some help to install and configure php I have tried downloading it a dozen times to configure it on Apache on xp but I cannot seem to get it to talk to my sql could someone provide me with an idiots guide to installing it please? Thanks in advance Nicci
[PHP-DB] Newbie? - help inserting into firebird1.0
hi. i'm running: php4, firebird 1.0, and IIS all on win2k. i'm just getting started with php and firebird, so please forgive me if the error is obvious. i hunted around for examples, the best of which i've found btw is at http://www.ibphoenix.com/ibp_howto1.html - thought i did this right, i have no trouble selecting from the database but inserting is giving me some grief... my table: RECREATE TABLE BUGS ( BUG_ID INTEGER NOT NULL, APP VARCHAR(25) CHARACTER SET NONE COLLATE NONE, APP_VERSION DECIMAL( 3, 2), BUILD VARCHAR( 5) CHARACTER SET NONE COLLATE NONE, OS VARCHAR(25) CHARACTER SET NONE COLLATE NONE, SEVERITY VARCHAR(25) CHARACTER SET NONE COLLATE NONE, BUG_PRIORITY VARCHAR( 5) CHARACTER SET NONE COLLATE NONE, BUG_STATE VARCHAR(10) CHARACTER SET NONE COLLATE NONE, SB_USER VARCHAR(25) CHARACTER SET NONE COLLATE NONE, STEPS VARCHAR( 500) CHARACTER SET NONE COLLATE NONE, EXPECTED VARCHAR( 500) CHARACTER SET NONE COLLATE NONE, OBSERVED VARCHAR( 500) CHARACTER SET NONE COLLATE NONE, OPENED DATE, CLOSED DATE, HYPOTHESIS VARCHAR( 500) CHARACTER SET NONE COLLATE NONE, SOLUTION VARCHAR( 500) CHARACTER SET NONE COLLATE NONE, STATUS VARCHAR(15) CHARACTER SET NONE COLLATE NONE ) and then the add_issue.php "; exit; } $query="insert into BUGS (APP, APP_VERSION, BUILD, OS, SEVERITY, BUG_PRIORITY, BUG_STATE, SB_USER, STEPS, EXPECTED, OBSERVED, STATUS, OPENED) values ("$txtApp","$numVersion","$txtBuild","$txtOs", "$frmSeverity", "$numPriority", "$txtState", "$txtUser", "$txtSteps", "$txtExpected", "$txtObserved", "$frmStatus", "NOW");"; $result=ibase_query($conn,$query); if (!$result) { echo "Error. Can't insert the record with the query: $query! $back"; exit; } echo "Record saved. $back"; ibase_close($conn); ?> finally, the error message: Warning: InterBase: Dynamic SQL Error SQL error code = -104 Token unknown - line 3, char 47 , in C:\Inetpub\dev_root\slugbug\issue_send2.php on line 18 Error. Can't insert the record with the query: insert into BUGS (APP, APP_VERSION, BUILD, OS, SEVERITY, BUG_PRIORITY, BUG_STATE, SB_USER, STEPS, EXPECTED, OBSERVED, STATUS, OPENED) values (games/software,1.0,rc1,win2000, , 5, , jds, [PHP-DB][PHP-DB][PHP-DB][PHP-DB], [PHP-DB][PHP-DB][PHP-DB][PHP-DB], [PHP-DB][PHP-DB][PHP-DB][PHP-DB][PHP-DB][PHP-DB][PHP-DB]', , NOW);! ---do i need to do some string conversion here? or the INSERT statement wrong? a combination of the two? i'm currently RingTFM, but any help would be greatly appreciated. TIA! jon-david -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Newbie help with cookies/sessions
Probably you are using windows. In the php.ini there is a setting where session files have to be stored. The default is /tmp which under windows is relative to the current drive where is php installed. I see that you changed this parameter. I think that there is no such directory /Temp on the drive where PHP resides(create it). Check for that. Best regards, Andrey Hristov IcyGEN Corporation http://www.icygen.com BALANCED SOLUTIONS - Original Message - From: "Kevin Ruiz" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, November 27, 2001 4:32 PM Subject: [PHP-DB] Newbie help with cookies/sessions > I'm new to the PHP and Mysql world and I hope I have an problem that can be > answered quickly. It seems simple but who knows. > > Whenever I try to use cookies or start a session I get the following error: > > Warning: open(/Temp\sess_ba759cb3d78fadb70745ca480f1d8661, O_RDWR) > failed: m (2) in Unknown on line 0 > Warning: Failed to write session data (files). Please verify that > the current setting of session.save_path is correct (/Temp) in Unknown on > line 0 > > I tried checking the session.save_path setting the php.ini but I'm not sure > if this has to saved to a specific directory or just a valid directory. > > Any help would be greatly appreciated. > > Thank you. > Kevin > > > > -- > 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] Newbie help with cookies/sessions
I'm new to the PHP and Mysql world and I hope I have an problem that can be answered quickly. It seems simple but who knows. Whenever I try to use cookies or start a session I get the following error: Warning: open(/Temp\sess_ba759cb3d78fadb70745ca480f1d8661, O_RDWR) failed: m (2) in Unknown on line 0 Warning: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/Temp) in Unknown on line 0 I tried checking the session.save_path setting the php.ini but I'm not sure if this has to saved to a specific directory or just a valid directory. Any help would be greatly appreciated. Thank you. Kevin -- 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] Newbie Help: Searching
have a form with something like then submit it to a page that might do something like $Query = "SELECT * FROM enet WHERE TechContact LIKE '%$TechContact%' AND AdminContact LIKE '%'"; which will locate anything CONTAINING what the user enters in the text field HTH Beau // -Original Message- // From: Devon [mailto:[EMAIL PROTECTED]] // Sent: Thursday, 6 September 2001 10:08 AM // To: [EMAIL PROTECTED] // Subject: [PHP-DB] Newbie Help: Searching // // // $Query = "SELECT * FROM enet WHERE TechContact LIKE '%' AND // AdminContact // LIKE '%'"; // // This query simply prints out my entire tables, is there a // way using PHP so I // can make the '%' a user input so they can search the table // under those // fields. // // Cheers // // // // -- // 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] Newbie Help: Searching
$Query = "SELECT * FROM enet WHERE TechContact LIKE '%' AND AdminContact LIKE '%'"; This query simply prints out my entire tables, is there a way using PHP so I can make the '%' a user input so they can search the table under those fields. Cheers -- 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] newbie help required re oracle
Ok I have looked at the faq and cant find the answer, all I seem to find is the question, everywhere and no help for stupid people like me. I want to use my Oracle db from php and apache. I understand I have to compile php4 with oracle selected as an option. I have failed to do this, and need help. Does anyone know where to go to get a compiled version of php4 with oracle, or can anyone point me to a location where i can get simple step by step instructions of what to do? please do not assume any knowledge of UNIX or C. I am a scriptor not a programmer and I have no knowledge of either, I just want a database connection! please help. RPK -- 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] newbie help
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Matt Coyne) wrote: > now does anyone know about getting ages from dates of birth (previous post > of mine) and also searching by age group when you only have dates of birth > in the table!! See the MySQL manual's chapter on date/time functions for many options. Personally, I'm a big fan of date_add() and date_sub() since they allow for using relatively "natural language" intervals like "interval 1 day" or "interval 3 year" when doing the calcuations. Easier to read ==> easier to debug (IMO). -- CC -- 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] newbie help
Hi Thanks to CC Zona and Dean for their help It all made sense this morning (BST). I echoed the query and lo and behold... errors ... and of course I could see where the problems lay. It's amazing what a good nights sleep will do! thanks again now does anyone know about getting ages from dates of birth (previous post of mine) and also searching by age group when you only have dates of birth in the table!! cheers matt t h r e e z e r o : : : the mill, millstone lane, leicester, le1 5jn e : [EMAIL PROTECTED] :: m : 07747 845690 w : http://www.threezero.co.uk : : :t h r e e z e r o > From: CC Zona <[EMAIL PROTECTED]> > Reply-To: [EMAIL PROTECTED] > Date: Sun, 25 Mar 2001 10:39:23 -0800 > To: [EMAIL PROTECTED] > Subject: Re: [PHP-DB] newbie help > > In article <[EMAIL PROTECTED]>, > [EMAIL PROTECTED] (Matt Coyne) wrote: > >> I have been trying to detect if the variable holds any value and then >> building a query by concatenating like this: > > if(!empty($foo)) > { > ... > } > >> $result=@mysql_query($concatsql, $connection) or die ("bugger...!"); >> >> This just dies on mysql_query. > > $result=@mysql_query($concatsql, $connection) or die (mysql_error() . " > from query \n$concatsql"); //show as much relevant info as possible > > When building complex queries like this, it's really easy to miss a missing > quote or extra comma, etc. Displaying the query string usually makes it > quite obvious where the problem lies (especially when coupled with a MySQL > error message, since MySQL is pretty good about pointing out the spot where > the syntax fails). > > -- > CC > > -- > 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] newbie help
It looks like your checks are reversed, and you end up with 2 ANDs between the sex and height clauses. Like someone else pointed out, it is very helpful to echo the generated query so you can see what you've got. A simpler solution, assuming that both fields are optional: $sql = "SELECT ref, firstname, surname FROM $tablename"; $sql .= " WHERE 1=1"; if ($sex) // or if (!empty($sex) $sql .= " AND sex = '$sex' "; if ($heightFt) $sql .= " AND heightFt = '$heightFt' "; $sql .= " ORDER BY surname"; echo "query is $sql"; $result=@mysql_query($sql, $connection) or die ("bugger...!"); -- 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] newbie help
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Matt Coyne) wrote: > I have been trying to detect if the variable holds any value and then > building a query by concatenating like this: if(!empty($foo)) { ... } > $result=@mysql_query($concatsql, $connection) or die ("bugger...!"); > > This just dies on mysql_query. $result=@mysql_query($concatsql, $connection) or die (mysql_error() . " from query \n$concatsql"); //show as much relevant info as possible When building complex queries like this, it's really easy to miss a missing quote or extra comma, etc. Displaying the query string usually makes it quite obvious where the problem lies (especially when coupled with a MySQL error message, since MySQL is pretty good about pointing out the spot where the syntax fails). -- CC -- 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] newbie help
Hi all Having created a form that sends values to a php file that searches a table and returned results in the format specified I was on a high (little things I know!). However, this only works if I enter values into all fields on the form. How can I create an SQL query (mySQL) that will use only variables that have values entered in the previous form and ignore those fields that were not filled in? At the moment I am using a simple query like (this query is a shortened version for this email): $sql = "SELECT ref, firstname, surname FROM artistes WHERE sex = '$sex' AND heightFt = '$heightFt' AND heightIn= '$heightIn' ORDER BY surname"; $result=@mysql_query($sql, $connection) or die ("bugger...!"); --- I have been trying to detect if the variable holds any value and then building a query by concatenating like this: // ASSEMBLE SQL QUERY // make the select $select = "SELECT ref, firstname, surname "; //add the tablename to the query $fromtable = "FROM "; $fromtable .= $tablename; //build where clause $where = " WHERE "; //determine what we are selecting if (!$sex) { $Qsex = "sex = '$sex' "; } else { $Qsex = ""; } if (!$heightFt) { $QheightFt = "AND heightFt = '$heightFt' "; } else { $QheightFt = ""; } // specify AND OR $Qconcat = "AND "; // specify how results are ordered $orderby = "ORDER BY surname"; $concatsql = $select; $concatsql .= $fromtable; $concatsql .= $where; $concatsql .= $Qsex; $concatsql .= $Qconcat; $concatsql .= $QheightFt; $concatsql .= $orderby; $result=@mysql_query($concatsql, $connection) or die ("bugger...!"); This just dies on mysql_query. Sorry to make this such a long post, but this is really getting to me and I believe there must be a simple answer that I am missing. Can anyone help... please?!! cheers matt t h r e e z e r o : : : the mill, millstone lane, leicester, le1 5jn e : [EMAIL PROTECTED] :: m : 07747 845690 w : http://www.threezero.co.uk : : :t h r e e z e r o -- 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]