Re: [PHP] Connect to AS400

2006-01-26 Thread James Lobley
On 1/26/06, Richard Lynch <[EMAIL PROTECTED]> wrote:
>
> On Thu, January 26, 2006 2:23 pm, Justin Cook wrote:
> > We need to connect to a database on our AS400. Would this be best
> > accomplished with ODBC? If not, what is the preferred method? Thanks!
>
> The AS400 was discussed on this list, or possible on the predecessor
> list which was just [EMAIL PROTECTED] back in the day when there was
> only one PHP mailing list (not counting internal developer lists).
>
> As I recall, a straight ODBC connection was not quite enough, and some
> Voodoo had to be performed to get it to work, but it was possible.
>
> I also vaguely recall that the AS400 ended up being READ-ONLY, at
> least under one variant of that voodoo...


>From my experience, when the ODBC driver (for windows at least) is
installed, it defaults to read-only.
>From memory, this can be changed simply by ticking a check box to allow
writes.


Re: [PHP] Connect to AS400

2006-01-26 Thread James Lobley
On 1/26/06, Justin Cook <[EMAIL PROTECTED]> wrote:
>
> We need to connect to a database on our AS400. Would this be best
> accomplished with ODBC? If not, what is the preferred method? Thanks!
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Talking from a Windows point of view, you will need the AS400 Client Access
software (or similar - I think it has a new name now!) installed on the
machine you are trying to connect from.

Once this is done, you need to set up a data source in ODBC - System DSN
works best, then use the standard ODBC calls within PHP to access the
database.

If you need further detail, I should be able to help you once I get to work
in about 8 hours!


Re: [PHP] zipped files

2005-10-27 Thread James Lobley
These are the relevant sections from my code:

include("e:/bin/pclzip.php");
$provpath_dec = 'E:/Prov/Processed_Files/';
$provpath_unzip = 'E:/data/prov/';

$filename = '20051026202333.zip';

$archive = new PclZip($provpath_dec . $filename);
$archive->extract(PCLZIP_OPT_PATH, $provpath_unzip);

 As you'd probably guess from the paths shown, this is running on a windoze
box.
 James

 On 10/27/05, Clive <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I found that class but could not get it to work. Well it seem to work,
> as I could view the files information, but the extract() didn't do
> anything. I checked the writes for the directory the zip file was in and
> it did have wright rights. Maybe you can post a code snippet.
>
> thanks
>
> clive
>
> James Lobley wrote:
> > This is the class I use:
> > http://www.phpconcept.net/pclzip/man/en/index.php
> >
> >
> > On 10/26/05, Clive <[EMAIL PROTECTED]> wrote:
> >
> >>Hi
> >>
> >>does any one have code/examples for unzipping a file thats been uploaded
> >>to a server. I would prefer a class rather than something that uses
> >>zip.lib as it may not be configured on the server.
> >>
> >>clive
> >>
> >>--
> >>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
>
>


Re: [PHP] zipped files

2005-10-26 Thread James Lobley
This is the class I use:
http://www.phpconcept.net/pclzip/man/en/index.php


 On 10/26/05, Clive <[EMAIL PROTECTED]> wrote:
>
> Hi
>
> does any one have code/examples for unzipping a file thats been uploaded
> to a server. I would prefer a class rather than something that uses
> zip.lib as it may not be configured on the server.
>
> clive
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] Auto unzip uploaded file

