Re: [PHP-DB] problem with a small script

2002-06-11 Thread Jason Wong

On Tuesday 11 June 2002 14:04, George Pitcher wrote:
 Suman,

 Firstly, it's a bit longer than necessary.

 Make your form a 'POST' rather than 'GET' and you'll hide your query and

 ?php
 echo $fname;
 ?

 will then be the equivalent.

That requires 'register_globals' to be enabled, which for security reasons 
should be disabled, and is disabled by default on php 4.1.X and above.

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

/*
Pecor's Health-Food Principle:
Never eat rutabaga on any day of the week that has a y in it.
*/


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




Re: [PHP-DB] Unique SQL query?????????????

2002-06-11 Thread Lisi

Try adding 'distinct' before the field you are selecting.

-Lisi

At 01:42 AM 6/8/02 +0100, Georgie Casey wrote:
Is there any SQL command that will return a list of *unique* entries from a
fied. ie only repeat one for duplicates

i have a database of products, each having a category, and obviously a lot
of products have the same category and I want to create an index of all the
different categories.
  thanks

--
Regards,
Georgie Casey
[EMAIL PROTECTED]

***
http://www.filmfind.tv
Online Film Production Directory
***



--
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] mail() function

2002-06-11 Thread Lisi

If you are on Windows you can just point to your ISP's SMTP server in your 
.ini file.

At 11:02 AM 6/10/02 +0200, Dib, Walid (MED, Stagiaire GEMS) wrote:
Hello

I want to test the mail() function locally, i'm using esays php, how can I
do that?
thanks

Walid



--
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] addslashes for db search?

2002-06-11 Thread andy

Hi there,

I have some db records starting with a ' E.g:  'Aimburu

Now I am wondering how to retrieve this records. without a addslashes it
returns an error. So I did add a slash, but then it does not find this
record.

I tryed this query:

...like '\'Aimburu %' ...

Do I have to change this db entries, and if how? How should they look like
and is there a good method to change all this thousands of records at once?

Thanx in advance,

Andy



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




[PHP-DB] Men enought for this? LDAP, SSL, Active Directory

2002-06-11 Thread Andres Petralli

Hi NG Users,

I have sent this message to php.general too, but didn't get any response
there. It looks like this is all to new for most of the readers... Since
LDAP is some kind of db too, I thaught I'd send it to php.db...

I'm implementing some php 4.2.x code to manipulate Microsofts Active
Directory. I have already set-up the domain controller to handle LDAP
over SSL (Port 636) and it looks like it is working, at least I can
download a certificate when I browse the server with HTTPS.

The problem now is to get the certificate into php. Does anyone have
some clues how to manage this? Basically, what I'm trying to do is to
build a web-frontend to change passwords for AD accounts. I wouldn't
like to re-invent the wheel, so I'd really appreciate if someone could
post some code samples.

Also, if somebody already knows about some working ASP (VB) code, that
would also be very much appreciated. Anyway, it would be important to at
least be able to authenticate users agains AD with php, what probably
means that I still have to set-up a PHP/LDAP over a SSL connection to
AD. If anyone knows how to get a certificate into PHP, so that it is
possible to connect with something like this

