[PHP-DB] Re: timer

2002-06-12 Thread Philippe Saladin

 hi to all,
 how can I set up a timer that will tell me how long a query takes to run.
 for example, if I run the following query, I would like to know how long
it
 takes.
[...]
 Thanks in advanced
 Nato

I don't remember where I 've found this snippet, but it works well.

  $TIMER_START = explode( , microtime());
  $TIMER_START = $TIMER_START[1] + $TIMER_START[0];

## Do some stuff here:

  $TIMER_END = explode( , microtime());
  $TIMER_END = $TIMER_END[1] + $TIMER_END[0];
  echo br, $TIMER_END - $TIMER_START,  secs;

Regards,

Philippe



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




Re: [PHP-DB] Re: Error Loading File

2002-06-12 Thread Bryan Gintz

Whoops :),
Yes, this is using phpMyAdmin, trying to use the Insert data from a 
textfile into table function, which uploads a file and the attempts to 
LOAD DATA INFILE.  Like I said below, it worked on PHP 4.1.2, then when 
upgraded to PHP 4.2.1, it gave the error :

The file '/tmp/phpr4WYQY' must be in the database directory or be 
readable by all

I ran through the phpMyAdmin scripts and watched it up until it tried to 
load the file, and it wouldn't read it.  The /tmp directory is 
drwxrwxrwx and the files in it are -rw--, but I don't know how 
to get those changed in PHP.  Anyway, on a different server, I could 
have sworn I got the same problem but the uploaded files in the /tmp 
directory were -rwxrwxrwx.  

Any ideas?

Thanks

David Robley wrote:

In article [EMAIL PROTECTED], [EMAIL PROTECTED] says...

I am getting this error with a new install of PHP4.2.1 and Zend 
Optimizer 1.3.1:

The file '/tmp/phpr4WYQY' must be in the database directory or be 
readable by all

I just updated PHP and the Zend Optimizer, and it had worked previously 
with PHP4.1.2,

Any ideas??


Because you are asking on the db list, I'll guess that you are trying to 
use LOAD DATA INFILE? The file you are trying to load needs to be world 
readable if it isn't in the database directory.

If this isn't the problem, can you be a bit more specific about the 
circumstances in which this error appears?





[PHP-DB] Connecting to MS Access

2002-06-12 Thread Bill Hudspeth

I am having problems connecting to an Access database. I am using Windows
2000, IIS 4, Access 2000, and PHP 4.2.1. I have created a system DSN using
the Access (.mdb) driver, and have a username and password. What's going
on?? Thanks, Bill



The code I have used is as follows:







?php



//connect to database

$connectionstring = odbc_connect(meteoritecatalog, username,
password);

//line 14 is immediately above



//SQL Query

$query = SELECT sample, type FROM sample;



//execute query

$queryexe = odbc_do($connectionstring, $query);

//line 20 above



//output results to standard output

odbc_result_all($queryexe, BORDER=1);

//line 23 above



//disconnect from the database

odbc_close($connectionstring);

//line 26 above



?





The error message I get is:



Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver]General error
Not enough information to connect to this DSN with SQLConnect. Use
SQLDriverConnect., SQL state S1000 in SQLConnect in
C:\inetpub\wwwroot\PHP\data_tap.php on line 14

Warning: odbc_do(): supplied argument is not a valid ODBC-Link resource in
C:\inetpub\wwwroot\PHP\data_tap.php on line 20

Warning: odbc_result_all(): supplied argument is not a valid ODBC result
resource in C:\inetpub\wwwroot\PHP\data_tap.php on line 23

Warning: odbc_close(): supplied argument is not a valid ODBC-Link resource
in C:\inetpub\wwwroot\PHP\data_tap.php on line 26








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




[PHP-DB] resource id#2 - ????

2002-06-12 Thread Jas

Not sure how to over come this,  the result of a database query keeps giving
me this:
?php
/* Get Ip address, where they came from, and stamp the time */
if (getenv(HTTP_X_FORWARDED_FOR)){
$ipaddy = getenv(HTTP_X_FORWARDED_FOR);
} else {
$ipaddy = getenv(REMOTE_ADDR); }

$referrer = $HTTP_REFERER;
$date_stamp = date(Y-m-d H:i:s);

