Re: [PHP-DB] mysql_error function

2006-10-06 Thread Honza Spurny
Niel Archer wrote:
 Hi

 OK, so there is no way how to get error message about mysql_connect()
 function when establishing more connections?

 mysql_error *should* hold the error string from the last used mysql
 function (excepting itself and mysql_errno), that includes the
 mysql_connect() function as it's a mysql function.

 The strange thing is, that it works fine if You use just one
 connection. In this case, mysql_error() function can takes error
 message from the mysql_connect() function...

  However, if you don't supply a resource idintifier it will asume the
 last opened link, hence your problem on the second connection
 failure.  When using more than one link, you should specify the link
 resource for mysql_error(), which is difficult for the
 mysql_connect() function, obviously.  I'm not sure if using the
 returned FALSE value would work,
 as I've never had a problem with additional connections.


YES, this is the problem.
Since
$dblink2 = mysql_connect() is getting false (so no resource object),
so $dblink is not correct parameter for mysql_error() function and it works
same way as there is no parameter.

OK, so mysql_error is not usable for me in this case.
Is in PHP any other way how to get error-message from connect function?
Isn't in PHP any other function, that can be used similiar?

 All of this is clearly decribed on the manual page.

 Niel

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



RE: [PHP-DB] Diff between 2 date

2006-10-06 Thread Miguel Guirao


I use CalcDateDiff.php class and it works pretty good!
I got it at PHP Classes.org

-Original Message-
From: Nandar [mailto:[EMAIL PROTECTED]
Sent: Jueves, 05 de Octubre de 2006 10:16 p.m.
To: php-db@lists.php.net
Subject: [PHP-DB] Diff between 2 date


How to know diff between 2 date ?

tgl1 = 2006-10-05
tgl2 = 2006-10-06

result = 1 day

nandar

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


Este mensaje es exclusivamente para el uso de la persona o entidad a quien esta 
dirigido; contiene informacion estrictamente confidencial y legalmente 
protegida, cuya divulgacion es sancionada por la ley. Si el lector de este 
mensaje no es a quien esta dirigido, ni se trata del empleado o agente 
responsable de esta informacion, se le notifica por medio del presente, que su 
reproduccion y distribucion, esta estrictamente prohibida. Si Usted recibio 
este comunicado por error, favor de notificarlo inmediatamente al remitente y 
destruir el mensaje. Todas las opiniones contenidas en este mail son propias 
del autor del mensaje y no necesariamente coinciden con las de Radiomovil 
Dipsa, S.A. de C.V. o alguna de sus empresas controladas, controladoras, 
afiliadas y subsidiarias. Este mensaje intencionalmente no contiene acentos.

This message is for the sole use of the person or entity to whom it is being 
sent.  Therefore, it contains strictly confidential and legally protected 
material whose disclosure is subject to penalty by law.  If the person reading 
this message is not the one to whom it is being sent and/or is not an employee 
or the responsible agent for this information, this person is herein notified 
that any unauthorized dissemination, distribution or copying of the materials 
included in this facsimile is strictly prohibited.  If you received this 
document by mistake please notify  immediately to the subscriber and destroy 
the message. Any opinions contained in this e-mail are those of the author of 
the message and do not necessarily coincide with those of Radiomovil Dipsa, 
S.A. de C.V. or any of its control, controlled, affiliates and subsidiaries 
companies. No part of this message or attachments may be used or reproduced in 
any manner whatsoever.

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



Re: [PHP-DB] mysql_error function

2006-10-06 Thread Niel Archer
Hi

 OK, so mysql_error is not usable for me in this case.
 Is in PHP any other way how to get error-message from connect function?
 Isn't in PHP any other function, that can be used similiar?

To the best of my knowledge, there is no work around for this situation. 
Even the 'Improved' MySQL Extension suffers this same limitation, so no
improvement there.

You can of course still determine failure, but not directly the cause. 
The only ways I can think of to begin identifying the error would be to
look up supplied username/password with the MySQL permissions db to
verify their authenticity, or to close the first connection and retry
the second after so it is the only connection.

Niel

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



[PHP-DB] SELECT date query

2006-10-06 Thread Ron Piggott (PHP)
I am wondering if someone would help me write a SELECT date query ...

Weekly mailings go out every Wednesday.  I am setting up an
administration function and table to store the mailing name, PDF to be
contained within the mailing and the date for it to be used.

The SELECT query I want to create is for the next 12 records which are
going to be used to be displayed.  The first record would be next
Wednesday (not October 11th, but calendar wise based on when the script
ran) and then the following 11 Wednesdays.

SELECT * FROM christian_discipleship WHERE created_for_date =
'$next_wednesday' ORDER BY created_for_date ASC LIMIT 12

I am not sure how to generate the value for $next_wednesday

Any ideas?

Ron


Re: [PHP-DB] SELECT date query

2006-10-06 Thread Niel Archer
Hi Ron

I've made the assumption that if today is Wednesday, you still want next
Wednesday.
Try this:

$offset = array(3,2,1,7,6,5,4);
$date = explode(-, date(Y-n-j));
$ToDay = DayOfWeek($date[0], $date[1], $date[2]);
$NextWed = date(Y-n-j, time() + ($offset[$ToDay] * 24 * 60 * 60));

// Returns a digit in range 0-6. 0 = Sunday, 6 = Saturday
function DayOfWeek($Year, $Month, $Day)
{
$t = array(0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4);
$Year -= $Month  3;
return ($Year + ($Year / 4) - ($Year / 100) + ($Year / 400) +
$t[$Month - 1] + $Day) % 7;
}


Niel

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



[PHP-DB] Re: php-db Digest 7 Oct 2006 03:29:53 -0000 Issue 3503

2006-10-06 Thread Frank Flynn
If you only have Wednesdays in you table - that is select the next 12  
records after today it's easy:


SELECT * FROM christian_discipleship WHERE created_for_date  now()
ORDER BY created_for_date ASC LIMIT 12

Good luck,
Frank

On Oct 6, 2006, at 8:29 PM, [EMAIL PROTECTED] wrote:



I am wondering if someone would help me write a SELECT date query ...

Weekly mailings go out every Wednesday.  I am setting up an
administration function and table to store the mailing name, PDF to be
contained within the mailing and the date for it to be used.

The SELECT query I want to create is for the next 12 records which are
going to be used to be displayed.  The first record would be next
Wednesday (not October 11th, but calendar wise based on when the  
script

ran) and then the following 11 Wednesdays.

SELECT * FROM christian_discipleship WHERE created_for_date =
'$next_wednesday' ORDER BY created_for_date ASC LIMIT 12

I am not sure how to generate the value for $next_wednesday

Any ideas?

Ron