$ds = ldap_connect(ldaps://servername:636);

that would be really great.

I've been browsing a lot on the web now and I really have tried almost
any search combinations with google and other search engines, but I
couldn't find any usefull docs on this topic. There are many people
looking into this issue, but finally most of them seem to fail when it
comes to connect to AD over SSL. If someone here has experience in this
field, I think he could do a favour to lots of developers, since it
looks like this is a major problem when it comes to interoperability
between Win2k and common Unix systems. Should I be successful in my
research, I really would be willing to write a decent documentation
about this, so that others wont have to waste so much time again, like
others did on this topic.

Kind regards to everyone,


Andres



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




[PHP-DB] dumping only selected records into another table

2002-06-11 Thread andy

Hi there,

I have some data in one table which I have to move to another. No I thought
of a mysqldump with a where clause. The problem though is, that it also
tryes to insert the ID which is a autoinc. primary key and already in use by
another record. How can I produce a insert statement withouth the ID
included?

This is how I tryed it:
mysqldump -p --where= country='us' -t data beaches  beaches_us.sql

This is a line of output:
INSERT INTO beaches VALUES (2345,'Carrabelle Beach','US','9');

This is how I would like to have the output:
INSERT INTO beaches VALUES ('','Carrabelle Beach','US','9');

does anybody know how to do this?

Thanx for any help, Andy











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




[PHP-DB] case

2002-06-11 Thread James Kupernik

I want to test a value that was typed into a form, but I don't want the case
to be a problem, how can I get around this??

This is what I have now:

function calculate_tax($OrderedByState,$ShipState)
{
 global $totalPrice;
 //tax calculation
 $taxRate = 0.05;
 if ($OrderedByState==MA  $ShipState==MA) {
$taxcost=$taxRate*$totalPrice;
 } else if ($OrderedByState==MA  $ShipName !=   $ShipState!=MA) {
$taxcost= 0.00;
 } else if ($OrderedByState==MA  $ShipState==) {
$taxcost=$taxRate*$totalPrice;
 } else if ($ShipState==MA) {
$taxcost=$taxRate*$totalPrice;
 } else {
$taxcost= 0.00;
 }

 return $taxcost;
}


Thanks for any help!



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




[PHP-DB] Re: case

2002-06-11 Thread James Kupernik

PLEASE IGNORE!

Thanks!


James Kupernik [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I want to test a value that was typed into a form, but I don't want the
case
 to be a problem, how can I get around this??

 This is what I have now:

 function calculate_tax($OrderedByState,$ShipState)
 {
  global $totalPrice;
  //tax calculation
  $taxRate = 0.05;
  if ($OrderedByState==MA  $ShipState==MA) {
 $taxcost=$taxRate*$totalPrice;
  } else if ($OrderedByState==MA  $ShipName !=   $ShipState!=MA)
{
 $taxcost= 0.00;
  } else if ($OrderedByState==MA  $ShipState==) {
 $taxcost=$taxRate*$totalPrice;
  } else if ($ShipState==MA) {
 $taxcost=$taxRate*$totalPrice;
  } else {
 $taxcost= 0.00;
  }

  return $taxcost;
 }


 Thanks for any help!





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




Re: [PHP-DB] case

2002-06-11 Thread Martin Clifford

Use strtolower() on all entries from the form, so you can compare them (in lowercase) 
without worry about whether the user entered MA, ma, Ma, or mA.

Martin

 James Kupernik [EMAIL PROTECTED] 06/11/02 10:15AM 
I want to test a value that was typed into a form, but I don't want the case
to be a problem, how can I get around this??

This is what I have now:

function calculate_tax($OrderedByState,$ShipState)
{
 global $totalPrice;
 //tax calculation
 $taxRate = 0.05;
 if ($OrderedByState==MA  $ShipState==MA) {
$taxcost=$taxRate*$totalPrice;
 } else if ($OrderedByState==MA  $ShipName !=   $ShipState!=MA) {
$taxcost= 0.00;
 } else if ($OrderedByState==MA  $ShipState==) {
$taxcost=$taxRate*$totalPrice;
 } else if ($ShipState==MA) {
$taxcost=$taxRate*$totalPrice;
 } else {
$taxcost= 0.00;
 }

 return $taxcost;
}


Thanks for any help!



-- 
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] case

2002-06-11 Thread Paul Burney

on 6/11/02 10:15 AM, James Kupernik at [EMAIL PROTECTED] appended the
following bits to my mbox:

 I want to test a value that was typed into a form, but I don't want the case
 to be a problem, how can I get around this??

This isn't a database related question, so it should probably be posted to
PHP General:

http://www.php.net/mailing-lists.php

That said, you can use a case insensitive regular expression to do what you
want, for example:

if (preg_match('~^ma$~i',$ShipState)) { // do something; }

You can read up at:

http://www.php.net/manual/en/function.preg-match.php

HTH.

Sincerely,

Paul Burney
http://paulburney.com/

?php

// the statement formerly known as prince
if ($the_elevator == 'tries to bring you down') {
go_crazy('punch a higher floor');
} 

?



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




AW: [PHP-DB] Men enought for this? LDAP, SSL, Active Directory

2002-06-11 Thread Andres Petralli

 have you tried yet?
 
 $ad = ldap_connect('ldaps://your.ldap.server', 636);
 $bound = ldap_bind($ad, 'somebinddn', 'somepasswd');
 
 worked out of the box, using it manage over 20,000 users at a
 university...can authenticate and change passwords, etc. 
 

Sure, I tried this. Do you possibly know how PHP gets a certificate to communicate 
over SSL? I mean, it looks like the secure channel cannot be estabilished. Do you know 
what has to be provided on the Active Directory's side?

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




[PHP-DB] Error Loading File

2002-06-11 Thread Bryan Gintz

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??

Thanks


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




[PHP-DB] timer

2002-06-11 Thread Natividad Castro

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.

$query_prism = INSERT INTO prism_rec_status(prism_rec_id) select 150bk.ID
from 150bk
WHERE PHY_ST='IN' Or PHY_ST='OR' Or PHY_ST='PA' Or
PHY_ST='IA' Or PHY_ST='MN'
Or PHY_ST='CO' Or PHY_ST='ME' Or PHY_ST='TN' Or
PHY_ST='GA';
$result_query = mysql_query($query_prism);

Is that possible in php??

Thanks in advanced
Nato


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




RE: [PHP-DB] timer

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

You could probably use:

$start = time();
//run query
$end = time();

and then compare start and end.  I don't know how time() formats the time,
but that's probably on PHP.net.

-Natalie

-Original Message-
From: Natividad Castro [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, June 11, 2002 1:27 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] timer


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.

$query_prism = INSERT INTO prism_rec_status(prism_rec_id) select 150bk.ID
from 150bk
WHERE PHY_ST='IN' Or PHY_ST='OR' Or PHY_ST='PA' Or
PHY_ST='IA' Or PHY_ST='MN'
Or PHY_ST='CO' Or PHY_ST='ME' Or PHY_ST='TN' Or
PHY_ST='GA'; $result_query = mysql_query($query_prism);

Is that possible in php??

Thanks in advanced
Nato


-- 
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] timer

2002-06-11 Thread Ryan Jameson (USA)

Just set one variable $var1=time(); before you call mysql_query and then subtract it 
from time(); after the query. That will be the number of seconds. If you need better 
precision you can use milliseconds too:

$t1 = getmicrotime();
$result_query = mysql_query($query_prism);
echo hrExecution Time:  . (getmicrotime()-$t1) .  seconds;

 Ryan

-Original Message-
From: Natividad Castro [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 11, 2002 11:27 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] timer


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.

$query_prism = INSERT INTO prism_rec_status(prism_rec_id) select 150bk.ID
from 150bk
WHERE PHY_ST='IN' Or PHY_ST='OR' Or PHY_ST='PA' Or
PHY_ST='IA' Or PHY_ST='MN'
Or PHY_ST='CO' Or PHY_ST='ME' Or PHY_ST='TN' Or
PHY_ST='GA';
$result_query = mysql_query($query_prism);

Is that possible in php??

Thanks in advanced
Nato


-- 
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] timer