/* Start session, and check registered variables */
session_start();
if (isset($HTTP_SESSION_VARS['ipaddy']) ||
isset($HTTP_SESSION_VARS['referrer']) ||
isset($HTTP_SESSION_VARS['date_stamp'])) {
 $main = Video clips stored in Database;

/* Insert client info to database table */
 require('/path/to/connection/class/con.inc');
  $table_sessions = dev_sessions;
  $sql_insert = INSERT INTO $table_sessions
(ipaddy,referrer,date_stamp) VALUES ('$ipaddy','$referrer','$date_stamp');
  $result = mysql_query($sql_insert,$dbh) or die(Couldn't execute
insert to database!);

/* Pull video info from database table into an array */
  $table_content = dev_videos;
  $sql_content = mysql_query(SELECT * FROM $table_content,$dbh);
 while ($row = mysql_fetch_array($record)) {
$id = $row['id'];
$file_name = $row['file_name'];
$file_size = $row['file_size'];
$file_properties = $row['file_properties'];
$file_codec = $row['file_codec'];
$file_author = $row['file_author'];
 $result = mysql_query($sql_content,$dbh) or die(Couldn't execute
query on database!);

/* loop through records and print results of array into table */
  $current .=
trtd$id/tdtd$file_name/tdtd$file_size/tdtd$file_properties
/tdtd$file_codec/tdtd$file_author/td/tr; }
  } else {
  /* Start a new session and register variables */
  session_start();
  session_register('ipaddy');
  session_register('referrer');
  session_register('date_stamp'); }
?
Just to make sure everything is working correctly I have echoed every
statement to the screen so I may see what's going on like so:
?php echo $main; ?
table width=75% border=1
?php echo $current; ? // my results should be here but instead I get
Resource ID #2 printed wtf?
/tablebr
?php echo $ipaddy; ?br
?php echo $referrer; ?br
?php echo $date_stamp; ?br
?php echo $sql_insert; ?br
?php echo $sql_content; ?br
?php echo $id; ?br
?php echo $file_name; ?br
?php echo $file_size; ?br

Any help would be great!
Jas



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




RE: [PHP-DB] resource id#2 - ????

2002-06-12 Thread Leotta, Natalie (NCI/IMS)

The quick answer is that that is what it's supposed to return...  that's all
the result is.  A nicer, longer answer is to give you some of my code so you
can see one way that you actually get the data out (I use sybase_fetch_row,
but you can also use db_fetch_array which returns an associated array or
something - check the manual):

$dataResult = sybase_query($sql);
while ($array_ref = sybase_fetch_row($dataResult)) {
if ($array_ref[4] == 1) {
if ($array_ref[0] == $male ) {  
$left[$i] = $array_ref[2];
$names[$i] = $array_ref[3];
$ages[$i] = $array_ref[1];
$i++;   
}
elseif ($array_ref[0] == $female ) { 
$right[$j] = $array_ref[2];
$j++;
}
}
}//while

Last note - the index of the array ref refers to something in your SQL
starting with 0 (so my sql started with select sex...)

-Natalie

-Original Message-
From: Jas [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, June 12, 2002 1:42 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] resource id#2 - 


Not sure how to over come this,  the result of a database query keeps giving
me this: ?php
/* Get Ip address, where they came from, and stamp the time */ if
(getenv(HTTP_X_FORWARDED_FOR)){
$ipaddy = getenv(HTTP_X_FORWARDED_FOR);
} else {
$ipaddy = getenv(REMOTE_ADDR); }

$referrer = $HTTP_REFERER;
$date_stamp = date(Y-m-d H:i:s);

/* Start session, and check registered variables */ session_start(); if
(isset($HTTP_SESSION_VARS['ipaddy']) ||
isset($HTTP_SESSION_VARS['referrer']) ||
isset($HTTP_SESSION_VARS['date_stamp'])) {
 $main = Video clips stored in Database;

/* Insert client info to database table */
require('/path/to/connection/class/con.inc');
  $table_sessions = dev_sessions;
  $sql_insert = INSERT INTO $table_sessions
(ipaddy,referrer,date_stamp) VALUES ('$ipaddy','$referrer','$date_stamp');
  $result = @mysql_query($sql_insert,$dbh) or die(Couldn't execute
insert to database!);

/* Pull video info from database table into an array */
  $table_content = dev_videos;
  $sql_content = @mysql_query(SELECT * FROM $table_content,$dbh);
 while ($row = @mysql_fetch_array($record)) {
$id = $row['id'];
$file_name = $row['file_name'];
$file_size = $row['file_size'];
$file_properties = $row['file_properties'];
$file_codec = $row['file_codec'];
$file_author = $row['file_author'];
 $result = @mysql_query($sql_content,$dbh) or die(Couldn't execute
query on database!);

/* loop through records and print results of array into table */
  $current .=
trtd$id/tdtd$file_name/tdtd$file_size/tdtd$file_properties
/tdtd$file_codec/tdtd$file_author/td/tr; }
  } else {
  /* Start a new session and register variables */
  session_start();
  session_register('ipaddy');
  session_register('referrer');
  session_register('date_stamp'); }
?
Just to make sure everything is working correctly I have echoed every
statement to the screen so I may see what's going on like so: ?php echo
$main; ? table width=75% border=1 ?php echo $current; ? // my
results should be here but instead I get Resource ID #2 printed wtf?
/tablebr ?php echo $ipaddy; ?br ?php echo $referrer; ?br ?php
echo $date_stamp; ?br ?php echo $sql_insert; ?br ?php echo
$sql_content; ?br ?php echo $id; ?br ?php echo $file_name; ?br
?php echo $file_size; ?br

