Re: [PHP-DB] Informix Question (Still need help,please)
on 6/21/01 2:23 PM, wflow at [EMAIL PROTECTED] wrote: What I want to do is create another query from some of the data from another one. The question is how do I take the data I get back from my first query and put that into variables so I can build my second query. The example I have in mind is: I a do a select tracknum,orderdate,ordertotal,status,shipdate from orders where tracknum = '$trknum' and I want the data returned into vars: like orderdate = $orderdate so I can create a new query like: select * from shipping where orderdate = '$orderdate'. does NOT return an enumerated array, as the top line of the page states. It ONLY returns an associative array. If there was an ifx_fetch_array like the one for MySQL, I would not have to even post this question. Please Note: I don't use Informix, but the following is an educated guess. Even though it isn't an enumerated array, you should be able to get the value using the name of the key. For example, to set your new query, you would have something like: /* DB Connect stuff precedes this as in example on: http://php.net/manual/en/function.ifx-fetch-row.php */ while ifx_fetch_row($rid) { $my_new_query = 'SELECT * FROM shipping WHERE orderdate = ' . $row['orderdate'] . ''; /* Now, take that query and do something with it. Call ifx_query or something.*/ } You could also just go through all the results in a similar fashion and set: $orderdate = $row['orderdate']; $ordertotal = $row['ordertotal']; Hope that helps. Sincerely, Paul Burney ++ Paul Burney Webmaster Open Source Developer UCLA - GSEIS - ETU (310) 825-8365 [EMAIL PROTECTED] http://www.gseis.ucla.edu/ ++ -- 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] Informix Question (Still need help,please)
Hi, Have a try with something like this. Not tested and it's Friday ;o) $connid = ifx_connect(blah,blah,blah) or die(An error occurred connecting to database); $Query = SELECT tracknum,orderdate,ordertotal,status,shipdate . FROM orders . WHERE tracknum = '$trknum' ; $rid = ifx_query($Query, $connid, IFX_SCROLL) or die(An error occurred querying database); $row = ifx_fetch_row($rid, NEXT); $orderdate = $row['orderdate']; $Query = SELECT stuff . FROM somewhere . WHERE orderdate = '$orderdate' ; $rid = ifx_query($Query, $connid, IFX_SCROLL) or die(An error occurred querying database); @ifx_htmltbl_result($rid,border=1); ifx_free_result ($rid); ifx_close($connid); Regards, - Paul - - Original Message - From: wflow [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, June 21, 2001 10:23 PM Subject: Re: [PHP-DB] Informix Question (Still need help,please) Chris, Thanks for the advice, of course I already did rtfm and the ifx_fetch_rows entry did not really help me. It, in fact does NOT return an enumerated array, as the top line of the page states. It ONLY returns an associative array. If there was an ifx_fetch_array like the one for MySQL, I would not have to even post this question. I only did post the question, because I needed help and figured I would ask the experts, but all I got was somebody who says rtfm and most likely did not read or understand my question, so, thanks a lot. B Christian Haul [EMAIL PROTECTED] wrote in message 9gsg0u$6nf$[EMAIL PROTECTED]">news:9gsg0u$6nf$[EMAIL PROTECTED]... wflow [EMAIL PROTECTED] wrote: Hi All, What I want to do is create another query from some of the data from another one. The question is how do I take the data I get back from my first query and put that into variables so I can build my second query. The example I have in mind is: I a do a select tracknum,orderdate,ordertotal,status,shipdate from orders where tracknum = '$trknum' and I want the data returned into vars: like orderdate = $orderdate so I can create a new query like: select * from shipping where orderdate = '$orderdate'. @ifx_htmltbl_result($sql_result,border=1); You might want to consider reading the php manual, especially the part on functions and even more the one on informix functions. There you'll find a function called ifx_fetch_row. Chris. -- 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 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] Informix Question (Still need help,please)
On 21.Jun.2001 -- 02:22 PM, William Flow wrote: Chris, Thanks for the advice, of course I already did rtfm and the ifx_fetch_rows entry did not really help me. It, in fact does NOT return an enumerated array, as the top line of the page states. It ONLY returns an associative array. If you had said so, it would have been more obvious what your problem is. The posting only showed ifx_htmltbl suggesting that you didn't try ifx_fetch_row which would be the obvious solution to your problem -- read the results into variables. So, you don't like the associative array. Well, you should really rtm ;-) Have a look at the array functions. You could pop or shift it, extract all values to a new enumerated array or use foreach. If you happen to have duplicate column names in your result, only one will appear (even though ifx_htmltbl would produce correct output. In this case you need to rename the columns. (SELECT TABLE1.ID AS ID1, TABLE2.ID AS ID2 ...) I only did post the question, because I needed help and figured I would ask the experts, but all I got was somebody who says rtfm and most likely did not read or understand my question, so, thanks a lot. You're welcome. No need to be sore. The answer fits the question. Next time, be a little more verbose on your problem and you'll get the help you desire. Chris. -- C h r i s t i a n H a u l [EMAIL PROTECTED] fingerprint: 99B0 1D9D 7919 644A 4837 7D73 FEF9 6856 335A 9E08 -- 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] Informix Question (Still need help,please)
On 21.Jun.2001 -- 02:22 PM, William Flow wrote: Chris, Thanks for the advice, of course I already did rtfm and the ifx_fetch_rows entry did not really help me. It, in fact does NOT return an enumerated array, as the top line of the page states. It ONLY returns an associative array. If you had said so, it would have been more obvious what your problem is. The posting only showed ifx_htmltbl suggesting that you didn't try ifx_fetch_row which would be the obvious solution to your problem -- read the results into variables. So, you don't like the associative array. Well, you should really rtm ;-) Have a look at the array functions. You could pop or shift it, extract all values to a new enumerated array or use foreach. If you happen to have duplicate column names in your result, only one will appear (even though ifx_htmltbl would produce correct output. In this case you need to rename the columns. (SELECT TABLE1.ID AS ID1, TABLE2.ID AS ID2 ...) I only did post the question, because I needed help and figured I would ask the experts, but all I got was somebody who says rtfm and most likely did not read or understand my question, so, thanks a lot. You're welcome. No need to be sore. The answer fits the question. Next time, be a little more verbose on your problem and you'll get the help you desire. Chris. -- C h r i s t i a n H a u l [EMAIL PROTECTED] fingerprint: 99B0 1D9D 7919 644A 4837 7D73 FEF9 6856 335A 9E08 -- 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] Informix Question (Still need help,please)
B, Do your first query, then run this (for one record returned). while($row = ifx_fetch_row($query_result_id)) { for(reset($row); $fieldname=key($row); next($row)) { $$fieldname = $row[$fieldname]; } } Do your second query. The while statement will set each field value equal to the field name. Dan What I want to do is create another query from some of the data from another one. The question is how do I take the data I get back from my first query and put that into variables so I can build my second query. The example I have in mind is: I a do a select tracknum,orderdate,ordertotal,status,shipdate from orders where tracknum = '$trknum' and I want the data returned into vars: like orderdate = $orderdate so I can create a new query like: select * from shipping where orderdate = '$orderdate'. -- 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] Informix question
-Original Message- From: Bård Farstad [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 19, 2001 11:45 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Informix question I'm writing an application which uses the PHP interface to informix. I'm having trouble with newlines in char/varchar or lvarchar fields. How can I store newlines (\n) to an informix database without using blobs? I just got back from a conference for some software we use that's Informix-driven, and it was mentioned in one of the sessions that there's a setting to enable this *if* you're using Informix 11.x (we're still on 9.x here). The speaker didn't know the setting off the top of his head, but indicated it was in Informix's online documentation, searchable at http://www.informix.com/answers/ --- Mark Roedel ([EMAIL PROTECTED]) || There cannot be a crisis next week. Systems Programmer / WebMaster || My schedule is already full. LeTourneau University ||-- Henry Kissinger -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Informix question
Bård Farstad [EMAIL PROTECTED] wrote: Hi all, I'm writing an application which uses the PHP interface to informix. I'm having trouble with newlines in char/varchar or lvarchar fields. How can I store newlines (\n) to an informix database without using blobs? You need to escape newlines or replace them eg. with br. Chris. -- 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] Informix Question how to put data from query into variables
wflow [EMAIL PROTECTED] wrote: Hi All, What I want to do is create another query from some of the data from another one. The question is how do I take the data I get back from my first query and put that into variables so I can build my second query. The example I have in mind is: I a do a select tracknum,orderdate,ordertotal,status,shipdate from orders where tracknum = '$trknum' and I want the data returned into vars: like orderdate = $orderdate so I can create a new query like: select * from shipping where orderdate = '$orderdate'. @ifx_htmltbl_result($sql_result,border=1); You might want to consider reading the php manual, especially the part on functions and even more the one on informix functions. There you'll find a function called ifx_fetch_row. Chris. -- 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] Informix Question (Still need help,please)
Chris, Thanks for the advice, of course I already did rtfm and the ifx_fetch_rows entry did not really help me. It, in fact does NOT return an enumerated array, as the top line of the page states. It ONLY returns an associative array. If there was an ifx_fetch_array like the one for MySQL, I would not have to even post this question. I only did post the question, because I needed help and figured I would ask the experts, but all I got was somebody who says rtfm and most likely did not read or understand my question, so, thanks a lot. B Christian Haul [EMAIL PROTECTED] wrote in message 9gsg0u$6nf$[EMAIL PROTECTED]">news:9gsg0u$6nf$[EMAIL PROTECTED]... wflow [EMAIL PROTECTED] wrote: Hi All, What I want to do is create another query from some of the data from another one. The question is how do I take the data I get back from my first query and put that into variables so I can build my second query. The example I have in mind is: I a do a select tracknum,orderdate,ordertotal,status,shipdate from orders where tracknum = '$trknum' and I want the data returned into vars: like orderdate = $orderdate so I can create a new query like: select * from shipping where orderdate = '$orderdate'. @ifx_htmltbl_result($sql_result,border=1); You might want to consider reading the php manual, especially the part on functions and even more the one on informix functions. There you'll find a function called ifx_fetch_row. Chris. -- 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]