RE: [PHP-DB] Session Problem
are you sure that the problem is not in the browser settings (not to accept session cookies)? Bastien From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] CC: php-db@lists.php.net Subject: RE: [PHP-DB] Session Problem Date: Fri, 12 Jan 2007 15:34:06 +0900 1. Did you mean that on phpinfo(), the Session Support is enabled? Yes, it wrote so. 2. I have check the session.save_files, and its writable. I found some files session in there. Please advice... Thanks Regards, Anita -Original Message- From: Peter Beckman [mailto:[EMAIL PROTECTED] Sent: Friday, January 12, 2007 2:27 PM To: Adman, Nur anita Cc: php-db@lists.php.net Subject: Re: [PHP-DB] Session Problem 1. Is session support compiled into PHP, or if not, is the module there and being loaded? phpinfo() will tell you. If not, recompile PHP or build the dynamic module to support sessions. 2. If so, check the location of session.save_files and make sure it is writable by the web server user/group. If not, you must change this. Beckman On Fri, 12 Jan 2007, [EMAIL PROTECTED] wrote: Dear All, I need some help please... I'm developing an web application using PHP/MySQL, and its has been running on my company. I'm planning to migrate the system on a new server. I have installed everything that are needed on the new server to running the web application. But I'm confusing that the session isn't running. For your information, I've setting all configurations (MySQL PHP), included register globals to Off. I have trying to re-install the web server MySQL, but it still not running... Please advice... Thanks Regards, Anita --- Peter Beckman Internet Guy [EMAIL PROTECTED] http://www.purplecow.com/ --- _ Your opinion matters. Please tell us what you think and be entered into a draw for a grand prize of $500 or one of 20 $50 cash prizes. http://www.youthographyinsiders.com/R.aspx?a=116 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Problem with PHP 4.4.4 and MSSQL in Centos
Hi all! I've stepped into an annoying problem when trying to fetch the tuples returned by a stored procedure in a MSSQL database from a PHP program running in a Centos Linux server running PHP 4.4.4. The stored procedure returns an arbitrary number of tuples, and my code is only working when the SP returns one row. The code I'm using, simplified, follows: $db_conn = mssql_connect (server, user, passwd); mssql_select_db(db,$db_conn); $query = Exec stored_procedure '$par1', '$par2'; $result = mssql_query ($query); while ($row = mssql_fetch_array ($result)) { echo $row[COL1]; echo br/; } If stored_procedure () returns only one row, the code executes without any problem. However, if there are more than one rows to be returned, the program not only blocks, but also eats all the server's memory. I've run this program also in Ubuntu with PHP 4.4, and it works without any problem, so I'm thinking it may be either a configuration problem of the centos server, or a bug in the PHP version. Do you have any hint to solve this? I would appreciate any advice. Thanks in advance, Claudio -- Claudio Saavedra [EMAIL PROTECTED] - La informacion contenida en esta transmision (y sus documentos adjuntos), es confidencial y no puede ser usada o difundida por personas distintas a su(s) destinatario(s). El uso no autorizado de la informacion contenida en esta transmision puede ser sancionado criminalmente de conformidad con la ley chilena. Si ha recibido esta transmision por error, por favor destruyala y notifique al remitente. Atendido que no existe certidumbre que el presente mensaje no sera modificado como resultado de su transmision por correo electronico, nuestra empresa, no sera responsable si el contenido del mismo ha sido modificado. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Problem with PHP 4.4.4 and MSSQL in Centos
Hi Claudio, 1) Check the version of FreeTDS on both systems. 2) Check the freetds.conf file for differences (use the sam TDS version) 3) Check that php is compiled using --with-mssql on both systems (--with-sybase will give you aliases to some mssql_( functions but not all) - Frank Hi all! I've stepped into an annoying problem when trying to fetch the tuples returned by a stored procedure in a MSSQL database from a PHP program running in a Centos Linux server running PHP 4.4.4. The stored procedure returns an arbitrary number of tuples, and my code is only working when the SP returns one row. The code I'm using, simplified, follows: $db_conn = mssql_connect (server, user, passwd); mssql_select_db(db,$db_conn); $query = Exec stored_procedure '$par1', '$par2'; $result = mssql_query ($query); while ($row = mssql_fetch_array ($result)) { echo $row[COL1]; echo br/; } If stored_procedure () returns only one row, the code executes without any problem. However, if there are more than one rows to be returned, the program not only blocks, but also eats all the server's memory. I've run this program also in Ubuntu with PHP 4.4, and it works without any problem, so I'm thinking it may be either a configuration problem of the centos server, or a bug in the PHP version. Do you have any hint to solve this? I would appreciate any advice. Thanks in advance, Claudio -- Claudio Saavedra [EMAIL PROTECTED] - La informacion contenida en esta transmision (y sus documentos adjuntos), es confidencial y no puede ser usada o difundida por personas distintas a su(s) destinatario(s). El uso no autorizado de la informacion contenida en esta transmision puede ser sancionado criminalmente de conformidad con la ley chilena. Si ha recibido esta transmision por error, por favor destruyala y notifique al remitente. Atendido que no existe certidumbre que el presente mensaje no sera modificado como resultado de su transmision por correo electronico, nuestra empresa, no sera responsable si el contenido del mismo ha sido modificado. -- 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] 2 queries -- 1 array
Hello, I need to query two different tables and create one BIG array. I can query both tables, but can't find a way to combine the results in one array. The problem comes in with the second table. It has a weird layout. The second table only has four fields. They are: contact_id, contact_owner, contact_name, and contact_value a.. The 'contact_id' needs to be linked to 'id' field from the first table. b.. The contact_name is a field I need to use to reference what i'm looking for. example... contact_name HAS values of RANO, PrevSys, Supplier, Dynamic each of them has the same contact_id different contact_names with different contact_values To query the second table I do something like this: SELECT contact_value FROM egw_addressbook_extra WHERE contact_name='Supplier' and contact_id=' XXX' The xxx is the ID from the first table. - Table 1: IDNAMEBUSINESS ADDRESSCITY PHONE 1 John SmithSmith's Phone Co. 100 Main St Someplace 555- 2 Joe Brown Brown's Shoe Store105 Grant St.This City 555-0001 Table 2: CONTACT_IDCONTACT_NAME CONTACT_VALUECONTACT_OWNER 1 PrevSys NONE 4 1 RANO 100102 4 1 Supplier TrueValue 4 1 Dynamic 192.168.0.0 4 2 PrevSys OLD POS SYS 4 2 RANO 100105 4 2 Supplier Orgill 4 2 Dynamic 192.168.100.0 4 I want to query both tables and create a array. The extra fields from table two need to have their own field in the array. I need to call those extra fields in the array by the contact_name field... example $myrow[supplier] $myrow[PrepSys] $myrow[name] I have tried alot of stuff to get this done, but i think i was very off task. Some help/guide is needed I'm new Thanks... Matt
Re: [PHP-DB] Problem with PHP 4.4.4 and MSSQL in Centos
Hi Frank, El vie, 12-01-2007 a las 10:49 -0800, Frank M. Kromann escribió: 1) Check the version of FreeTDS on both systems. It proved irrelevant. See above. 2) Check the freetds.conf file for differences (use the sam TDS version) No differences. 3) Check that php is compiled using --with-mssql on both systems (--with-sybase will give you aliases to some mssql_( functions but not all) I fixed it by compiling again php with --with-mssql instead of --with-sybase. Now it works perfectly. Thanks for your suggestions. Anyway, I wouldn't expect php to hang and kill my server if compiled with --sybase. Maybe just a runtime error would be ok, but a hang like that, it's a bug to me. I would gladly report it, if I knew where should I. Do you think it may be in freeTDS or PHP itself? I am not really into PHP internals. Best regards, Claudio -- Claudio Saavedra [EMAIL PROTECTED] - La informacion contenida en esta transmision (y sus documentos adjuntos), es confidencial y no puede ser usada o difundida por personas distintas a su(s) destinatario(s). El uso no autorizado de la informacion contenida en esta transmision puede ser sancionado criminalmente de conformidad con la ley chilena. Si ha recibido esta transmision por error, por favor destruyala y notifique al remitente. Atendido que no existe certidumbre que el presente mensaje no sera modificado como resultado de su transmision por correo electronico, nuestra empresa, no sera responsable si el contenido del mismo ha sido modificado. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] 2 queries -- 1 array
I tried a buch of JOINs, but with no luck The problem comes in with I have to do a different query for each contact_name values for every record. SELECT contact_value FROM egw_addressbook_extra WHERE contact_name='Supplier' and contact_id=' 1' SELECT contact_value FROM egw_addressbook_extra WHERE contact_name='RANO' and contact_id=' 1' SELECT contact_value FROM egw_addressbook_extra WHERE contact_name='PrevSystem' and contact_id=' 1' SELECT contact_value FROM egw_addressbook_extra WHERE contact_name='Dynamic' and contact_id=' 1' Then add those values to the array created from query of the first table Thanks... Matt - Original Message - From: Natalie Leotta To: Matthew Ferry Sent: Friday, January 12, 2007 3:41 PM Subject: Re: [PHP-DB] 2 queries -- 1 array I think this will help, but I'm not sure I understood your question correctly. http://www.w3schools.com/sql/sql_join.asp On 1/12/07, Matthew Ferry [EMAIL PROTECTED] wrote: Hello, I need to query two different tables and create one BIG array. I can query both tables, but can't find a way to combine the results in one array. The problem comes in with the second table. It has a weird layout. The second table only has four fields. They are: contact_id, contact_owner, contact_name, and contact_value a.. The 'contact_id' needs to be linked to 'id' field from the first table. b.. The contact_name is a field I need to use to reference what i'm looking for. example... contact_name HAS values of RANO, PrevSys, Supplier, Dynamic each of them has the same contact_id different contact_names with different contact_values To query the second table I do something like this: SELECT contact_value FROM egw_addressbook_extra WHERE contact_name='Supplier' and contact_id=' XXX' The xxx is the ID from the first table. - Table 1: IDNAMEBUSINESS ADDRESSCITY PHONE 1 John SmithSmith's Phone Co. 100 Main St Someplace 555- 2 Joe Brown Brown's Shoe Store105 Grant St.This City 555-0001 Table 2: CONTACT_IDCONTACT_NAME CONTACT_VALUECONTACT_OWNER 1 PrevSys NONE 4 1 RANO 100102 4 1 Supplier TrueValue 4 1 Dynamic 192.168.0.0 4 2 PrevSys OLD POS SYS 4 2 RANO 100105 4 2 Supplier Orgill 4 2 Dynamic 192.168.100.0 4 I want to query both tables and create a array. The extra fields from table two need to have their own field in the array. I need to call those extra fields in the array by the contact_name field... example $myrow[supplier] $myrow[PrepSys] $myrow[name] I have tried alot of stuff to get this done, but i think i was very off task. Some help/guide is needed I'm new Thanks... Matt
RE: [PHP-DB] Session Problem
I don't think that the problem is on the browser setting... Cause I've tried to browse the other web application (that using session too) on other server, and its running well... Forget to tell you, that if I used http://localhost http://localhost/ , the session running well... But if I change with http://hostname http://hostname/ , the session wasn't running... I thought the problem was on privileges... But I have setting the grant privilege to user root the hostname... Still the session not running.. Regards, Anita -Original Message- From: Bastien Koert [mailto:[EMAIL PROTECTED] Sent: Saturday, January 13, 2007 12:21 AM To: Adman, Nur anita; [EMAIL PROTECTED] Cc: php-db@lists.php.net Subject: RE: [PHP-DB] Session Problem are you sure that the problem is not in the browser settings (not to accept session cookies)? Bastien From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] CC: php-db@lists.php.net Subject: RE: [PHP-DB] Session Problem Date: Fri, 12 Jan 2007 15:34:06 +0900 1. Did you mean that on phpinfo(), the Session Support is enabled? Yes, it wrote so. 2. I have check the session.save_files, and its writable. I found some files session in there. Please advice... Thanks Regards, Anita -Original Message- From: Peter Beckman [mailto:[EMAIL PROTECTED] Sent: Friday, January 12, 2007 2:27 PM To: Adman, Nur anita Cc: php-db@lists.php.net Subject: Re: [PHP-DB] Session Problem 1. Is session support compiled into PHP, or if not, is the module there and being loaded? phpinfo() will tell you. If not, recompile PHP or build the dynamic module to support sessions. 2. If so, check the location of session.save_files and make sure it is writable by the web server user/group. If not, you must change this. Beckman On Fri, 12 Jan 2007, [EMAIL PROTECTED] wrote: Dear All, I need some help please... I'm developing an web application using PHP/MySQL, and its has been running on my company. I'm planning to migrate the system on a new server. I have installed everything that are needed on the new server to running the web application. But I'm confusing that the session isn't running. For your information, I've setting all configurations (MySQL PHP), included register globals to Off. I have trying to re-install the web server MySQL, but it still not running... Please advice... Thanks Regards, Anita --- - --- Peter Beckman Internet Guy [EMAIL PROTECTED] http://www.purplecow.com/ --- - --- _ Your opinion matters. Please tell us what you think and be entered into a draw for a grand prize of $500 or one of 20 $50 cash prizes. http://www.youthographyinsiders.com/R.aspx?a=116
Re: [PHP-DB] 2 queries -- 1 array
Not sure if this is exactly what you're looking for, Matt, but I think it is. ?php $query = SELECT t1.NAME, t1.BUSINESS, t1.ADDRESS, t1.CITY, t1.PHONE, t2.CONTACT_NAME, t2.CONTACT_VALUE FROM Table1 as t1, Table2 as t2 WHERE t1.ID = t2.CONTACT_ID $result = mysql_query($query); while ($row = mysql_fetch_assoc($result)) { // to make it easier to read, I'll assign the values to variables for this demonstration $name = $row['NAME']; $business = $row['BUSINESS']; $address = $row['ADDRESS']; $city = $row['CITY']; $phone = $row['PHONE']; $contactname = $row['CONTACT_NAME']; $contactvalue = $row['CONTACT_VALUE']; $bigarray[$name][$contactname] = $contactvalue; } $JoeBrownPrevsys = $bigarray['Joe Brown']['Prevsys']; ? If that's not right, please re-describe the problem and let's see what we can figure out. If you have questions about what/how/why/etc... feel free to ask. -TG = = = Original message = = = Hello, I need to query two different tables and create one BIG array. I can query both tables, but can't find a way to combine the results in one array. The problem comes in with the second table. It has a weird layout. The second table only has four fields. They are: contact_id, contact_owner, contact_name, and contact_value a.. The 'contact_id' needs to be linked to 'id' field from the first table. b.. The contact_name is a field I need to use to reference what i'm looking for. example... contact_name HAS values of RANO, PrevSys, Supplier, Dynamic each of them has the same contact_id different contact_names with different contact_values To query the second table I do something like this: SELECT contact_value FROM egw_addressbook_extra WHERE contact_name='Supplier' and contact_id=' XXX' The xxx is the ID from the first table. - Table 1: IDNAMEBUSINESS ADDRESSCITY PHONE 1 John SmithSmith's Phone Co. 100 Main St Someplace 555- 2 Joe Brown Brown's Shoe Store105 Grant St.This City 555-0001 Table 2: CONTACT_IDCONTACT_NAME CONTACT_VALUECONTACT_OWNER 1 PrevSys NONE 4 1 RANO 100102 4 1 Supplier TrueValue 4 1 Dynamic 192.168.0.0 4 2 PrevSys OLD POS SYS 4 2 RANO 100105 4 2 Supplier Orgill 4 2 Dynamic 192.168.100.0 4 I want to query both tables and create a array. The extra fields from table two need to have their own field in the array. I need to call those extra fields in the array by the contact_name field... example $myrow[supplier] $myrow[PrepSys] $myrow[name] I have tried alot of stuff to get this done, but i think i was very off task. Some help/guide is needed I'm new Thanks... Matt ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] 2 queries -- 1 array
yeah..that is what i'm trying to do, but I need to query WHERE contact_name='Supplier' and bring back the value for contact_value query WHERE contact_name='RANO' and bring back the value for contact_value query WHERE contact_name='Dynamic' and bring back the value for contact_value query WHERE contact_name='PrevSys' and bring back the value for contact_value Which are all different rows in the second table with the same ID field thats how they are linked to the first table thanks... Matt - Original Message - From: [EMAIL PROTECTED] To: php-db@lists.php.net Cc: [EMAIL PROTECTED] Sent: Friday, January 12, 2007 4:26 PM Subject: Re: [PHP-DB] 2 queries -- 1 array Not sure if this is exactly what you're looking for, Matt, but I think it is. ?php $query = SELECT t1.NAME, t1.BUSINESS, t1.ADDRESS, t1.CITY, t1.PHONE, t2.CONTACT_NAME, t2.CONTACT_VALUE FROM Table1 as t1, Table2 as t2 WHERE t1.ID = t2.CONTACT_ID $result = mysql_query($query); while ($row = mysql_fetch_assoc($result)) { // to make it easier to read, I'll assign the values to variables for this demonstration $name = $row['NAME']; $business = $row['BUSINESS']; $address = $row['ADDRESS']; $city = $row['CITY']; $phone = $row['PHONE']; $contactname = $row['CONTACT_NAME']; $contactvalue = $row['CONTACT_VALUE']; $bigarray[$name][$contactname] = $contactvalue; } $JoeBrownPrevsys = $bigarray['Joe Brown']['Prevsys']; ? If that's not right, please re-describe the problem and let's see what we can figure out. If you have questions about what/how/why/etc... feel free to ask. -TG = = = Original message = = = Hello, I need to query two different tables and create one BIG array. I can query both tables, but can't find a way to combine the results in one array. The problem comes in with the second table. It has a weird layout. The second table only has four fields. They are: contact_id, contact_owner, contact_name, and contact_value a.. The 'contact_id' needs to be linked to 'id' field from the first table. b.. The contact_name is a field I need to use to reference what i'm looking for. example... contact_name HAS values of RANO, PrevSys, Supplier, Dynamic each of them has the same contact_id different contact_names with different contact_values To query the second table I do something like this: SELECT contact_value FROM egw_addressbook_extra WHERE contact_name='Supplier' and contact_id=' XXX' The xxx is the ID from the first table. - Table 1: IDNAMEBUSINESS ADDRESSCITY PHONE 1 John SmithSmith's Phone Co. 100 Main St Someplace 555- 2 Joe Brown Brown's Shoe Store105 Grant St.This City 555-0001 Table 2: CONTACT_IDCONTACT_NAME CONTACT_VALUECONTACT_OWNER 1 PrevSys NONE4 1 RANO 100102 4 1 Supplier TrueValue 4 1 Dynamic 192.168.0.0 4 2 PrevSys OLD POS SYS 4 2 RANO 100105 4 2 Supplier Orgill4 2 Dynamic 192.168.100.0 4 I want to query both tables and create a array. The extra fields from table two need to have their own field in the array. I need to call those extra fields in the array by the contact_name field... example $myrow[supplier] $myrow[PrepSys] $myrow[name] I have tried alot of stuff to get this done, but i think i was very off task. Some help/guide is needed I'm new Thanks... Matt ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] 2 queries -- 1 array
query1 = SELECT * FROM egw_addressbook query2 = SELECT contact_id, contact_value FROM egw_addressbook_extra WHERE contact_name='Supplier' query3 = SELECT contact_id, contact_value FROM egw_addressbook_extra WHERE contact_name='RANO' query4 = SELECT contact_id, contact_value FROM egw_addressbook_extra WHERE contact_name='PrevSys' query5 = SELECT contact_id, contact_value FROM egw_addressbook_extra WHERE contact_name='Dynamic' Then some type of array merge array1 = query1 + query2 + query3 + query4 + query5 query2 to query5 needs locked to query1 with: WHERE egw_addressbook.id=egw_addressbook_extra.contact_id Thanks... Matt - Original Message - From: [EMAIL PROTECTED] To: php-db@lists.php.net Cc: [EMAIL PROTECTED] Sent: Friday, January 12, 2007 4:26 PM Subject: Re: [PHP-DB] 2 queries -- 1 array Not sure if this is exactly what you're looking for, Matt, but I think it is. ?php $query = SELECT t1.NAME, t1.BUSINESS, t1.ADDRESS, t1.CITY, t1.PHONE, t2.CONTACT_NAME, t2.CONTACT_VALUE FROM Table1 as t1, Table2 as t2 WHERE t1.ID = t2.CONTACT_ID $result = mysql_query($query); while ($row = mysql_fetch_assoc($result)) { // to make it easier to read, I'll assign the values to variables for this demonstration $name = $row['NAME']; $business = $row['BUSINESS']; $address = $row['ADDRESS']; $city = $row['CITY']; $phone = $row['PHONE']; $contactname = $row['CONTACT_NAME']; $contactvalue = $row['CONTACT_VALUE']; $bigarray[$name][$contactname] = $contactvalue; } $JoeBrownPrevsys = $bigarray['Joe Brown']['Prevsys']; ? If that's not right, please re-describe the problem and let's see what we can figure out. If you have questions about what/how/why/etc... feel free to ask. -TG = = = Original message = = = Hello, I need to query two different tables and create one BIG array. I can query both tables, but can't find a way to combine the results in one array. The problem comes in with the second table. It has a weird layout. The second table only has four fields. They are: contact_id, contact_owner, contact_name, and contact_value a.. The 'contact_id' needs to be linked to 'id' field from the first table. b.. The contact_name is a field I need to use to reference what i'm looking for. example... contact_name HAS values of RANO, PrevSys, Supplier, Dynamic each of them has the same contact_id different contact_names with different contact_values To query the second table I do something like this: SELECT contact_value FROM egw_addressbook_extra WHERE contact_name='Supplier' and contact_id=' XXX' The xxx is the ID from the first table. - Table 1: IDNAMEBUSINESS ADDRESSCITY PHONE 1 John SmithSmith's Phone Co. 100 Main St Someplace 555- 2 Joe Brown Brown's Shoe Store105 Grant St.This City 555-0001 Table 2: CONTACT_IDCONTACT_NAME CONTACT_VALUECONTACT_OWNER 1 PrevSys NONE4 1 RANO 100102 4 1 Supplier TrueValue 4 1 Dynamic 192.168.0.0 4 2 PrevSys OLD POS SYS 4 2 RANO 100105 4 2 Supplier Orgill4 2 Dynamic 192.168.100.0 4 I want to query both tables and create a array. The extra fields from table two need to have their own field in the array. I need to call those extra fields in the array by the contact_name field... example $myrow[supplier] $myrow[PrepSys] $myrow[name] I have tried alot of stuff to get this done, but i think i was very off task. Some help/guide is needed I'm new Thanks... Matt ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --
Re: [PHP-DB] Problem with PHP 4.4.4 and MSSQL in Centos
Hi Claudio, bugs.php.net would be the place to report the bug. As both the MSSQL and Sybase extensions are using the same FreeTDS library I would think the bug is in the Sybase extension. You will get more mssql_* functions with the MSSQL extension, and much better support for storred procedures so I think you will be happy about the change. - Frank Hi Frank, El vie, 12-01-2007 a las 10:49 -0800, Frank M. Kromann escribió: 1) Check the version of FreeTDS on both systems. It proved irrelevant. See above. 2) Check the freetds.conf file for differences (use the sam TDS version) No differences. 3) Check that php is compiled using --with-mssql on both systems (--with-sybase will give you aliases to some mssql_( functions but not all) I fixed it by compiling again php with --with-mssql instead of --with-sybase. Now it works perfectly. Thanks for your suggestions. Anyway, I wouldn't expect php to hang and kill my server if compiled with --sybase. Maybe just a runtime error would be ok, but a hang like that, it's a bug to me. I would gladly report it, if I knew where should I. Do you think it may be in freeTDS or PHP itself? I am not really into PHP internals. Best regards, Claudio -- Claudio Saavedra [EMAIL PROTECTED] - La informacion contenida en esta transmision (y sus documentos adjuntos), es confidencial y no puede ser usada o difundida por personas distintas a su(s) destinatario(s). El uso no autorizado de la informacion contenida en esta transmision puede ser sancionado criminalmente de conformidad con la ley chilena. Si ha recibido esta transmision por error, por favor destruyala y notifique al remitente. Atendido que no existe certidumbre que el presente mensaje no sera modificado como resultado de su transmision por correo electronico, nuestra empresa, no sera responsable si el contenido del mismo ha sido modificado. -- 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] 2 queries -- 1 array
Ok, in your original message you said something about using the name as dominant key (or whatever you want to call it). All the SQL does is gather all the data together in an associated fashion. You can use the array you build to organize the data. I'm still not 100% sure what you're doing, so I can't say this is the best way, but let's look at the exampe I gave and change it to hopefully suit your last description: $name = $row['NAME']; $business = $row['BUSINESS']; $address = $row['ADDRESS']; $city = $row['CITY']; $phone = $row['PHONE']; $contactname = $row['CONTACT_NAME']; $contactvalue = $row['CONTACT_VALUE']; // $bigarray[$name][$contactname] = $contactvalue; $bigarray[$contactname][$name] = $contactvalue; foreach ($bigarray['Supplier'] as $name = $value) { echo Supplier: $name has CONTACT_VALUE = $valuebr\n; } There may be an elegant way to do what you want in SQL too, I'm just not fully groking the situation I think. -TG $name = $row['NAME']; $business = $row['BUSINESS']; $address = $row['ADDRESS']; $city = $row['CITY']; $phone = $row['PHONE']; $contactname = $row['CONTACT_NAME']; $contactvalue = $row['CONTACT_VALUE']; $bigarray[$name][$contactname] = $contactvalue; = = = Original message = = = yeah..that is what i'm trying to do, but I need to query WHERE contact_name='Supplier' and bring back the value for contact_value query WHERE contact_name='RANO' and bring back the value for contact_value query WHERE contact_name='Dynamic' and bring back the value for contact_value query WHERE contact_name='PrevSys' and bring back the value for contact_value Which are all different rows in the second table with the same ID field thats how they are linked to the first table thanks... Matt - Original Message - From: [EMAIL PROTECTED] To: php-db@lists.php.net Cc: [EMAIL PROTECTED] Sent: Friday, January 12, 2007 4:26 PM Subject: Re: [PHP-DB] 2 queries -- 1 array Not sure if this is exactly what you're looking for, Matt, but I think it is. ?php $query = SELECT t1.NAME, t1.BUSINESS, t1.ADDRESS, t1.CITY, t1.PHONE, t2.CONTACT_NAME, t2.CONTACT_VALUE FROM Table1 as t1, Table2 as t2 WHERE t1.ID = t2.CONTACT_ID $result = mysql_query($query); while ($row = mysql_fetch_assoc($result)) // to make it easier to read, I'll assign the values to variables for this demonstration $name = $row['NAME']; $business = $row['BUSINESS']; $address = $row['ADDRESS']; $city = $row['CITY']; $phone = $row['PHONE']; $contactname = $row['CONTACT_NAME']; $contactvalue = $row['CONTACT_VALUE']; $bigarray[$name][$contactname] = $contactvalue; $JoeBrownPrevsys = $bigarray['Joe Brown']['Prevsys']; ? If that's not right, please re-describe the problem and let's see what we can figure out. If you have questions about what/how/why/etc... feel free to ask. -TG = = = Original message = = = Hello, I need to query two different tables and create one BIG array. I can query both tables, but can't find a way to combine the results in one array. The problem comes in with the second table. It has a weird layout. The second table only has four fields. They are: contact_id, contact_owner, contact_name, and contact_value a.. The 'contact_id' needs to be linked to 'id' field from the first table. b.. The contact_name is a field I need to use to reference what i'm looking for. example... contact_name HAS values of RANO, PrevSys, Supplier, Dynamic each of them has the same contact_id different contact_names with different contact_values To query the second table I do something like this: SELECT contact_value FROM egw_addressbook_extra WHERE contact_name='Supplier' and contact_id=' XXX' The xxx is the ID from the first table. - Table 1: IDNAMEBUSINESS ADDRESSCITY PHONE 1 John SmithSmith's Phone Co. 100 Main St Someplace 555- 2 Joe Brown Brown's Shoe Store105 Grant St.This City 555-0001 Table 2: CONTACT_IDCONTACT_NAME CONTACT_VALUECONTACT_OWNER 1 PrevSys NONE4 1 RANO 100102 4 1 Supplier TrueValue 4 1 Dynamic 192.168.0.0 4 2