Any help would be great!
Jas



-- 
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] resource id#2 - ????

2002-06-12 Thread Paul DuBois

At 11:42 -0600 6/12/02, Jas wrote:
Not sure how to over come this,  the result of a database query keeps giving
me this:
?php
/* Get Ip address, where they came from, and stamp the time */
if (getenv(HTTP_X_FORWARDED_FOR)){
 $ipaddy = getenv(HTTP_X_FORWARDED_FOR);
} else {
 $ipaddy = getenv(REMOTE_ADDR); }

$referrer = $HTTP_REFERER;
$date_stamp = date(Y-m-d H:i:s);

/* Start session, and check registered variables */
session_start();
if (isset($HTTP_SESSION_VARS['ipaddy']) ||
isset($HTTP_SESSION_VARS['referrer']) ||
isset($HTTP_SESSION_VARS['date_stamp'])) {
  $main = Video clips stored in Database;

/* Insert client info to database table */
  require('/path/to/connection/class/con.inc');
   $table_sessions = dev_sessions;
   $sql_insert = INSERT INTO $table_sessions
(ipaddy,referrer,date_stamp) VALUES ('$ipaddy','$referrer','$date_stamp');
   $result = mysql_query($sql_insert,$dbh) or die(Couldn't execute
insert to database!);

/* Pull video info from database table into an array */
   $table_content = dev_videos;
   $sql_content = mysql_query(SELECT * FROM $table_content,$dbh);
  while ($row = mysql_fetch_array($record)) {

$record isn't defined anywhere.  Do you mean $sql_content?

 $id = $row['id'];
 $file_name = $row['file_name'];
 $file_size = $row['file_size'];
 $file_properties = $row['file_properties'];
 $file_codec = $row['file_codec'];
 $file_author = $row['file_author'];
  $result = mysql_query($sql_content,$dbh) or die(Couldn't execute
query on database!);

/* loop through records and print results of array into table */
   $current .=
trtd$id/tdtd$file_name/tdtd$file_size/tdtd$file_properties
/tdtd$file_codec/tdtd$file_author/td/tr; }
   } else {
   /* Start a new session and register variables */
   session_start();
   session_register('ipaddy');
   session_register('referrer');
   session_register('date_stamp'); }
?
Just to make sure everything is working correctly I have echoed every
statement to the screen so I may see what's going on like so:
?php echo $main; ?
table width=75% border=1
?php echo $current; ? // my results should be here but instead I get
Resource ID #2 printed wtf?
/tablebr
?php echo $ipaddy; ?br
?php echo $referrer; ?br
?php echo $date_stamp; ?br
?php echo $sql_insert; ?br
?php echo $sql_content; ?br
?php echo $id; ?br
?php echo $file_name; ?br
?php echo $file_size; ?br

Any help would be great!
Jas



--
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] resource id#2 - ????

2002-06-12 Thread Leotta, Natalie (NCI/IMS)

I totally didn't even see that section of code.  I am sorry I wrote back
like you were an idiot!  I think we know who the real idiot is today... :-)

Sorry again!

-Natalie

-Original Message-
From: Paul DuBois [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, June 12, 2002 1:53 PM
To: Jas; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] resource id#2 - 


At 11:42 -0600 6/12/02, Jas wrote:
Not sure how to over come this,  the result of a database query keeps 
giving me this: ?php
/* Get Ip address, where they came from, and stamp the time */
if (getenv(HTTP_X_FORWARDED_FOR)){
 $ipaddy = getenv(HTTP_X_FORWARDED_FOR);
} else {
 $ipaddy = getenv(REMOTE_ADDR); }

$referrer = $HTTP_REFERER;
$date_stamp = date(Y-m-d H:i:s);

/* Start session, and check registered variables */ session_start();
if (isset($HTTP_SESSION_VARS['ipaddy']) ||
isset($HTTP_SESSION_VARS['referrer']) ||
isset($HTTP_SESSION_VARS['date_stamp'])) {
  $main = Video clips stored in Database;

/* Insert client info to database table */
  require('/path/to/connection/class/con.inc');
   $table_sessions = dev_sessions;
   $sql_insert = INSERT INTO $table_sessions
(ipaddy,referrer,date_stamp) VALUES ('$ipaddy','$referrer','$date_stamp');
   $result = @mysql_query($sql_insert,$dbh) or die(Couldn't 
execute insert to database!);

/* Pull video info from database table into an array */
   $table_content = dev_videos;
   $sql_content = @mysql_query(SELECT * FROM $table_content,$dbh);
  while ($row = @mysql_fetch_array($record)) {

$record isn't defined anywhere.  Do you mean $sql_content?

 $id = $row['id'];
 $file_name = $row['file_name'];
 $file_size = $row['file_size'];
 $file_properties = $row['file_properties'];
 $file_codec = $row['file_codec'];
 $file_author = $row['file_author'];
  $result = @mysql_query($sql_content,$dbh) or die(Couldn't 
execute query on database!);

/* loop through records and print results of array into table */
   $current .= 
trtd$id/tdtd$file_name/tdtd$file_size/tdtd$file_proper
ties
/tdtd$file_codec/tdtd$file_author/td/tr; }
   } else {
   /* Start a new session and register variables */
   session_start();
   session_register('ipaddy');
   session_register('referrer');
   session_register('date_stamp'); }