2005-09-30 Thread James Lobley
On 9/30/05, Norbert Wenzel <[EMAIL PROTECTED]> wrote:
>
> I know a script (it's a webgallery) where you upload your images.zip
> with any amount of images in it. After uploading the .zip get unzipped
> and the images will be placed into the gallery.
>
> How did they unzip (or better, how is it possible to unzip) the file
> with php? and is it possible to extract let's say .rar or any other
> common format as well?
>
>
> thanks for your suggestions,
> norbert

 You might like to take a look at this:
http://www.phpconcept.net/pclzip/index.en.php
 I've had great success with it - both extracting files and creating zips.


Re: [PHP] Error loading extension dlls in WindosXP for PHP4.3.10

2005-01-12 Thread James Lobley
> Well Richard, I could able to solve it by copying all
> dlls into Windows\System32 directory. But still not
> sure why I need to copy all dlls into system32
> directory though I have mentioned in php.ini file that
> extension_directory=c:\PHP4\extensions.
> 
> regards,
> Ranjan
> 
Hi Ranjan,

You might find this page useful:
http://uk.php.net/install.windows.extensions

I found I needed to add the path C:\PHP\dlls to the XP System variable
'Path' as a lot of extensions have dependencies on dlls found in this
directory.
(in XP: Control Panel / System / Advanced / Environment Variables)
Don't forget to seperate what you add in from the existing paths with a ;

Best Wishes,

James

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



Re: [PHP] Creating Dropdown Menus From Tables

2004-09-20 Thread James Lobley
On Thu, 16 Sep 2004 13:02:31 +0100, Harlequin
<[EMAIL PROTECTED]> wrote:
> Hi all.
> 
> Hoping this might be relatively easy...
> 
> I'm wondering if I can create a dropdown menu (ABCDE) by
> using a select statement and then populating this using PHP...?
> 
> --
> -
> Michael Mason
> Arras People
> www.arraspeople.co.uk
> -

for a recent project, I needed an easily adaptable form, with a lot of
different, often changing elements, so I came up with the following
function (amongst others!):

// dropdown boxes
function dropdown($fieldname, $currentvalue='', $onchange='') {
   $var_val = $fieldname . '_val';
   $var_disp = $fieldname . '_disp';
   global ${$var_val}, ${$var_disp};
   if($onchange <> '') $onchange = 'ONCHANGE="' . $onchange . '"';
   echo('');
   for($loopy=1; $loopy<=sizeof(${$var_val}); $loopy++) {
   echo('' . ${$var_disp}[$loopy]);
   }
   echo('');
}

I have an include file with the options for each form element -
meaning options can be added or removed easily - an example is:

// Sex
$Sex_val[1] = 'M';
$Sex_disp[1]= 'Male';
$Sex_val[2] = 'F';
$Sex_disp[2]= 'Female';

The function would be called by:
// create dropdown
dropdown('Sex');

// create dropdown, select a matching value
dropdown('Sex',$current_sex);

// create dropdown, select a matching value and run a javascript
function when element is changed
dropdown('Sex',$current_sex, 'checkSex()');

HTH

j
;-}

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



RE: [PHP] is there a more efficient query?

2004-08-06 Thread James Lobley
Hi Brian,

Assuming you have mysql 4.0.0 or up, I think the following query should do you:

$query2 = "(SELECT value FROM element_values WHERE element=48 AND user=$user_id)
UNION (SELECT value FROM element_values WHERE element=49 AND user=$user_id)
UNION (SELECT value FROM element_values WHERE element=50 AND user=$user_id)
UNION (SELECT value FROM element_values WHERE element=51 AND user=$user_id)
UNION (SELECT value FROM element_values WHERE element=52 AND user=$user_id)
UNION (SELECT value FROM element_values WHERE element=53 AND user=$user_id)
$result2 = mysql_query($query2) or die("could not $query2 " . mysql_error());

hth,

James