2002-06-11 Thread Ryan Jameson (USA)

oopsss... I should put the getmicrotime() function... sorry, here it is:

function getmicrotime(){ 
list($usec, $sec) = explode( ,microtime()); 
return ((float)$usec + (float)$sec); 
} 

-Original Message-
From: Ryan Jameson (USA) 
Sent: Tuesday, June 11, 2002 11:22 AM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] timer


Just set one variable $var1=time(); before you call mysql_query and then subtract it 
from time(); after the query. That will be the number of seconds. If you need better 
precision you can use milliseconds too:

$t1 = getmicrotime();
$result_query = mysql_query($query_prism);
echo hrExecution Time:  . (getmicrotime()-$t1) .  seconds;

 Ryan

-Original Message-
From: Natividad Castro [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 11, 2002 11:27 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] timer


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.

$query_prism = INSERT INTO prism_rec_status(prism_rec_id) select 150bk.ID
from 150bk
WHERE PHY_ST='IN' Or PHY_ST='OR' Or PHY_ST='PA' Or
PHY_ST='IA' Or PHY_ST='MN'
Or PHY_ST='CO' Or PHY_ST='ME' Or PHY_ST='TN' Or
PHY_ST='GA';
$result_query = mysql_query($query_prism);

Is that possible in php??