?
Just to make sure everything is working correctly I have echoed every
statement to the screen so I may see what's going on like so:
?php echo $main; ?
table width=75% border=1
?php echo $current; ? // my results should be here but instead I get
Resource ID #2 printed wtf?
/tablebr
?php echo $ipaddy; ?br
?php echo $referrer; ?br
?php echo $date_stamp; ?br
?php echo $sql_insert; ?br
?php echo $sql_content; ?br
?php echo $id; ?br
?php echo $file_name; ?br
?php echo $file_size; ?br

Any help would be great!
Jas



--
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] resource id#2 - ????

2002-06-12 Thread Jas

Thanks a ton, I was really looking right past that variable.
Jas

Paul Dubois [EMAIL PROTECTED] wrote in message
news:p05111763b92d3addd3b4@[192.168.0.33]...
 At 11:42 -0600 6/12/02, Jas wrote:
 Not sure how to over come this,  the result of a database query keeps
giving
 me this:
 ?php
 /* Get Ip address, where they came from, and stamp the time */
 if (getenv(HTTP_X_FORWARDED_FOR)){
  $ipaddy = getenv(HTTP_X_FORWARDED_FOR);
 } else {
  $ipaddy = getenv(REMOTE_ADDR); }
 
 $referrer = $HTTP_REFERER;
 $date_stamp = date(Y-m-d H:i:s);
 
 /* Start session, and check registered variables */
 session_start();
 if (isset($HTTP_SESSION_VARS['ipaddy']) ||
 isset($HTTP_SESSION_VARS['referrer']) ||
 isset($HTTP_SESSION_VARS['date_stamp'])) {
   $main = Video clips stored in Database;
 
 /* Insert client info to database table */
   require('/path/to/connection/class/con.inc');
$table_sessions = dev_sessions;
$sql_insert = INSERT INTO $table_sessions
 (ipaddy,referrer,date_stamp) VALUES
('$ipaddy','$referrer','$date_stamp');
$result = @mysql_query($sql_insert,$dbh) or die(Couldn't execute
 insert to database!);
 
 /* Pull video info from database table into an array */
$table_content = dev_videos;
$sql_content = @mysql_query(SELECT * FROM $table_content,$dbh);
   while ($row = @mysql_fetch_array($record)) {

 $record isn't defined anywhere.  Do you mean $sql_content?

  $id = $row['id'];
  $file_name = $row['file_name'];
  $file_size = $row['file_size'];
  $file_properties = $row['file_properties'];
  $file_codec = $row['file_codec'];
  $file_author = $row['file_author'];
   $result = @mysql_query($sql_content,$dbh) or die(Couldn't execute
 query on database!);
 
 /* loop through records and print results of array into table */
$current .=

trtd$id/tdtd$file_name/tdtd$file_size/tdtd$file_properties

 /tdtd$file_codec/tdtd$file_author/td/tr; }
} else {
/* Start a new session and register variables */
session_start();
session_register('ipaddy');
session_register('referrer');
session_register('date_stamp'); }
 ?
 Just to make sure everything is working correctly I have echoed every
 statement to the screen so I may see what's going on like so:
 ?php echo $main; ?
 table width=75% border=1
 ?php echo $current; ? // my results should be here but instead I get
 Resource ID #2 printed wtf?
 /tablebr
 ?php echo $ipaddy; ?br
 ?php echo $referrer; ?br
 ?php echo $date_stamp; ?br
 ?php echo $sql_insert; ?br
 ?php echo $sql_content; ?br
 ?php echo $id; ?br
 ?php echo $file_name; ?br
 ?php echo $file_size; ?br
 
 Any help would be great!
 Jas
 
 
 
 --
 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] Querying for MAX

2002-06-12 Thread César Aracena

I’m sorry if this mensaje is posted twice. I sent it yesterdays, but
then my ISP had problems with e-mail and I lost dozens of them and don’t
know if sent OK.


Hi all,

What I’m trying to do here is not inside PHP nor MySQL books I have. I
need to query the DB to look the max result in a column. That is, if I
have affiliate members with ID going from 1 to 10, get the query to know
that the last member added was 10 so I can add member 11 without using
auto_increment, because I need to insert old members too which already
have ID numbers. Is that possible?

Thanks in advance,


Cesar Aracena mailto:[EMAIL PROTECTED] 
CE / MCSE+I
Neuquen, Argentina
+54.299.6356688
+54.299.4466621





[PHP-DB] RE: [PHP] Querying for MAX

2002-06-12 Thread Leotta, Natalie (NCI/IMS)