-Original Message-
From: Brian Tully [mailto:[EMAIL PROTECTED]
Sent: 06 August 2004 17:15
To: PHP
Subject: [PHP] is there a more efficient query?


i currently have to query a table for 5 separate values based on elementid
and haven't figured out how to do it using just one query with an array or
associative array.

can someone enlighten me as to how I could perform the following queries
more efficiently, i.e., is there a way to do it with one query instead of
five?

thanks a bunch in advance,
brian


code:



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



RE: [PHP] UK Postcode Reg Exp

2004-02-17 Thread James Lobley
Try this one:

$postcode2 = strtoupper(str_replace(chr(32),'',$postcode));
$pc_suffix = substr($postcode2,-3,3);
$pc_prefix = substr($postcode2,0,(strlen($postcode2)-3));
if (!preg_match('/(^[A-Z]{1,2}[0-9]{1,2}|^[A-Z]{1,2}[0-9]{1}[A-Z]{1})$/',$pc_prefix) 
&& !preg_match('/^[0-9]{1}[ABD-HJLNP-UW-Z]{2}$/',$pc_suffix)) echo("Invalid 
postcode!");

It seems to have been working nicely on all variants put through it over the past few 
months!

James


I like nonsense ~ it wakes up the brain cells.
Fantasy is a necessary ingredient in living.
It's a way of looking at life through the wrong end of a telescope...
and that enables you to laugh at all of life's realities.

~ Theodor S. Geisel, a.k.a. "Dr. Seuss"



-Original Message-
From: James Nunnerley [mailto:[EMAIL PROTECTED]
Sent: 17 February 2004 16:59
To: 'Shaun'; [EMAIL PROTECTED]
Subject: RE: [PHP] UK Postcode Reg Exp


Hi Shaun,

Not that I know of - although I have looked at various things like this
myself.  Would you be interested in a small open source project on this
subject?

I see you instigated the discussion on this earlier today.  It might be
something worth putting on PEAR, and somehow linking it with the Royal
Mail Address search - assuming we can get through their login process!

Any thoughts?

James

[EMAIL PROTECTED]

-Original Message-
From: Jay Blanchard [mailto:[EMAIL PROTECTED] 
Sent: 17 February 2004 16:55
To: Shaun; [EMAIL PROTECTED]
Subject: RE: [PHP] UK Postcode Reg Exp

[snip]
Has anyone written a regular expression for validating a UK Postcode?
[/snip]

Nope, but I did write a love note to a French woman.

Sorry, couldn't resist. :) I'll be here all week.

Can you provide several examples and perhaps we could formulate one?

-- 
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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Connection AS400-Windows & PHP

2003-10-31 Thread James Lobley
1. Install IBM Client Access on your NT machine
2. Add details of your AS400 to Client Access
3. Create a Client Access data source in ODBC
4. Use ODBC calls within PHP, for example:
$connect = odbc_connect("AS400", "username", "password");
$query = "SELECT free
FROM stock
WHERE part='$item'";
$result = odbc_exec($connect, $query);
$available  = odbc_result($result, 'free');
    echo($available);
odbc_close($connect);

-- 
 @  James Lobley   |   Intranet Developer & Sysadmin
\/  --
()  This message was written on 100% recycled spam



-Original Message-
From: mohamad taghlobi [mailto:[EMAIL PROTECTED]
Sent: 30 October 2003 22:56
To: [EMAIL PROTECTED]
Subject: [PHP] Connection AS400-Windows & PHP


I would like to establish a connection between AS400 - Windows NT and PHP,
to make requetes on data base AS400, from forms PHP. I do not know how to
make, could you help me?



-
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Testez le nouveau Yahoo! Mail


This email is only intended for the person(s) to whom it is addressed and
may contain confidential information.  Unless stated to the contrary, any
opinions or comments are personal to the writer and do not represent the
official view of the company.  If you have received this e-mail in error,
please notify us immediately by reply e-mail and then delete this message
from your system.  Please do not copy it or use if for any purposes, or
disclose its contents to any other person.

We make every effort to keep our network free from viruses. You should 
independently check this e-mail and any attachments for viruses, as we 
can take no responsibility for any computer viruses that might be 
transferred by way of this e-mail. 

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



RE: [PHP] Backup Database

2003-09-02 Thread James Lobley
Hi Shaun,

DevShed's last weekly newsletter had the following:

Daily Scheduled Backup of MYSQL Databases - Looking for a free tool or
utility to handle scheduled MySQL backups. 
http://forums.devshed.com/t74513/s.html

Haven't tried any of the solutions yet, but will be soon!

James

-Original Message-
From: Shaun [mailto:[EMAIL PROTECTED]
Sent: 02 September 2003 15:18
To: [EMAIL PROTECTED]
Subject: [PHP] Backup Database


Hi,

Is there a facility out there that I can use to automatically backup my
database to my local machine every night using PHP and MySQL?

Thanks for your help

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


This email is only intended for the person(s) to whom it is addressed and
may contain confidential information.  Unless stated to the contrary, any
opinions or comments are personal to the writer and do not represent the
official view of the company.  If you have received this e-mail in error,
please notify us immediately by reply e-mail and then delete this message
from your system.  Please do not copy it or use if for any purposes, or
disclose its contents to any other person.

We make every effort to keep our network free from viruses. You should 
independently check this e-mail and any attachments for viruses, as we 
can take no responsibility for any computer viruses that might be 
transferred by way of this e-mail. 

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



RE: [PHP] How to optimize this MySQL command?

2003-06-05 Thread James Lobley
try this:

$resultb = mysql_query("SELECT bt_message.id, bt_message.title,
bt_message.mid,
bt_message.lastedit, bt_message.hit, bt_message.reply, bt_message.`lock`,
bt_member.nick
FROM bt_message, bt_member WHERE bt_member.id=bt_message.mid ch='$ch'
ORDER BY bt_message.top,bt_message.lastedit DESC LIMIT $limit,30",$db);
while ($result = mysql_fetch_array($resultb)) {
..
}

If field names are explicit (ie, only in one table), you can get away
without specifying
the table name (as in "SELECT title, mid,...") but be carefull with that -
from your
original example, I see you have field 'id' in both tables...

I would suggest taking a look at the mysql manual at the select & join
sections...


James


-Original Message-
From: Erick [mailto:[EMAIL PROTECTED]
Sent: 04 June 2003 14:45
To: [EMAIL PROTECTED]
Subject: Re: [PHP] How to optimize this MySQL command?


So, how about this?

$resultb = mysql_query("SELECT id,title,mid,lastedit,hit,reply,`lock` FROM
bt_message where ch='$ch' ORDER BY top,lastedit DESC LIMIT $limit,30",$db);
while ($result = mysql_fetch_array($resultb)) {
$result2b = mysql_query("SELECT nick FROM bt_member where id
='$result[mid]'",$db);
$result2 = mysql_fetch_array($result2b);
mysql_free_result($result2b);
..
}

-- 

"James Lobley" <[EMAIL PROTECTED]>
???:[EMAIL PROTECTED]
> I'd guess at:
>
> $resultb = mysql_query("SELECT bt_member.nick FROM bt_member, bt_message
> WHERE bt_member.id=bt_message.mid AND bt_message.ch='$ch'", $db);
> $result2 = mysql_fetch_array($resultb);
> .
>
>
> -Original Message-
> From: Erick [mailto:[EMAIL PROTECTED]
> Sent: 04 June 2003 13:12
> To: [EMAIL PROTECTED]
> Subject: [PHP] How to optimize this MySQL command?
>
>
> $resultb = mysql_query("SELECT id,mid FROM bt_message where ch='$ch'
",$db);
> while ($result = mysql_fetch_array($resultb)) {
> $result2b = mysql_query("SELECT nick FROM bt_member where id
='$result[mid]'
> ",$db);
> $result2 = mysql_fetch_array($result2b);
> .
> }
>
> Can combine together?
>
>
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> This email is only intended for the person(s) to whom it is addressed and
> may contain confidential information.  Unless stated to the contrary, any
> opinions or comments are personal to the writer and do not represent the
> official view of the company.  If you have received this e-mail in error,
> please notify us immediately by reply e-mail and then delete this message
> from your system.  Please do not copy it or use if for any purposes, or
> disclose its contents to any other person.
>
> We make every effort to keep our network free from viruses. You should
> independently check this e-mail and any attachments for viruses, as we
> can take no responsibility for any computer viruses that might be
> transferred by way of this e-mail.
>
>



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


This email is only intended for the person(s) to whom it is addressed and
may contain confidential information.  Unless stated to the contrary, any
opinions or comments are personal to the writer and do not represent the
official view of the company.  If you have received this e-mail in error,
please notify us immediately by reply e-mail and then delete this message
from your system.  Please do not copy it or use if for any purposes, or
disclose its contents to any other person.

We make every effort to keep our network free from viruses. You should 
independently check this e-mail and any attachments for viruses, as we 
can take no responsibility for any computer viruses that might be 
transferred by way of this e-mail. 



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



RE: [PHP] How to optimize this MySQL command?

2003-06-04 Thread James Lobley
I'd guess at:

$resultb = mysql_query("SELECT bt_member.nick FROM bt_member, bt_message
WHERE bt_member.id=bt_message.mid AND bt_message.ch='$ch'", $db);
$result2 = mysql_fetch_array($resultb);
.


-Original Message-
From: Erick [mailto:[EMAIL PROTECTED]
Sent: 04 June 2003 13:12
To: [EMAIL PROTECTED]
Subject: [PHP] How to optimize this MySQL command?


$resultb = mysql_query("SELECT id,mid FROM bt_message where ch='$ch' ",$db);
while ($result = mysql_fetch_array($resultb)) {
$result2b = mysql_query("SELECT nick FROM bt_member where id ='$result[mid]'
",$db);
$result2 = mysql_fetch_array($result2b);
.
}

Can combine together?



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


This email is only intended for the person(s) to whom it is addressed and
may contain confidential information.  Unless stated to the contrary, any
opinions or comments are personal to the writer and do not represent the
official view of the company.  If you have received this e-mail in error,
please notify us immediately by reply e-mail and then delete this message
from your system.  Please do not copy it or use if for any purposes, or
disclose its contents to any other person.

We make every effort to keep our network free from viruses. You should 
independently check this e-mail and any attachments for viruses, as we 
can take no responsibility for any computer viruses that might be 
transferred by way of this e-mail. 



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



RE: [PHP] get current username from the windows system

2003-01-23 Thread James Lobley
Hi Thomas,

The following code should help you...
Note that you have to turn off anonymous access in IIS, so that the user
authenticates to a domain.

");

$user_chunks = explode("\\",strtoupper(getenv("REMOTE_USER")));
$user_domain = $user_chunks[0];
$user_name = $user_chunks[1];

echo("User domain is $user_domain");
echo("User name is $user_name");
?>


James


-Original Message-
From: Thomas Franz [mailto:[EMAIL PROTECTED]]
Sent: 23 January 2003 10:44
To: [EMAIL PROTECTED]
Subject: [PHP] get current username from the windows system


Hi.

is their a possibilty to get the windows username of the current logged on
user with php.

I want this to make a logon dialog more comfortable.

Thanks for an answer and a little example if it's possible.

Thomas




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


This email is only intended for the person(s) to whom it is addressed and
may contain confidential information.  Unless stated to the contrary, any
opinions or comments are personal to the writer and do not represent the
official view of the company.  If you have received this e-mail in error,
please notify us immediately by reply e-mail and then delete this message
from your system.  Please do not copy it or use if for any purposes, or
disclose its contents to any other person.

We make every effort to keep our network free from viruses. You should 
independently check this e-mail and any attachments for viruses, as we 
can take no responsibility for any computer viruses that might be 
transferred by way of this e-mail. 



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