php-windows Digest 17 Nov 2004 12:00:56 -0000 Issue 2471
Topics (messages 24982 through 24988):
How to check if a *string* has only numbers...
24982 by: Rafael Soares
24983 by: Larry E. Ullman
24984 by: Rafael Soares
24985 by: Michael Purdy
Re: PHP on an intranet with MSOffice-like templates
24986 by: Alain.Orset
PHP access to 64 bit MS SQL Server works ?
24987 by: Lars Nielsen
24988 by: list.elliott.uk.com
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
Hello people!!!
I would like to check if a string contains only numbers, I really can�t
realize how to do it.
I tried is_int(), but it don�t work because the variable is a string (I used
gettype() to check it) and is_int() returns NULL�
It is to validate some data in a form. The variable I�m trying to test is
the result of this script:
$data = $_POST[�data�]; // something like 123.456.789
$dataParts = explode($data);
//these are the variable I have to check:
$dataP1 = $dataParts[0];
$dataP2 = $dataParts[1];
$dataP3 = $dataParts[3];
gettype($dataP1), gettype($dataP2) and gettype($dataP3) return string
gettype($dataParts) returns array
Thanks in advance.
Rafael Soares - Ag�nciaM
Fone: +55 11 4616-1394
--- End Message ---
--- Begin Message ---
I would like to check if a string contains only numbers, I really can’t
realize how to do it.
is_numeric()
$data = $_POST[‘data’]; // something like 123.456.789
$dataParts = explode($data);
//these are the variable I have to check:
$dataP1 = $dataParts[0];
$dataP2 = $dataParts[1];
$dataP3 = $dataParts[3];
should probably be $dataP3 = $dataParts[2];
Larry
--- End Message ---
--- Begin Message ---
> is_numeric()
Thanks, it works so fine.
> should probably be $dataP3 = $dataParts[2];
The script in the email has some other errors, I wrote that as an example.
The original script is OK.
Thank you very much.
Rafael Soares - Ag�nciaM
Fone: +55 11 4616-1394
-----Mensagem original-----
De: Larry E. Ullman [mailto:[EMAIL PROTECTED]
Enviada em: ter�a-feira, 16 de novembro de 2004 23:42
Para: Rafael Soares
Cc: [EMAIL PROTECTED]
Assunto: Re: [PHP-WIN] How to check if a *string* has only numbers...
> I would like to check if a string contains only numbers, I really can�t
> realize how to do it.
is_numeric()
$data = $_POST[�data�]; // something like 123.456.789
> $dataParts = explode($data);
> //these are the variable I have to check:
> $dataP1 = $dataParts[0];
> $dataP2 = $dataParts[1];
> $dataP3 = $dataParts[3];
should probably be $dataP3 = $dataParts[2];
Larry
--- End Message ---
--- Begin Message ---
You can try
if (ereg('[^0-9]',$value))
{
do something // if you form value string contains non numerics do
something
}
else
{
settype($value,"integer"); // Its a numeric so set the string to a
integer to allow normal < > etc testing.
}
Mike
----- Original Message -----
From: "Rafael Soares" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, November 17, 2004 10:36 AM
Subject: [PHP-WIN] How to check if a *string* has only numbers...
Hello people!!!
I would like to check if a string contains only numbers, I really can't
realize how to do it.
I tried is_int(), but it don't work because the variable is a string (I used
gettype() to check it) and is_int() returns NULL.
It is to validate some data in a form. The variable I'm trying to test is
the result of this script:
$data = $_POST['data']; // something like 123.456.789
$dataParts = explode($data);
//these are the variable I have to check:
$dataP1 = $dataParts[0];
$dataP2 = $dataParts[1];
$dataP3 = $dataParts[3];
gettype($dataP1), gettype($dataP2) and gettype($dataP3) return string
gettype($dataParts) returns array
Thanks in advance.
Rafael Soares - Ag�nciaM
Fone: +55 11 4616-1394
--- End Message ---
--- Begin Message ---
Peter,
It is possible to produce word document from a php script.
The data will be extracted from mySQL (in the example provided it is from
msaccess, but it is the same process). Php can open an existing document and
replace Bookmark by a specific value.
The code may talk more than me.
// Create Client Letter
$documentKey = $agentAccount . "_" .
str_replace("/","_",$clientReference);
$word = new COM("word.application") or die("Unable to instantiate Word");
$template_file = $folder . "welcomeLetterAgent.dot";
$word->Documents->Open($template_file);
replaceBookmark($word,"clientReference",$clientReference);
replaceBookmark($word,"parentName",$parentName);
replaceBookmark($word,"businessName",$businessName);
replaceBookmark($word,"addressLine1",$addressLine1);
replaceBookmark($word,"addressLine2",$addressLine2);
replaceBookmark($word,"addressLine3",$addressLine3);
replaceBookmark($word,"addressLine4",$addressLine4);
replaceBookmark($word,"addressPostCode",$addressPostCode);
replaceBookmark($word,"paragraph3",$paragraph3);
replaceBookmark($word,"paragraph4",$paragraph4);
replaceBookmark($word,"paragraph5",$paragraph5);
replaceBookmark($word,"currentDate",$currentDate);
$new_file = $folder . $documentKey . "_welcomeLetter.doc";
$word->Documents[1]->SaveAs($new_file);
$word->Quit();
$word->Release();
$word = null;
function replaceBookmark($word,$bookmarkname,$bookmarktext) {
$objBookmark = $word->ActiveDocument->Bookmarks($bookmarkname);
$range = $objBookmark->Range;
$range->Text = $bookmarktext;
}
I hope it is what you wanted!
You can generate pdf document on the fly using the pdflib library
http://www.pdflib.com
Regards,
Alain
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 16, 2004 10:47 PM
To: [EMAIL PROTECTED]
Subject: PHP on an intranet with MSOffice-like templates
(originally posted to php-db, but I realized that this list is far more
germane
for the question - apology to those reading it twice).
I don't even know if this is possible, or if I'll have to go the route of
.NET
development to get this sort of functionality (I'm sure it's possible if I
jump
through enough hoops).
But here's what I'm trying to accomplish...
- users are all on a local intranet with access to a shared drive (no prob)
- users navigate a PHP-MySQL application to select records from a database
(no
prob)
- users are able to click a link which will launch some sort of document
(they
have Office, but if something like PDF is available on a Windows platform,
great) where a document template is fetched and updated with information
from
the selected record. (This is the part I don't understand how to do).
An example... user wants to be able to print one of a variety of letters to
physically mail to a customer, customized with the customer's account info.
(You know: Dear [first name] [last name], ... Your account [account_id] ...
is
30 days past due... etc )
This way, management can update the template and not have me re-work the
code to
have it work...
Is such a thing possible on a windows PHP platform? Can someone point me to
somewhere I can learn more about it?
Thanks much,
-P
*******************************************************************************************************************
Premium Credit Limited
Main Switchboard :01372-748833
Fax :01372-748811
This E-mail message together with any attachments transmitted with it is
intended only for use by its
addressee and may contain information which is privileged and confidential,
disclosure of which may
be prohibited by law. If you are not (or have not been authorised by) the
addressee, you may not
copy, forward, disclose or use any part of this message or its attachments. If
you have received this
message in error, please notify the sender by return E-mail and delete it from
your system. Premium
Credit Limited and its associate group of companies do not endorse opinions and
information in this
message and its attachments which do not relate to the official business of
Premium Credit Limited
and do not accept liability for errors or omissions arising from the presence
of computer viruses or
from interception/corruption in the course of transmission.
********************************************************************************************************************
--- End Message ---
--- Begin Message ---
Hi,
I've (quite surprisingly) been thrust upon having to use a 64 bit version of
SQL Server on a HP Superdome (Windows Server 2003
Datacenter Edition).
Does anyone on this list have any experience as to whether a solution made in
php 4.3.7 using SQL Server 2000 will work with a
server as mentioned above ? And if not, which version of PHP / mssql extension
that is needed to make it work ?
One note: the mentioned server only hosts the SQL Server, not PHP. It's
entirely a question of connectivity.
/Lars
--
--- End Message ---
--- Begin Message ---
Greetings Lars,
Historians believe that on 17 November 2004, at 11:35:00 +0100 (which was
10:35 where I live) Lars Nielsen wrote
> I've (quite surprisingly) been thrust upon having to use a 64 bit version
> of SQL Server on a HP Superdome (Windows Server 2003 Datacenter Edition).
> Does anyone on this list have any experience as to whether a solution
> made in php 4.3.7 using SQL Server 2000 will work with a server as
> mentioned above ? And if not, which version of PHP / mssql extension that
> is needed to make it work ?
> One note: the mentioned server only hosts the SQL Server, not PHP.
> It's entirely a question of connectivity.
1) Use ODBC.
2) Don't use the mssql extensions. As far as I know (I might be wrong) this
extension comes from the old MSSQL 6.5 days, and last time I used it it
would not handle complex queries.
--
BBFN, _______________________________________________
David | David Elliott | Software Engineer |
_________________________| [EMAIL PROTECTED] | PGP Key ID 0x650F4534 |
| "Oh, I think I can walk; I'll try." McCoy |
--- End Message ---