is

select MAX(column name)

what you are looking for?  I know it works on numeric columns, I'm not sure
if it works on non-numbers, you'd have to look it up in a SQL Tutorial
somewhere.

Good luck!

-Natalie

-Original Message-
From: César Aracena [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, June 12, 2002 2:36 PM
To: 'PHP DB List'; PHP General List
Subject: [PHP] Querying for MAX


I'm sorry if this mensaje is posted twice. I sent it yesterdays, but then my
ISP had problems with e-mail and I lost dozens of them and don't know if
sent OK.


Hi all,

What I'm trying to do here is not inside PHP nor MySQL books I have. I need
to query the DB to look the max result in a column. That is, if I have
affiliate members with ID going from 1 to 10, get the query to know that the
last member added was 10 so I can add member 11 without using
auto_increment, because I need to insert old members too which already have
ID numbers. Is that possible?

Thanks in advance,


Cesar Aracena mailto:[EMAIL PROTECTED] 
CE / MCSE+I
Neuquen, Argentina
+54.299.6356688
+54.299.4466621



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




[PHP-DB] RE: [PHP] Querying for MAX

2002-06-12 Thread César Aracena

Thanks Natalie  Ed. This Works just fine.

What I want to do, is let a person subscribe new affiliates without
having to look up what the last affiliate's number was and show the next
one in the new affiliate form.

César Aracena
IS / MCSE+I
Neuquén, NQN
(0299) 156-356688
(0299) 446-6621

 -Mensaje original-
 De: Leotta, Natalie (NCI/IMS) [mailto:[EMAIL PROTECTED]]
 Enviado el: Miércoles, 12 de Junio de 2002 03:39 p.m.
 Para: 'César Aracena'; 'PHP DB List'; PHP General List
 Asunto: RE: [PHP] Querying for MAX
 
 is
 
 select MAX(column name)
 
 what you are looking for?  I know it works on numeric columns, I'm not
 sure
 if it works on non-numbers, you'd have to look it up in a SQL Tutorial
 somewhere.
 
 Good luck!
 
 -Natalie
 
 -Original Message-
 From: César Aracena [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, June 12, 2002 2:36 PM
 To: 'PHP DB List'; PHP General List
 Subject: [PHP] Querying for MAX
 
 
 I'm sorry if this mensaje is posted twice. I sent it yesterdays, but
then
 my
 ISP had problems with e-mail and I lost dozens of them and don't know
if
 sent OK.
 
 
 Hi all,
 
 What I'm trying to do here is not inside PHP nor MySQL books I have. I
 need
 to query the DB to look the max result in a column. That is, if I have
 affiliate members with ID going from 1 to 10, get the query to know
that
 the
 last member added was 10 so I can add member 11 without using
 auto_increment, because I need to insert old members too which already
 have
 ID numbers. Is that possible?
 
 Thanks in advance,
 
 
 Cesar Aracena mailto:[EMAIL PROTECTED]
 CE / MCSE+I
 Neuquen, Argentina
 +54.299.6356688
 +54.299.4466621



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




RE: [PHP-DB] Connecting to MS Access

2002-06-12 Thread Ryan Jameson (USA)

I've duplicated your problem. I know I've had this working before, I'll let you know 
if I can figure it out. :-)

 Ryan

-Original Message-
From: Bill Hudspeth [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 12, 2002 10:22 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Connecting to MS Access


I am having problems connecting to an Access database. I am using Windows
2000, IIS 4, Access 2000, and PHP 4.2.1. I have created a system DSN using
the Access (.mdb) driver, and have a username and password. What's going
on?? Thanks, Bill



The code I have used is as follows:







?php



//connect to database

$connectionstring = odbc_connect(meteoritecatalog, username,
password);

//line 14 is immediately above



//SQL Query

$query = SELECT sample, type FROM sample;



//execute query

$queryexe = odbc_do($connectionstring, $query);

//line 20 above



//output results to standard output

odbc_result_all($queryexe, BORDER=1);

//line 23 above



//disconnect from the database

odbc_close($connectionstring);

//line 26 above



?





The error message I get is:



Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver]General error
Not enough information to connect to this DSN with SQLConnect. Use
SQLDriverConnect., SQL state S1000 in SQLConnect in
C:\inetpub\wwwroot\PHP\data_tap.php on line 14

Warning: odbc_do(): supplied argument is not a valid ODBC-Link resource in
C:\inetpub\wwwroot\PHP\data_tap.php on line 20

Warning: odbc_result_all(): supplied argument is not a valid ODBC result
resource in C:\inetpub\wwwroot\PHP\data_tap.php on line 23

Warning: odbc_close(): supplied argument is not a valid ODBC-Link resource
in C:\inetpub\wwwroot\PHP\data_tap.php on line 26








-- 
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] Connecting to MS Access

2002-06-12 Thread Ryan Jameson (USA)

It is the error message you get when you haven't selected the database file for your 
DSN. Go to your DSN, click configure, and click the SELECT button on the dsn. :-)

 Ryan

