Re: [PHP-DB] Re: big/small letters with oracle No2
I've used Oracle for years, and am not aware of Oracle having case sensitive column names. Torsten Lange [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] But when using queries on the USER_... data dictionary, Oracle delivers always big letters, which is for chemical elements (NA vs. Na) or location names (ALICE SPRINGS vs. Alice Springs) and location codes often uncomfortable to read. Then I see only one way: create a mapping array to map your field names to what you want them to be *really* called. $mapping = array('FIELD1' = 'My real field name', 'FIELD2' = 'My second field name'); Then you get the value this way: $realName = $mapping[$fieldNameFromDB]; A mapping is the best way. It separates the internal schema structure (i.e column names as created by Oracle) from the display values (i.e. the column names you want to display). But it is possible to get PHP to return case sensitive column names from Oracle, see below. Chris - ?php // Example using case sensitive column names in Oracle. // // Table P1 was created in SQL*Plus using: // //create table p1 (MyCol number); //insert into p1 values (1234); //commit; // // The output of this PHP script is: // // array(1) { // [MyCol]= // string(4) 1234 // } $conn = OCILogon(scott, tiger, MYDB); $query = 'select * from p1'; $stid = OCIParse($conn, $query); OCIExecute($stid); OCIFetchInto($stid, $row, OCI_ASSOC); echo pre; var_dump($row); echo /pre; OCILogoff($conn); ? -- Christopher Jones, Oracle Corporation, Australia.
[PHP-DB] Multiple SQL queries...?
Right, todays fun dilema... ;-) I've a user capture system set up for downloads on our site. Each time a user downloads a file, their info is captured (so we'll have multiple entries for each email address). Also in the table, is a field to state if the result has been viewed by my boss. (Just a 1/0 value) So, what my boss wants me to do now, is to show her, the total No of people captured, and how many she's viewed. Using the 'email' field, from the table, I've done a distinct() sort in MySQL to ensure that I have a list of emails(users) and no duplicates. My prob is this: I want to take each email, and see if at any point, there's a '1' in the viewed field. if there is, I want to add one to the total of $row1 So I can output the num_rows from the distinct request, and then show the total of $row1... So I'll have total No of users, and total No of viewed... as I've mentioned above. What am I doing wrong? ? $sql = SELECT DISTINCT(email) FROM $table; $result = mysql_query($sql,$connection) or die(Couldn't execute query 0.); $row1 = 0; while ($row = mysql_fetch_array($result)) { $sql1 = SELECT * FROM $table WHERE viewed = '1' AND email = '$row[email]'; $result1 = mysql_query($sql1,$connection) or die(Couldn't execute query 1.); if (mysql_num_rows($result1) = 1) { $row1++; } } ? ?=$row1 ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] IMPORTANT MASSAGE FROM THE BANK
FROM:Mr DAVIES HARRIES bills and exchange director GUARANTY TRUST BANK PLC Email:[EMAIL PROTECTED] Fax No:14134519233 Dear Sir, I am Mr.Davies Harries the bills and exchange director at the GUARANTY TRUST BANK PLC, I am writing this letter to solicit for support and assistance from you to carry out this business opportunity in my department. Lying in an inactive account is the sum of us$34.7million belonging to a foreign customer(mr James Kelly) who happens to be deceased. he died with his wife and two children in a plane crash on board an ADC airline flight at the Egirin river Lagos Nigeria in november 1997. Ever since he died the bank has been expecting his next of kin to come and claim these fund. To this effect, we can not release the money unless someone applies for it as next of kin, as indicated in our banking guideline. Unfortunately he has no family member in Nigeria or Over-sea who are aware of the existence of the money(as he was a contractor with the federal Republic of Nigeria). At this juncture i have decided to do business with you.To this effect I solicit your assistance in applying as the next of kin then the money will be released to you. As I do not want this money to go into the bank treasury as an unclaimed bill. The banking law and guideline stipulates that if such money(s) remains unclaimed for a period of up to 8 years(8yrs)the money will be transferred into the banks treasury as an unclaimed bill.My request for a foreigner as next of kin is occasioned by the fact that the customer was a foreigner and a Nigerian cannot stand as next of kin. Sir, 20% of the money will be your share as a foreign partner and your assistance to actualise this business,5% for any expenses incured. Thereafter i will visit your country with your help once the money hits your account for disbursement according to the percentage indicated. To effect the immediate transfer of the fund to you as agreed,you must apply first to the bank as the next of kin to the deceased,then we will follow up all formalities for the transaction. Upon receipt of your reply, i will send to you by fax or email the text of the application you are to send to the bank, as soon as you receive the text i will further clarify you in other issues as to affect the business. Awaiting to hear from you. Best Regards Davies Harries REPLY ME ON MY PERSONAL EMAIL:[EMAIL PROTECTED]
[PHP-DB] php-general-unsubscribe@lists.php.net
Christopher Jones wrote: Torsten Roehr wrote: Torsten Lange [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] But when using queries on the USER_... data dictionary, Oracle delivers always big letters, which is for chemical elements (NA vs. Na) or location names (ALICE SPRINGS vs. Alice Springs) and location codes often uncomfortable to read. Then I see only one way: create a mapping array to map your field names to what you want them to be *really* called. $mapping = array('FIELD1' = 'My real field name', 'FIELD2' = 'My second field name'); Then you get the value this way: $realName = $mapping[$fieldNameFromDB]; A mapping is the best way. It separates the internal schema structure (i.e column names as created by Oracle) from the display values (i.e. the column names you want to display). But it is possible to get PHP to return case sensitive column names from Oracle, see below. Chris - ?php // Example using case sensitive column names in Oracle. // // Table P1 was created in SQL*Plus using: // //create table p1 (MyCol number); //insert into p1 values (1234); //commit; // // The output of this PHP script is: // // array(1) { // [MyCol]= // string(4) 1234 // } $conn = OCILogon(scott, tiger, MYDB); $query = 'select * from p1'; $stid = OCIParse($conn, $query); OCIExecute($stid); OCIFetchInto($stid, $row, OCI_ASSOC); echo pre; var_dump($row); echo /pre; OCILogoff($conn); ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Multiple SQL queries...?
Is this what you want ?? $sql = SELECT DISTINCT(email) FROM $table; $result = mysql_query($sql,$connection) or die(Couldn't execute query 0.); $row1 = 0; while ($row = mysql_fetch_array($result)) { echo $row[email] ; $sql1 = SELECT * FROM $table WHERE viewed = '1' AND email = '$row[email]'; $result1 = mysql_query($sql1,$connection) or die(Couldn't execute query 1.); if (mysql_num_rows($result1) = 1) { echo 'Viewed' ; } else { echo '' ; } } echo $row1 ; Right, todays fun dilema... ;-) I've a user capture system set up for downloads on our site. Each time a user downloads a file, their info is captured (so we'll have multiple entries for each email address). Also in the table, is a field to state if the result has been viewed by my boss. (Just a 1/0 value) So, what my boss wants me to do now, is to show her, the total No of people captured, and how many she's viewed. Using the 'email' field, from the table, I've done a distinct() sort in MySQL to ensure that I have a list of emails(users) and no duplicates. My prob is this: I want to take each email, and see if at any point, there's a '1' in the viewed field. if there is, I want to add one to the total of $row1 So I can output the num_rows from the distinct request, and then show the total of $row1... So I'll have total No of users, and total No of viewed... as I've mentioned above. What am I doing wrong? ? $sql = SELECT DISTINCT(email) FROM $table; $result = mysql_query($sql,$connection) or die(Couldn't execute query 0.); $row1 = 0; while ($row = mysql_fetch_array($result)) { $sql1 = SELECT * FROM $table WHERE viewed = '1' AND email = '$row[email]'; $result1 = mysql_query($sql1,$connection) or die(Couldn't execute query 1.); if (mysql_num_rows($result1) = 1) { $row1++; } } ? ?=$row1 ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Multiple SQL queries...?
Kinda, but I just wanna count how many views in total... Hence my $row1++; bit... I'll have a play with your code though...! Cheers, Tris... Daniel Clark [EMAIL PROTECTED] 03/06/2004 14:28 Please respond to Daniel Clark [EMAIL PROTECTED] To [EMAIL PROTECTED] [EMAIL PROTECTED], [EMAIL PROTECTED] [EMAIL PROTECTED] cc Subject Re: [PHP-DB] Multiple SQL queries...? Is this what you want ?? $sql = SELECT DISTINCT(email) FROM $table; $result = mysql_query($sql,$connection) or die(Couldn't execute query 0.); $row1 = 0; while ($row = mysql_fetch_array($result)) { echo $row[email] ; $sql1 = SELECT * FROM $table WHERE viewed = '1' AND email = '$row[email]'; $result1 = mysql_query($sql1,$connection) or die(Couldn't execute query 1.); if (mysql_num_rows($result1) = 1) { echo 'Viewed' ; } else { echo '' ; } } echo $row1 ; Right, todays fun dilema... ;-) I've a user capture system set up for downloads on our site. Each time a user downloads a file, their info is captured (so we'll have multiple entries for each email address). Also in the table, is a field to state if the result has been viewed by my boss. (Just a 1/0 value) So, what my boss wants me to do now, is to show her, the total No of people captured, and how many she's viewed. Using the 'email' field, from the table, I've done a distinct() sort in MySQL to ensure that I have a list of emails(users) and no duplicates. My prob is this: I want to take each email, and see if at any point, there's a '1' in the viewed field. if there is, I want to add one to the total of $row1 So I can output the num_rows from the distinct request, and then show the total of $row1... So I'll have total No of users, and total No of viewed... as I've mentioned above. What am I doing wrong? ? $sql = SELECT DISTINCT(email) FROM $table; $result = mysql_query($sql,$connection) or die(Couldn't execute query 0.); $row1 = 0; while ($row = mysql_fetch_array($result)) { $sql1 = SELECT * FROM $table WHERE viewed = '1' AND email = '$row[email]'; $result1 = mysql_query($sql1,$connection) or die(Couldn't execute query 1.); if (mysql_num_rows($result1) = 1) { $row1++; } } ? ?=$row1 ? -- 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] RE: [PHP-WIN] [ANNOUNCEMENT] ODBTP 1.1.1 Released
Robert, Do you have an example of pulling the Column types from an MS Sql query? For example: select top 1 * from mytablename. loop thru the fields in the recordset and print out their data types? -- Gerardo S. Rojas mailto: [EMAIL PROTECTED] -Original Message- From: Robert Twitty [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 02, 2004 7:52 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [PHP-WIN] [ANNOUNCEMENT] ODBTP 1.1.1 Released FYI for the members of this list that are using ODBTP: Version 1.1.1 has been released, and is available for download at http://odbtp.sourceforge.net Key Changes: * All version 1.1 known bugs have been fixed. * Data truncation detection. * Auto char to wide char mapping for MS Access in UNICODE SQL mode. * PHP 5 support, including Win32 odbtp extension dlls. * PEAR DB driver works with latest DB version. -- PHP Windows 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] Multiple SQL queries...?
$sql1 = SELECT COUNT(*) as views FROM $table WHERE viewed = '1' AND email = '$row[email]'; $views = mysql_resutl(mysql_query($sql1,$connection),views); maybe? .bobo www.elstudion.com/bitbob/ - not finished though... - Original Message - From: [EMAIL PROTECTED] To: Daniel Clark [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, June 03, 2004 4:43 PM Subject: Re: [PHP-DB] Multiple SQL queries...? Kinda, but I just wanna count how many views in total... Hence my $row1++; bit... I'll have a play with your code though...! Cheers, Tris... Daniel Clark [EMAIL PROTECTED] 03/06/2004 14:28 Please respond to Daniel Clark [EMAIL PROTECTED] To [EMAIL PROTECTED] [EMAIL PROTECTED], [EMAIL PROTECTED] [EMAIL PROTECTED] cc Subject Re: [PHP-DB] Multiple SQL queries...? Is this what you want ?? $sql = SELECT DISTINCT(email) FROM $table; $result = mysql_query($sql,$connection) or die(Couldn't execute query 0.); $row1 = 0; while ($row = mysql_fetch_array($result)) { echo $row[email] ; $sql1 = SELECT * FROM $table WHERE viewed = '1' AND email = '$row[email]'; $result1 = mysql_query($sql1,$connection) or die(Couldn't execute query 1.); if (mysql_num_rows($result1) = 1) { echo 'Viewed' ; } else { echo '' ; } } echo $row1 ; Right, todays fun dilema... ;-) I've a user capture system set up for downloads on our site. Each time a user downloads a file, their info is captured (so we'll have multiple entries for each email address). Also in the table, is a field to state if the result has been viewed by my boss. (Just a 1/0 value) So, what my boss wants me to do now, is to show her, the total No of people captured, and how many she's viewed. Using the 'email' field, from the table, I've done a distinct() sort in MySQL to ensure that I have a list of emails(users) and no duplicates. My prob is this: I want to take each email, and see if at any point, there's a '1' in the viewed field. if there is, I want to add one to the total of $row1 So I can output the num_rows from the distinct request, and then show the total of $row1... So I'll have total No of users, and total No of viewed... as I've mentioned above. What am I doing wrong? ? $sql = SELECT DISTINCT(email) FROM $table; $result = mysql_query($sql,$connection) or die(Couldn't execute query 0.); $row1 = 0; while ($row = mysql_fetch_array($result)) { $sql1 = SELECT * FROM $table WHERE viewed = '1' AND email = '$row[email]'; $result1 = mysql_query($sql1,$connection) or die(Couldn't execute query 1.); if (mysql_num_rows($result1) = 1) { $row1++; } } ? ?=$row1 ? -- 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 Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Multiple SQL queries...?
OK, how about this? $sql = SELECT DISTINCT(email) FROM $table; $result = mysql_query($sql,$connection) or die(Couldn't execute query 0.); while ($row = mysql_fetch_array($result)) { echo $row[email] ; $sql1 = SELECT * FROM $table WHERE viewed = '1' AND email = '$row[email]'; $result1 = mysql_query($sql1,$connection) or die(Couldn't execute query 1.); echo ' ' . mysql_num_rows($result1) ; } echo $row1 ; Kinda, but I just wanna count how many views in total... Hence my $row1++; bit... I'll have a play with your code though...! Cheers, Tris... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Multiple SQL queries...?
Nope... HHmmm, this is really getting to me... I can do distinct, I can count, but I can't combine the two? Can't be that hard ;-) Daniel Clark [EMAIL PROTECTED] 03/06/2004 16:49 Please respond to [EMAIL PROTECTED] To [EMAIL PROTECTED] cc Daniel Clark [EMAIL PROTECTED], [EMAIL PROTECTED] [EMAIL PROTECTED] Subject Re: [PHP-DB] Multiple SQL queries...? OK, how about this? $sql = SELECT DISTINCT(email) FROM $table; $result = mysql_query($sql,$connection) or die(Couldn't execute query 0.); while ($row = mysql_fetch_array($result)) { echo $row[email] ; $sql1 = SELECT * FROM $table WHERE viewed = '1' AND email = '$row[email]'; $result1 = mysql_query($sql1,$connection) or die(Couldn't execute query 1.); echo ' ' . mysql_num_rows($result1) ; } echo $row1 ; Kinda, but I just wanna count how many views in total... Hence my $row1++; bit... I'll have a play with your code though...! Cheers, Tris... -- 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] Multiple SQL queries...?
Not tested... how about something like this? SELECT t1.email, t2.count(*) FROM $table t1 LEFT JOIN $table t2 ON (t1.email = t2.email and t2.viewed = '1') GROUP BY EMAIL Nope... HHmmm, this is really getting to me... I can do distinct, I can count, but I can't combine the two? Can't be that hard ;-) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] RE: [PHP-WIN] [ANNOUNCEMENT] ODBTP 1.1.1 Released
If you are using odbtp as a driver for the mssql ext, and want mssql_field_type() to return the actual type name, then call odbtp_set_attr( ODB_ATTR_FULLCOLINFO, 1 ); before you run any queries. -- bob On Thu, 3 Jun 2004, Frank M. Kromann wrote: mssql_field_type() is the function for that. - Frank Robert, Do you have an example of pulling the Column types from an MS Sql query? For example: select top 1 * from mytablename. loop thru the fields in the recordset and print out their data types? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Multiple SQL queries...?
Have you tried - GROUP BY email - ? Nope... HHmmm, this is really getting to me... I can do distinct, I can count, but I can't combine the two? Can't be that hard ;-) -- 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