Thanks in advanced
Nato


-- 
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




[PHP-DB] dumping only selected records into another table

2002-06-11 Thread andy

Hi there,

I have some data in one table which I have to move to another. No I thought
of a mysqldump with a where clause. The problem though is, that it also
tryes to insert the ID which is a autoinc. primary key and already in use by
another record. How can I produce a insert statement withouth the ID
included?

This is how I tryed it:
mysqldump -p --where= country='us' -t data beaches  beaches_us.sql

This is a line of output:
INSERT INTO beaches VALUES (2345,'Carrabelle Beach','US','9');

This is how I would like to have the output:
INSERT INTO beaches VALUES ('','Carrabelle Beach','US','9');

does anybody know how to do this?

Thanx for any help, Andy






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




[PHP-DB] dumping only selected records into another table

2002-06-11 Thread andy

Hi there,

I have some data in one table which I have to move to another. No I thought
of a mysqldump with a where clause. The problem though is, that it also
tryes to insert the ID which is a autoinc. primary key and already in use by
another record. How can I produce a insert statement withouth the ID
included?

This is how I tryed it:
mysqldump -p --where= country='us' -t data beaches  beaches_us.sql

This is a line of output:
INSERT INTO beaches VALUES (2345,'Carrabelle Beach','US','9');

This is how I would like to have the output:
INSERT INTO beaches VALUES ('','Carrabelle Beach','US','9');

does anybody know how to do this?

Thanx for any help, Andy








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




[PHP-DB] dumping only selected records into another table

2002-06-11 Thread andy

Hi there,

I have some data in one table which I have to move to another. No I thought
of a mysqldump with a where clause. The problem though is, that it also
tryes to insert the ID which is a autoinc. primary key and already in use by
another record. How can I produce a insert statement withouth the ID
included?

This is how I tryed it:
mysqldump -p --where= country='us' -t data beaches  beaches_us.sql

This is a line of output:
INSERT INTO beaches VALUES (2345,'Carrabelle Beach','US','9');

This is how I would like to have the output:
INSERT INTO beaches VALUES ('','Carrabelle Beach','US','9');

does anybody know how to do this?

Thanx for any help, Andy











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




[PHP-DB] RE: [PHP] dumping only selected records into another table

2002-06-11 Thread Jay Blanchard

[snip]
I have some data in one table which I have to move to another. No I thought
of a mysqldump with a where clause. The problem though is, that it also
tryes to insert the ID which is a autoinc. primary key and already in use by
another record. How can I produce a insert statement withouth the ID
included?
[/snip]

RTFMySQLM

http://www.mysql.com/doc/I/N/INSERT_SELECT.html

HTH!

Jay

It's hip to snip!
Give a man a program, frustrate him for a day.
Teach a man to program, frustrate him for a lifetime.




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




[PHP-DB] Re: Error Loading File

2002-06-11 Thread David Robley

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?

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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