[PHP-DB] php-db-unsubscribe@lists.php.net

2004-06-07 Thread Raymond
[EMAIL PROTECTED]

Christopher Jones wrote:
Philippe wrote:
Well, the exact message is: Unable to load dynamic library 
php_oci8.dll: The specified procedure could not be found
If I remove the library the message becomes The specified module 
could not be found. It seems to be able to find the library (all the 
paths are correct) but it seems that this php_oci8.dll file is the 
wrong version or that it is looking for an additional DLL that it 
can't find OR that it can find the additional DLL but it is the wrong 
version. If I only knew what DLL was needed!
Philippe

The common problem would be that php_oci8.dll cannot find Oracle's 
libraries.
Have you elimated this as the problem?

There are a coupel of things to try:
(i) Check phpinfo() output.  Make sure PATH in the Apache env section 
contains
the Oracle bin directory.  If this is not clear in my FAQ, please let 
me know
so I can update the FAQ.  Currently
   
http://otn.oracle.com/tech/opensource/php/php_troubleshooting_faq.html#envvars 

says:
If Apache starts but gives errors about Oracle libraries and/or
OCI8 function calls fail, try looking at PHP's environment. Create
the following script phpinfo.php where your web server can read
it and load it in a browser:
?php
  phpinfo();
?
Triple-check the environment and path configuration. On UNIX check
that LD_LIBRARY_PATH (or equivalent) contains $ORACLE_HOME/lib. On
Windows the PATH variable may need to contain %ORACLE_HOME%\bin.
(ii) Install http://www.dependencywalker.com/ and run it on php_oci8.dll
I'll look into adding a comment about this utility in the next FAQ 
update.

Chris
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] DISTINCT and multiple results...

2004-06-07 Thread Tristan . Pretty
Hi there...
I'm trying to create a MYSQL query that does the following...

I've a table that lists ALL downloads from our site.
so I may have the same user many times, but different files, or infact, 
same user, same file.
What my boss wants to see is:
If a user downloaded a file 3 times, she doesn't care, she just wants to 
see that it was downloaded.
So I tried using DISTINCT(email), but then I loose the data about the 
other files that they've downloaded
How can I create a query, where I can list only one instance of email, per 
multiple instatnces of a file name.

Does that make sence?
I'm reallyu stumped...

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] DISTINCT and multiple results...

2004-06-07 Thread Tristan . Pretty
It really is that simple?!?!?!
Wow...
I need to do a MySQL course...





Jonathan Haddad [EMAIL PROTECTED] 
07/06/2004 13:39

To
[EMAIL PROTECTED]
cc
[EMAIL PROTECTED]
Subject
Re: [PHP-DB] DISTINCT and multiple results...






select distinct email, username from table

On Jun 7, 2004, at 8:19 AM, [EMAIL PROTECTED] wrote:

 Hi there...
 I'm trying to create a MYSQL query that does the following...

 I've a table that lists ALL downloads from our site.
 so I may have the same user many times, but different files, or infact,
 same user, same file.
 What my boss wants to see is:
 If a user downloaded a file 3 times, she doesn't care, she just wants 
 to
 see that it was downloaded.
 So I tried using DISTINCT(email), but then I loose the data about the
 other files that they've downloaded
 How can I create a query, where I can list only one instance of email, 
 per
 multiple instatnces of a file name.

 Does that make sence?
 I'm reallyu stumped...

 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




--
Jonathan Haddad
[EMAIL PROTECTED]
http://www.superwebstuff.com

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] DISTINCT and multiple results...

2004-06-07 Thread Tristan . Pretty
Ah, but then how can I select other info from the same table (title, first 
name, company etc...)





Jonathan Haddad [EMAIL PROTECTED] 
07/06/2004 13:39

To
[EMAIL PROTECTED]
cc
[EMAIL PROTECTED]
Subject
Re: [PHP-DB] DISTINCT and multiple results...






select distinct email, username from table