-Original Message-
From: Ryan Jameson (USA) 
Sent: Wednesday, June 12, 2002 1:09 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Connecting to MS Access


I've duplicated your problem. I know I've had this working before, I'll let you know 
if I can figure it out. :-)

 Ryan

-Original Message-
From: Bill Hudspeth [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 12, 2002 10:22 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Connecting to MS Access


I am having problems connecting to an Access database. I am using Windows
2000, IIS 4, Access 2000, and PHP 4.2.1. I have created a system DSN using
the Access (.mdb) driver, and have a username and password. What's going
on?? Thanks, Bill



The code I have used is as follows:







?php



//connect to database

$connectionstring = odbc_connect(meteoritecatalog, username,
password);

//line 14 is immediately above



//SQL Query

$query = SELECT sample, type FROM sample;



//execute query

$queryexe = odbc_do($connectionstring, $query);

//line 20 above



//output results to standard output

odbc_result_all($queryexe, BORDER=1);

//line 23 above



//disconnect from the database

odbc_close($connectionstring);

//line 26 above



?





The error message I get is:



Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver]General error
Not enough information to connect to this DSN with SQLConnect. Use
SQLDriverConnect., SQL state S1000 in SQLConnect in
C:\inetpub\wwwroot\PHP\data_tap.php on line 14

Warning: odbc_do(): supplied argument is not a valid ODBC-Link resource in
C:\inetpub\wwwroot\PHP\data_tap.php on line 20

Warning: odbc_result_all(): supplied argument is not a valid ODBC result
resource in C:\inetpub\wwwroot\PHP\data_tap.php on line 23

Warning: odbc_close(): supplied argument is not a valid ODBC-Link resource
in C:\inetpub\wwwroot\PHP\data_tap.php on line 26








-- 
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] Auto-update database records

2002-06-12 Thread Tony

I finally got this auto-update script to work, thanks for your so many
replies.

Tony S. Wu 

Jason Wong at [EMAIL PROTECTED] wrote:

 On Saturday 08 June 2002 21:34, Tony wrote:
 I do appreciate your reply.
 Yes, I've tried to track down the problem.
 I comment-out the fopen() function and use echo to display the URL.
 And it displays fine, so I did get the record from MySQL.
 Then when I put the fopen() back, same problem appears.
 
 You did check that $buffer contains what you expect for each iteration of
 $final_result?
 
 I think it's probably because I have too much data to update at once, over
 a hundred maybe?
 Then it causes the PHP to timeout this script hence the error.
 
 You can use set_time_limit(3000) inside a loop (probably the foreach) as each
 time it is used it will reset the max execution time to 3000secs.
 
 As I said before, see what's happening to the value of $counter. Or simplify
 that loop with a regular expression.





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




[PHP-DB] Re: Querying for MAX

2002-06-12 Thread Leon Mergen

select max(id) as amount from table

César aracena [EMAIL PROTECTED] wrote in message
003301c21240$0cdcf790$89c405c8@gateway">news:003301c21240$0cdcf790$89c405c8@gateway...
I'm sorry if this mensaje is posted twice. I sent it yesterdays, but
then my ISP had problems with e-mail and I lost dozens of them and don't
know if sent OK.


Hi all,

What I'm trying to do here is not inside PHP nor MySQL books I have. I
need to query the DB to look the max result in a column. That is, if I
have affiliate members with ID going from 1 to 10, get the query to know
that the last member added was 10 so I can add member 11 without using
auto_increment, because I need to insert old members too which already
have ID numbers. Is that possible?

Thanks in advance,


Cesar Aracena mailto:[EMAIL PROTECTED]
CE / MCSE+I
Neuquen, Argentina
+54.299.6356688
+54.299.4466621






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




[PHP-DB] problem with login script

2002-06-12 Thread suman

hi
when i execute this script i an error
---function 

this func is in file functions.php and the func deletecookies();

