[PHP-DB] Dynamic where problem

2004-12-15 Thread Stuart Felenstein
I'm running a dynamic query and noticed I was not
getting the results expected.  

Explanation: 
Here I make the declaration for the query array:
$aWHERE = array();

Then test what variables came back from input:
if(!empty($aWHERE)) {
$query_rsCS .= ' WHERE '.implode(' AND ',$aWHERE);

Here is the problem. I have one field in the form that
is set to search 1 table on 1 field and another table
on 2 fields:

if(!empty($sCanEmail)) $aWHERE[] = Reg.email LIKE
'%$sCanEmail%';
if(!empty($sCanEmail)) $aWHERE[] =
Profiles_AddContacts.eml2 LIKE '%$sCanEmail%';
if(!empty($sCanEmail)) $aWHERE[] =
Profiles_AddContacts.eml3 LIKE '%$sCanEmail%';

So, if an email addy is not found in all 3 fields then
nada is returned.  Obviously ! (all AND statements)

Right now my thinking is I might need to break these
particular where conditions off into a seperate
array.  
Something like: $bWHERE = array();
then - 
$query_rsCS .= ' WHERE '.implode(' OR ',$bWHERE);

Or is it possible there is another work around I'm not
seeing yet ?

Thanks in advance.

Stuart

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



[PHP-DB] Printing with print functions under windows

2004-12-15 Thread antonio bernabei
Hi,
I need to use the printer functions.
I have some problems to have the output formatted as I want as to right
justify numbers of variable size the starting position varies with the type
of character chosen.Could anyone help me?
Best regards
Antonio Benrabei

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



[PHP-DB] test ... ignore me

2004-12-15 Thread Tatang Widyanto
test :)
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] MYSQL Maximum Time Exceeded

2004-12-15 Thread Jason Walker


This not be what you need, but I think there are some squiggle brackets
missing.

$conexion = mysql_connect(servername,username,password);

?php

If (!$conexion){
Echo Error connecting.;
}

?

Again, I don't think this is the root of the problem but it's the first
thing that popped out to me without knowing much more about your system.

Have you been able to connect to your mySQL instance with PHP before? With
no root password?

BTW - I have installed PHP and mySQL on WinXP in the past and it worked
fine. One caveat is that I recall using Apache not IIS. 

-Original Message-
From: PHPDiscuss - PHP Newsgroups and mailing lists
[mailto:[EMAIL PROTECTED] 
Sent: Wednesday, December 15, 2004 9:20 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MYSQL Maximum Time Exceeded

Hi.

I am running MySQL 4.0 and PHP 4.3.9 (MySQL Client Version 3.9.23) in
Windows XP.  I get this error when I try to connect to mysql:

Fatal error: Maximum execution time of 60 seconds exceeded in
c:\inetpub\wwwroot\index.php on line 4

My PHP script is:

html
body
?php
$conexion = mysql_connect( localhost, root,  );
if (!$conexion )
  echo Error Connecting.

?
/body
/html

I also tried installing newer PHP versios and newer MySQL but it's the
same.  Can anybody help me, please ?  Is WinXP incomaptible with MySQL or
what ?

Thanks in advance.

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



-- 
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.296 / Virus Database: 265.5.4 - Release Date: 12/15/2004




-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.296 / Virus Database: 265.5.4 - Release Date: 12/15/2004

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



RE: [PHP-DB] MYSQL Maximum Time Exceeded

2004-12-15 Thread Bastien Koert
no, mysql will work fine with iis, use it at work and use it at home that 
way, though have recently switched to apache

what web server are you running?
try
$conexion = mysql_connect( localhost, root,  ) or die (can't 
connect.mysql_error);
to give more info about the connection


From: Jason Walker [EMAIL PROTECTED]
To: 'PHPDiscuss - PHP Newsgroups and mailing lists' 
[EMAIL PROTECTED],[EMAIL PROTECTED]
Subject: RE: [PHP-DB] MYSQL Maximum Time Exceeded
Date: Wed, 15 Dec 2004 19:06:01 -0700


This not be what you need, but I think there are some squiggle brackets
missing.
$conexion = mysql_connect(servername,username,password);
?php
If (!$conexion){
Echo Error connecting.;
}
?
Again, I don't think this is the root of the problem but it's the first
thing that popped out to me without knowing much more about your system.
Have you been able to connect to your mySQL instance with PHP before? With
no root password?
BTW - I have installed PHP and mySQL on WinXP in the past and it worked
fine. One caveat is that I recall using Apache not IIS.
-Original Message-
From: PHPDiscuss - PHP Newsgroups and mailing lists
[mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 15, 2004 9:20 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] MYSQL Maximum Time Exceeded
Hi.
I am running MySQL 4.0 and PHP 4.3.9 (MySQL Client Version 3.9.23) in
Windows XP.  I get this error when I try to connect to mysql:
Fatal error: Maximum execution time of 60 seconds exceeded in
c:\inetpub\wwwroot\index.php on line 4
My PHP script is:
html
body
?php
$conexion = mysql_connect( localhost, root,  );
if (!$conexion )
  echo Error Connecting.
?
/body
/html
I also tried installing newer PHP versios and newer MySQL but it's the
same.  Can anybody help me, please ?  Is WinXP incomaptible with MySQL or
what ?
Thanks in advance.
--
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] date conversions