On Jun 7, 2004, at 8:19 AM, [EMAIL PROTECTED] wrote:

 Hi there...
 I'm trying to create a MYSQL query that does the following...

 I've a table that lists ALL downloads from our site.
 so I may have the same user many times, but different files, or infact,
 same user, same file.
 What my boss wants to see is:
 If a user downloaded a file 3 times, she doesn't care, she just wants 
 to
 see that it was downloaded.
 So I tried using DISTINCT(email), but then I loose the data about the
 other files that they've downloaded
 How can I create a query, where I can list only one instance of email, 
 per
 multiple instatnces of a file name.

 Does that make sence?
 I'm reallyu stumped...

 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




--
Jonathan Haddad
[EMAIL PROTECTED]
http://www.superwebstuff.com

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] DISTINCT and multiple results...

2004-06-07 Thread Torsten Roehr
Tristan Pretty [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
com...
 Ah, but then how can I select other info from the same table (title, first
 name, company etc...)

Just add all the required fields to your select statement:

SELECT DISTINCT email, title, company FROM table


Regards, Torsten Roehr

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Dynamic Data

2004-06-07 Thread Christopher J. Crane
What is the best way to produce a report listing the fieldname and then the
data in that field. It is a report containing only one row from a table, but
I don't want to hard code the fields since they change often.

I can get the field names dynamically like this:

$fields = mysql_list_fields(Network, Subnets);
$num_columns = mysql_num_fields($fields);
for($ i = 0; $i  $num_columns; $i++) { echo mysql_field_name($fields,
$i); }

now is where I get confusedwhat I would like to happen is do a query on
a single row and put the results into mysql_fetch_assoc and during the prior
loop put the column name into the loop of the data. Something like:

$fields = mysql_list_fields(Network, Subnets);
$num_columns = mysql_num_fields($fields);
$result  =  mysql_query(SELECT * FROM table1 WHERE ID = '$ID';
$field = mysql_fetch_assoc($result)
for($ i = 0; $i  $num_columns; $i++) {
echo b . mysql_field_name($fields, $i) . : /b .
$field[mysql_field_name($fields, $i)] . br\n;

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] DISTINCT and multiple results...

2004-06-07 Thread Tyler Replogle
hey,
you could do something like this
?php  $query = SELECT * FROM `table` Group by email;
  $query_count++;
  $result = mysql_query ($query);
  while ($row = mysql_fetch_assoc ($result)) {
$title = $row[title];
$first_name= $row[first name];
$company = $row[company];
echotitle: $title br first_name: $first_name br company: $company;
}
?


From: [EMAIL PROTECTED]
To: Jonathan Haddad [EMAIL PROTECTED]
CC: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] DISTINCT and multiple results...
Date: Mon, 7 Jun 2004 14:05:41 +0100
Ah, but then how can I select other info from the same table (title, first
name, company etc...)


Jonathan Haddad [EMAIL PROTECTED]
07/06/2004 13:39
To
[EMAIL PROTECTED]
cc
[EMAIL PROTECTED]
Subject
Re: [PHP-DB] DISTINCT and multiple results...


select distinct email, username from table
On Jun 7, 2004, at 8:19 AM, [EMAIL PROTECTED] wrote:
 Hi there...
 I'm trying to create a MYSQL query that does the following...

 I've a table that lists ALL downloads from our site.
 so I may have the same user many times, but different files, or infact,
 same user, same file.
 What my boss wants to see is:
 If a user downloaded a file 3 times, she doesn't care, she just wants
 to
 see that it was downloaded.
 So I tried using DISTINCT(email), but then I loose the data about the
 other files that they've downloaded
 How can I create a query, where I can list only one instance of email,
 per
 multiple instatnces of a file name.

 Does that make sence?
 I'm reallyu stumped...

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




--
Jonathan Haddad
[EMAIL PROTECTED]
http://www.superwebstuff.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
_
Get fast, reliable Internet access with MSN 9 Dial-up – now 3 months FREE! 
http://join.msn.click-url.com/go/onm00200361ave/direct/01/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] About retrieving auto increment value

2004-06-07 Thread Marc Soler
Hi

I have the typical problem with retrieving auto increment value in
php-mysql environment.

I have search info in mysql page and I have found LAST_INSERT_ID()
funtion but I don't know how to use correctly.

I have one script that insert a row. And another script that must
retrieve last auto_increment value for primary key on a table.

I want something like this:

SELECT LAST_INSERT_ID() FROM foo_table; (like curval(foo_sequence) in postgres)

This doesn't work.

It's possible? Where I am wrong?

Thanks in advance
-- 
Marc Soler

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] About retrieving auto increment value