auuser($login,$passwd)
{
global $db_server,$http_host,$db,$db_user,$db_pass,$doc_root;

$connect=pg_pconnect(host=$db_server  dbname=$db user=$db_user 
password=$db_pass);
if(!$connect)
{
Displayerrmsg(sprintf(internal error 
%s\n,pg_ErrorMessage($connect));
return 0;
}

$query=select passwd from login where usr='$login';
$result=pg_exec($connect,$query) or die(ERROR IN 
QUERY:$query.pg_last_error($connect) );
if (!$result)
{
Displayerrmsg(sprintf(internal error 
%s\n,pg_ErrorMessage($connect));
return 0;
}
if( ($arr=pg_fetch_array($result,0,PGSQL_BOTH))  
($passwd==$arr[passwd]  $passwd!=) )
return 1;
else
return 0;
}

this is the file login.php

?
require 'functions.php';

//deletecookies();

$user=$_POST['login'];
$passwd=$_POST['passwd'];
$result=auuser($user,$passwd);
if(!$result)
{
setcookie(cookie_passwd,$passwd);
setcookie(cookie_user,$user);
header(Location :http://$http_host/$doc_root/stuinfo.html;);
exit();
}
else
{
header(Location:http://$http_host/$doc_root/login.html;);
exit();
}
   
 
---
i get this error


function auuser($login,$passwd) { global 
$db_server,$http_host,$db,$db_user,$db_pass,$doc_root;  return 0; } if( 
($arr=pg_fetch_array($result,0,PGSQL_BOTH))  ($passwd==$arr[passwd]  
$passwd!=) ) return 1; else return 0; } function Dispalyerrmsg ( $message ) 
{ printf(
.
.
.
the same func
.
%s
\n,$message); } function deletecookies() { setcookie(cookie_user,); }
Fatal error: Call to undefined function: auuser() in 
/usr/local/apache/htdocs/sims/php/login1.php on line 35

plz help me.soprry for ong mail

bye
suman


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




[PHP-DB] RE: [PHP] Querying for MAX -- solved

2002-06-12 Thread César Aracena

Come to think now, you are all right about making the field
auto_increment, instead of asking the DB which one is the following
number. It's just that I have a pretty large old DB in which this field
is NOT in sequence and should be imported before I keep designing the
scripts.

Thanks to all of you who helped me.

César Aracena
IS / MCSE+I
Neuquén, NQN
(0299) 156-356688
(0299) 446-6621

 -Mensaje original-
 De: John Holmes [mailto:[EMAIL PROTECTED]]
 Enviado el: Miércoles, 12 de Junio de 2002 08:51 p.m.
 Para: 'César Aracena'; 'PHP DB List'; 'PHP General List'
 Asunto: RE: [PHP] Querying for MAX
 
 Just note that this will fail miserably unless you are locking your
 tables around the SELECT MAX() and the INSERT. What if 3 different
users
 all select the same MAX() and try to insert the next number?
 
 You really need to re-think your database design if you have to do it
 this way.
 
 ---John Holmes...
 
  -Original Message-
  From: César Aracena [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, June 12, 2002 2:51 PM
  To: 'PHP DB List'; 'PHP General List'
  Subject: RE: [PHP] Querying for MAX
 
  Thanks Natalie  Ed. This Works just fine.
 
  What I want to do, is let a person subscribe new affiliates without
  having to look up what the last affiliate's number was and show the
 next
  one in the new affiliate form.
 
  César Aracena
  IS / MCSE+I
  Neuquén, NQN
  (0299) 156-356688
  (0299) 446-6621
 
   -Mensaje original-
   De: Leotta, Natalie (NCI/IMS) [mailto:[EMAIL PROTECTED]]
   Enviado el: Miércoles, 12 de Junio de 2002 03:39 p.m.
   Para: 'César Aracena'; 'PHP DB List'; PHP General List
   Asunto: RE: [PHP] Querying for MAX
  
   is
  
   select MAX(column name)
  
   what you are looking for?  I know it works on numeric columns, I'm
 not
   sure
   if it works on non-numbers, you'd have to look it up in a SQL
 Tutorial
   somewhere.
  
   Good luck!
  
   -Natalie
  
   -Original Message-
   From: César Aracena [mailto:[EMAIL PROTECTED]]
   Sent: Wednesday, June 12, 2002 2:36 PM
   To: 'PHP DB List'; PHP General List
   Subject: [PHP] Querying for MAX
  
  
   I'm sorry if this mensaje is posted twice. I sent it yesterdays,
but
  then
   my
   ISP had problems with e-mail and I lost dozens of them and don't
 know
  if
   sent OK.
  
  
   Hi all,
  
   What I'm trying to do here is not inside PHP nor MySQL books I
have.
 I
   need
   to query the DB to look the max result in a column. That is, if I
 have
   affiliate members with ID going from 1 to 10, get the query to
know
  that
   the
   last member added was 10 so I can add member 11 without using
   auto_increment, because I need to insert old members too which
 already
   have
   ID numbers. Is that possible?
  
   Thanks in advance,
  
  
   Cesar Aracena mailto:[EMAIL PROTECTED]
   CE / MCSE+I
   Neuquen, Argentina
   +54.299.6356688
   +54.299.4466621
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 --
 PHP General 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] Re: Error Loading File

2002-06-12 Thread David Robley

In article [EMAIL PROTECTED], [EMAIL PROTECTED] says...
 Whoops :),
 Yes, this is using phpMyAdmin, trying to use the Insert data from a 
 textfile into table function, which uploads a file and the attempts to 
 LOAD DATA INFILE.  Like I said below, it worked on PHP 4.1.2, then when 
 upgraded to PHP 4.2.1, it gave the error :
 
 The file '/tmp/phpr4WYQY' must be in the database directory or be 
 readable by all
 
 I ran through the phpMyAdmin scripts and watched it up until it tried to 
 load the file, and it wouldn't read it.  The /tmp directory is 
 drwxrwxrwx and the files in it are -rw--, but I don't know how 
 to get those changed in PHP.  Anyway, on a different server, I could 
 have sworn I got the same problem but the uploaded files in the /tmp 
 directory were -rwxrwxrwx.  
 
 Any ideas?
 
 Thanks
 
 David Robley wrote:
 
 In article [EMAIL PROTECTED], [EMAIL PROTECTED] says...
 
 I am getting this error with a new install of PHP4.2.1 and Zend 
 Optimizer 1.3.1:
 
 The file '/tmp/phpr4WYQY' must be in the database directory or be 
 readable by all
 
 I just updated PHP and the Zend Optimizer, and it had worked previously 
 with PHP4.1.2,
 
 Any ideas??
 
 
 Because you are asking on the db list, I'll guess that you are trying to 
 use LOAD DATA INFILE? The file you are trying to load needs to be world 
 readable if it isn't in the database directory.
 
 If this isn't the problem, can you be a bit more specific about the 
 circumstances in which this error appears?
 

chmod() ??

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




[PHP-DB] CGI Error - Need Help

2002-06-12 Thread G Morrison

I had to reinstall PHP  SQL, now whenever I run a PHP script I get the
following error, can someone please help.

Thanks

CGI Error
The specified CGI application misbehaved by not returning a complete set of
HTTP headers. The headers it did return are:



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




[PHP-DB] Executing Queries from a File Using PHP

2002-06-12 Thread Bruce Vander Werf


Is there a PHP routine anywhere to execute a series of MySQL queries in a
text file?

I know how to do this via the command line or by using PHPMyAdmin, but I
need to do it in my own PHP script, and some of the queries span more than
one line.

--
Bruce Vander Werf
[EMAIL PROTECTED]


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




Re: [PHP-DB] Querying for MAX

2002-06-12 Thread Srinivasan Ramakrishnan

Hi César,

As others have obviously pointed out using MAX() is the way to go. Need I
mention that you can also insert values of your own making into an
auto_increment column as long as they are not already used by some other
record.

In your case since you have old records with IDs of their own making, you
can probably insert them at the beginning before the newer records actually
use an auto - generated ID.

Also by using mysql_insert_id () in PHP you can get the last inserted
auto-increment ID.

-Srini
--
http://symonds.net/~sriniram

- Original Message -
From: César Aracena [EMAIL PROTECTED]
To: 'PHP DB List' [EMAIL PROTECTED]; PHP General List
[EMAIL PROTECTED]
Sent: Thursday, June 13, 2002 12:06 AM
Subject: [PHP-DB] Querying for MAX


I'm sorry if this mensaje is posted twice. I sent it yesterdays, but
then my ISP had problems with e-mail and I lost dozens of them and don't
know if sent OK.


Hi all,

What I'm trying to do here is not inside PHP nor MySQL books I have. I
need to query the DB to look the max result in a column. That is, if I
have affiliate members with ID going from 1 to 10, get the query to know
that the last member added was 10 so I can add member 11 without using
auto_increment, because I need to insert old members too which already
have ID numbers. Is that possible?

Thanks in advance,


Cesar Aracena mailto:[EMAIL PROTECTED]
CE / MCSE+I
Neuquen, Argentina
+54.299.6356688
+54.299.4466621





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




Re: [PHP-DB] Executing Queries from a File Using PHP

2002-06-12 Thread Jason Wong

On Thursday 13 June 2002 10:48, Bruce Vander Werf wrote:
 Is there a PHP routine anywhere to execute a series of MySQL queries in a
 text file?

 I know how to do this via the command line or by using PHPMyAdmin, but I
 need to do it in my own PHP script, and some of the queries span more than
 one line.

There are no built-in functions to do so. You need to read in the file 
yourself, parse it appropriately then send the queries to mysql.

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *


/*
Thank you for observing all safety precautions.
*/


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




Re: [PHP-DB] problem with login script

2002-06-12 Thread Jason Wong

On Thursday 13 June 2002 06:00, suman wrote:
 hi
 when i execute this script i an error
 ---func
tion

 this func is in file functions.php and the func deletecookies();

 auuser($login,$passwd)
 {
 global $db_server,$http_host,$db,$db_user,$db_pass,$doc_root;



[snip]

 
 this is the file login.php

 ?
 require 'functions.php';

[snip]

 ---
 i get this error


 function auuser($login,$passwd) { global
 $db_server,$http_host,$db,$db_user,$db_pass,$doc_root;  return 0; } if(
 ($arr=pg_fetch_array($result,0,PGSQL_BOTH))  ($passwd==$arr[passwd] 
 $passwd!=) ) return 1; else return 0; } function Dispalyerrmsg ( $message
 ) { printf(

[snip]

PHP code in functions.php must be enclosed within ?php ... ?

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *


/*
Home life as we understand it is no more natural to us than a cage is to a 
cockatoo.
-- George Bernard Shaw
*/


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