2004-12-15 Thread neil
Hi

I am needing to convert a d/m/y date such as 30/11/2004 into the format that
mysql can use ie. 2004-11-20

If I try the following:

$testdate=30/11/2004;
echo date(Y-m-d, strtotime($testdate));

the result is - 2006-06-11

I can't find any other function apart from strtotime to do this.

Any ideas?

Thanks
Neil

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



Re: [PHP-DB] date conversions

2004-12-15 Thread Jason Wong
On Thursday 16 December 2004 14:00, neil wrote:

 I am needing to convert a d/m/y date such as 30/11/2004 into the format
 that mysql can use ie. 2004-11-20

 If I try the following:

 $testdate=30/11/2004;
 echo date(Y-m-d, strtotime($testdate));

 the result is - 2006-06-11

 I can't find any other function apart from strtotime to do this.

Use the string functions to manipulate it into the required format, explode() 
is one approach. If you're desperate search the archives, hundreds of 
variations of code to do this have been posted in the past. But it might be 
quicker to write your own than to hit upon the appropriate keywords to search 
for.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
If practice makes perfect, and nobody's perfect, why practice?
*/

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



Re: [PHP-DB] date conversions

2004-12-15 Thread neil
Thank you for all your help.

Among all  the variations I found this to be the clearest:

list($d,$m,$y) = explode(/,$testdate);
$mysqldate = date(Y-m-d, mktime(0,0,0,$m,$d,$y));

But I also thought the use of split instead of explode so you could nominate
multiple delimiters was good.
eg.
list($d,$m,$y) = split('[/.-]', $testdate);

Another variation was to hardcode the date results instead of using the date
function which is very simple:
eg.
$mysqldate = $y.'-'.$m.'-'.$d;

Sorry for asking a question that is obviously asked often.

Interesting comment on 'normal'. I suspect that numerically more of the
world uses dmy than mdy. There is a lot more of the world outside the US
than in it.

Thanks again for all your help.

Neil


[EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Yeah, this is my problem with relyinig on strtotime().  If you don't give
it a format that it knows, it's going to give you random results (well, not
random, but undesireable).  Seems like more of a crutch that leaves too
much chance of error for my taste.  I prefer to be a little more explicit:


 $testdate=30/11/2004;
 list($day,$month,$year) = explode(/,$testdate);
 echo date(Y-m-d, mktime(0,0,0,$month,$day,$year));

 Try that out.  mktime() produces a serial date/time just like strtotime()
but you have a little more control over what it's producing and subsequently
what gets piped into date().  This exact example is what I used once before
when arguing against using strtotime().  Most people are going to use a
'normal' format that strtotime() likes, but the format you're using
(european standard?) and just using the numbers is the one big instance that
strtotime() breaks.

 Hope this helps.  You should be able to get whatever date format you need
now.

 -TG

 *** new email address [EMAIL PROTECTED]
 *** old email address [EMAIL PROTECTED] YAY CHAPTER 11!  :(




 = = = Original message = = =

 Hi

 I am needing to convert a d/m/y date such as 30/11/2004 into the format
that
 mysql can use ie. 2004-11-20

 If I try the following:

 $testdate=30/11/2004;
 echo date(Y-m-d, strtotime($testdate));

 the result is - 2006-06-11

 I can't find any other function apart from strtotime to do this.

 Any ideas?

 Thanks
 Neil


 ___
 Sent by ePrompter, the premier email notification software.
 Free download at http://www.ePrompter.com.

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



[PHP-DB] odbc_connect() parameters help please

2004-12-15 Thread Greg Jackson
Hi

I'm new to this group, but not to PHP :-)

Does anybody know why odbc_connect() requires a username and password to be
supplied as well as the DSN name?  This feature is preventing me from
accessing a database that can easily be accessed from asp with the following
example  code:

%
set conn=Server.CreateObject(ADODB.Connection)
conn.OpenD3_ODBC
set rs=Server.CreateObject(ADODB.recordset)
rs.Open select field1,field2 from tble where field3 like '%search%', conn
do until rs.EOF
  for each x in rs.Fields
Response.Write(x.name)
Response.Write( = )
Response.Write(x.value  br /)
  next
  Response.Write(br /)
  rs.MoveNext
loop
rs.Close
conn.Close
%

Second line of above code: conn.OpenD3_ODBC
Note that no user or password needs to be supplied.

For this particular ODBC driver (D3ODBC from Raining Data) there are in fact
two sets of user/password parameters specified in the DSN i.e. all four
fields of logon info must be supplied correctly on order to connect.

I have tried all possible combinations with odbc_connect() (including
blanks) in case it simply overrides a couple of the four fields in the DSN.
Nothing works.  There is network activity during the connection call and the
error message from the driver is the same as when you get the password wrong
from something like MSACCESS.

Does anybody know of a way around this limitation?

Best regards,
Greg Jackson

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



Re: [PHP-DB] Dates prior to Dec 31, 1969

2004-12-15 Thread Frank Marousek
Ramil and Jochem,

Having mySQL format the date is the best solution... thanks!

Frank

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