2004-06-07 Thread Daniel Clark
I think you want mysql_insert_id()

http://us3.php.net/manual/en/function.mysql-insert-id.php


 I have the typical problem with retrieving auto increment value in
 php-mysql environment.

 I have search info in mysql page and I have found LAST_INSERT_ID()
 funtion but I don't know how to use correctly.

 I have one script that insert a row. And another script that must
 retrieve last auto_increment value for primary key on a table.

 I want something like this:

 SELECT LAST_INSERT_ID() FROM foo_table; (like curval(foo_sequence) in
 postgres)

 This doesn't work.

 It's possible? Where I am wrong?

 Thanks in advance
 --
 Marc Soler

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Re: Dynamic Data

2004-06-07 Thread Justin Patrin
Christopher J. Crane wrote:
What is the best way to produce a report listing the fieldname and then the
data in that field. It is a report containing only one row from a table, but
I don't want to hard code the fields since they change often.
I can get the field names dynamically like this:
$fields = mysql_list_fields(Network, Subnets);
$num_columns = mysql_num_fields($fields);
for($ i = 0; $i  $num_columns; $i++) { echo mysql_field_name($fields,
$i); }
now is where I get confusedwhat I would like to happen is do a query on
a single row and put the results into mysql_fetch_assoc and during the prior
loop put the column name into the loop of the data. Something like:
$fields = mysql_list_fields(Network, Subnets);
$num_columns = mysql_num_fields($fields);
$result  =  mysql_query(SELECT * FROM table1 WHERE ID = '$ID';
$field = mysql_fetch_assoc($result)
for($ i = 0; $i  $num_columns; $i++) {
echo b . mysql_field_name($fields, $i) . : /b .
$field[mysql_field_name($fields, $i)] . br\n;
All you really need here is:
$sth = mysql_query(SELECT * FROM table1 WHERE ID = '$ID');
$rec = mysql_fetch_assoc($sth);
foreach($rec as $field = $value) {
  echo 'b'.$field.': /b'.$value.'br/';
}
--
paperCrane Justin Patrin
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Re: About retrieving auto increment value

2004-06-07 Thread Justin Patrin
Marc Soler wrote:
Hi
I have the typical problem with retrieving auto increment value in
php-mysql environment.
I have search info in mysql page and I have found LAST_INSERT_ID()
funtion but I don't know how to use correctly.
I have one script that insert a row. And another script that must
retrieve last auto_increment value for primary key on a table.
I want something like this:
SELECT LAST_INSERT_ID() FROM foo_table; (like curval(foo_sequence) in postgres)
This doesn't work.
It's possible? Where I am wrong?
Thanks in advance
I *think* you have to do this in the same script. I would suggest using 
mysql_insert_id() (in PHP) on the same page where you inserted and pass 
it into the page that needs it.

--
paperCrane Justin Patrin
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Error loading module: Unable to load dynamic library

2004-06-07 Thread Philippe
Thank you, that got me in the right direction. The OCI.DLL file on my 
system was an older version and dependency walker determined this. After 
that it was a simple matter of finding the right file version.
Thanks!

Christopher Jones wrote:
Philippe wrote:
Well, the exact message is: Unable to load dynamic library 
php_oci8.dll: The specified procedure could not be found
If I remove the library the message becomes The specified module 
could not be found. It seems to be able to find the library (all the 
paths are correct) but it seems that this php_oci8.dll file is the 
wrong version or that it is looking for an additional DLL that it 
can't find OR that it can find the additional DLL but it is the wrong 
version. If I only knew what DLL was needed!
Philippe

The common problem would be that php_oci8.dll cannot find Oracle's 
libraries.
Have you elimated this as the problem?

There are a coupel of things to try:
(i) Check phpinfo() output.  Make sure PATH in the Apache env section 
contains
the Oracle bin directory.  If this is not clear in my FAQ, please let me 
know
so I can update the FAQ.  Currently
   
http://otn.oracle.com/tech/opensource/php/php_troubleshooting_faq.html#envvars 

says:
If Apache starts but gives errors about Oracle libraries and/or
OCI8 function calls fail, try looking at PHP's environment. Create
the following script phpinfo.php where your web server can read
it and load it in a browser:
?php
  phpinfo();
?
Triple-check the environment and path configuration. On UNIX check
that LD_LIBRARY_PATH (or equivalent) contains $ORACLE_HOME/lib. On
Windows the PATH variable may need to contain %ORACLE_HOME%\bin.
(ii) Install http://www.dependencywalker.com/ and run it on php_oci8.dll
I'll look into adding a comment about this utility in the next FAQ update.
Chris
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Load data infile problem

2004-06-07 Thread Justin.Baiocchi
Hello, 
 
I have a page with a button that when clicked loads a pre-determined
text file into my database. The code is posted below.
However, when clicked the button does nothing, just opens up the same
page again. The data does not get loaded into the database. any ideas?
 
Thanks
Justin
 
The page is viewall.php which has the button on it. So I want it (when
clicked) to update the database and return to the page.
 
 
 
td width=100% align=center
  
?php
if ($submit) {
$dbH = mysql_connect('localhost', 'root', 'password') or die('Could
not connect to MySQL server.br' . mysql_error());
 
mysql_select_db(options);
 
$sql = 'LOAD DATA INFILE \'C:abc.txt\' REPLACE INTO TABLE `abc`'
. 'FIELDS TERMINATED BY \'\\t\''
. 'ENCLOSED BY \'\''
. 'ESCAPED BY \'\''
. 'LINES TERMINATED BY \'\\r\\n\'';
}
? 
 
?php
$d = form method=post action='viewall.php'. input type=submit
name=submit value='Submit'/form;
echo $d; ?
/td


RE: [PHP-DB] Load data infile problem

2004-06-07 Thread Justin.Baiocchi
Actually, I have just figured it out. It had to do with the 'slashes'
around the query. The original $sql code was created using phpmyadmin,
but I messed around with it until it worked, now using the following
query:

mysql_query(LOAD DATA INFILE 'C:abc.txt' INTO TABLE abc FIELDS
TERMINATED BY '\\t' ESCAPED BY '\\\' LINES TERMINATED BY '\\r\\n');

So it was the query formatting which was the problem.

Thanks
Justin


-Original Message-
From: Jonathan Haddad [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, 8 June 2004 2:06 PM
To: Baiocchi, Justin (LI, Armidale)
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Load data infile problem


does your server have the post variables set as globals?  you might 
have to use $_POST['submit'] instead.

On Jun 7, 2004, at 9:17 PM, [EMAIL PROTECTED] wrote:

 Hello,

 I have a page with a button that when clicked loads a pre-determined
 text file into my database. The code is posted below.
 However, when clicked the button does nothing, just opens up the same
 page again. The data does not get loaded into the database. any ideas?

 Thanks
 Justin

 The page is viewall.php which has the button on it. So I want it (when
 clicked) to update the database and return to the page.



 td width=100% align=center

 ?php
 if ($submit) {
 $dbH = mysql_connect('localhost', 'root', 'password') or
die('Could
 not connect to MySQL server.br' . mysql_error());

 mysql_select_db(options);

 $sql = 'LOAD DATA INFILE \'C:abc.txt\' REPLACE INTO TABLE 
 `abc`'
 . 'FIELDS TERMINATED BY \'\\t\''
 . 'ENCLOSED BY \'\''
 . 'ESCAPED BY \'\''
 . 'LINES TERMINATED BY \'\\r\\n\'';
 }
 ?

 ?php
 $d = form method=post action='viewall.php'. input type=submit
 name=submit value='Submit'/form;
 echo $d; ?
 /td

--
Jonathan Haddad
[EMAIL PROTECTED]
http://www.superwebstuff.com

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php