[PHP] Migrating legacy code - changing session name

2010-01-26 Thread Rory McKinley
Hello List

A client has asked me to migrate a few scripts that have been running
merrily under PHP4 to PHP5.2. Part of these scripts have integration
with PHPMyAdmin
using the single sign-on and so they make use of the following code :

session_write_close();
session_name(blah);
session_start();

Now, assuming that prior to session_write_close(), I have a session
that (amongst other elements) contains the following:

$_SESSION['a'] = (an instance of Object A)
$_SESSION['b'] = (an instance of Object B)
$_SESSION['c'] = (an instance of Object C)

After session_start(), I have the following :

$_SESSION['a'] = (an instance of Object C)
$_SESSION['b'] = (an instance of Object C)
$_SESSION['c'] = (an instance of Object C)

This does not consistently happen, only under particular circumstances
(it seems to be a certain set of elements in $_SESSION triggers it).
For instance, if I unset $_SESSION['b'] * prior* to doing
session_write_close() - the behaviour stops, and the elements are
retained. Has anybody seen this before?


Vital Stats:

PHP5.2
Apache1.3
FastCGI
Sessions are stored using PHP5's default session handling.

Thanks in advance

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



Re: [PHP] Avoiding user refresh of pages with forms

2006-05-03 Thread Rory McKinley

Brad Bonkoski wrote:
Is there a way to key off of the data inserted?  Like some unique value 
or set of values that you can do a quick lookup before you 
insert/update/delete again...
Or you could venture into an AJAX style of submission keyed off of a 
button click then a refresh to a 'report' page, in which case no POST 
variables are actually passed to the report page, so refreshing it will 
just present the same data...


-Brad

Jeff wrote:


Is there a way to prevent a re-posting of the form data when a user
pushes the refresh button on the browser?

snip

To follow on from what Brad said - would it be possible to generate a 
key as a hidden value when the form is created. The first time the 
user submits the server checks if that unique code has ever been used 
within the current session  - if not, adds value. If so, ignores.


As a unique key you could use say timestamp plus random number.

HTH

Rory

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



Re: [PHP] PHP/MySql noob falls at first hurdle

2005-12-09 Thread Rory McKinley
Paul Jinks wrote:
snip

 ?
 while($ouput_row = mysql_fetch_array($result)) {
 ?
 ?=$output_row[projTitle]?br /

snip


Paul - is this the actual code that you are using? - because you have a
typo in your while statement - $ouput_row instead of $output_row - means
that when you try and echo $output_row it doesn't exist!

Rory

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



Re: [PHP] PHP/MySql noob falls at first hurdle

2005-12-09 Thread Rory McKinley
Paul Jinks wrote:
 Rory McKinley wrote:
 
 Paul Jinks wrote:
 snip

?
while($ouput_row = mysql_fetch_array($result)) {
?
?=$output_row[projTitle]?br /


 snip


 Paul - is this the actual code that you are using? - because you have a
 typo in your while statement - $ouput_row instead of $output_row - means
 that when you try and echo $output_row it doesn't exist!

 Rory


 Oh no.  I can't believe it. That was it. An idiotic typo.
snip

I wouldn't stress too much - happens to me all the time (sigh) and
(apparently) it happens to the best of us - but I am not qualified to
comment on the veracity of that statement :).

For future reference, during testing, you can set your error reporting
levels ( i think) in php.ini to output a notice regarding a variable
that does not exist - would have helped you spot the error! I normally
use the Zend debugger which does quite a good job of telling me that I
am an idiot :)

Rory

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



Re: [PHP] OT - database and indexes... but anyone please?

2005-09-26 Thread Rory McKinley
Rory Browne wrote:
snipdeleting an index(a good index that
 is) would slow the db down in certain cases. Deleting a bad index
 would speed certain operations up.
snip


If the index in question happens to be a unique index or a primary key
(really just a special case of index) - you could be breaking the logic
of the table (allowing duplicates where there should be none).

Pretty much as Rory (the other one) said: An index makes write
operations slower and read operations faster. When you are doing bulk
inserts to a table it is often a good idea to drop any index , populate
the table and then re-index (for performance reasons).

Regards

Rory

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



Re: [PHP] OT - database and indexes... but anyone please?

2005-09-26 Thread Rory McKinley
Rory Browne wrote:
snip
If the index in question happens to be a unique index or a primary key
(really just a special case of index) - you could be breaking the logic
of the table (allowing duplicates where there should be none).
 
 
 Couldn't that only happen if you dropped a UNIQUE or PRIMARY KEY. Just
 to clarify, I only meant deleting, or dropping the index. Not the
 column that is indexed.
 
snippety

AFAIK, the unique /PK index is what avoids duplicates. So, if you
dropped the index, while your existing data would still be
duplicate-free, you would have no guarantees with regard to any data
that you might write to the table after you had dropped the index.

There was nothing wrong with your original answer(s) - I was just adding
a few wrinkles to it as the OP did not provide much info in terms of the
index that he was wishing to drop.

Regards

Rory

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



Re: [PHP] Suggestions for class design

2005-09-19 Thread Rory McKinley
Chris W. Parker wrote:
snip


 class Customer
 {
  var $id;
  var $name;

snip
snip

  function get_customer()
  {

snip
snip


$this-name = $customer['name'];

  }

snip

 Where I get tripped up is when I realize I'll need to at some point get
 more than one customer at a time and thus I want to add a method called
 'get_customers()'.

snip

Hi Chris

Assuming that you have some procedural code, could you not create an
array of Customer objects?
I am not sure what argument would be passed to the get_customer function
as you do not have an argument in the function definition, but if it was
perhaps the customer name, you coud have something like :

/*Procedural code*/

$get_customer_names = 'SELECT ... FROM  WHERE customer ADDRESS LIKE
';

$customer_name_result_set = $db_connection-query($get_customer_names);

for($i=0; $i  $customer_name_result_set-num_rows; $i++) {

$customer_name_result_record = $customer_name_result_set-fetch_row();

$customers[$i] = new Customer;
$customers[$i]-get_customer($customer_name_result_record[0]);


}

That's how I would do it, at any rate (which is probably no
recommendation  ;)  ).

Regards

Rory

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



Re: [PHP] Knowledge Management

2005-08-04 Thread Rory McKinley
Roger Thomas wrote:
 I am trying to find a suitable opensource Knowledge Management System to be 
 used in my organisation; at least with document management, project 
 management group collaboration capabilities, like http://cortexpro.com/
 
 Any clues ?
 
snip

Hi Roger

KnowledgeTree comes highly recommended - our company was reviewing it,
but needed something that comes with project management stuff as well.
Based on PHP  MySQL:

http://sourceforge.net/projects/kt-dms/

Rory

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



Re: [PHP] OT ??: Form posting without leaving form

2005-06-14 Thread Rory McKinley
Kall, Bruce A. wrote:
 This is perhaps a javascript question
 
 Is there a way to post a form to a url without having a user submit from
 the form?
 
 I have a php web page that is a detailed form with a lot of fields.  If
 the user does some work on this form and let's it sit, their session can
 time out (I had this happen to the user after it sat for 2 hours). snip

Hi Bruce

A non-technical answer - is it not possible to break the form up into
multiple pages? Each page can have only a few fields, and all you can do
is store each page's submitted data and then recover what would be a
partial entry of a large form by going to the last completed miniform
when the user logs back in.

My 2c

Rory

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



Re: [PHP] Accessing DLL from PHP

2005-06-03 Thread Rory McKinley
Rory Browne wrote:
snip
snip
 Just bare in mind, that I've never used ffi, and it's still alpha
 code, and I'm not taking any blame it causes your dog to
 explode.
snip

That's ok, I am sure there is no chance...rover, rover,what's the matter
 boy? (Sound of dog exploding)
No. ;)

Don't worry I am only planning on using it to generate other data on a
dev box - so about the extreme worst that is going to happen is I have
to reload the dev box - and anyway, what's life without a bit of adventure?

Will let you know how it works out - only catch is I may have to dig
through my library to find the book on C that I never read ;) for some
of the syntax

Rory (the other one)

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



[PHP] Accessing DLL from PHP

2005-06-02 Thread Rory McKinley
Hi list

I do not have much programming experience outside some PHP stuff so
please excuse a stupid question:

I have a DLL provided to me by a third-party with a small bit of
documentation regarding its structure and methods. The DLL caculates
event costs based on parameters passed to it. I would like to access
this DLL using PHP if possible.

I have RTFM, and I am still busy STFW and STFA, but the little bit that
I have found has lead me towards trying to understand COM (eek!). Before
I go down that particular garden path, I would like to know if there is
any chance of success with PHP, or should I look at non-PHP alternatives
to access the DLL (e.g. C?)

Regards

Rory

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



Re: [PHP] Multiple inserts as a single string?

2005-06-02 Thread Rory McKinley
Richard Davey wrote:
snip
 
 Sure.. mysql_query doesn't support more than one query in the sql
 statement.
 
snip

At the risk of being thick, does the OP not mean something like this:

INSERT INTO blah VALUES (value1, value2), (value3, value4)

versus

INSERT INTO blah
VALUES (value1, value2)

 next iteration

INSERT INTO blah
VALUES (value3, value4)

Regards

Rory

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



Re: [PHP] Accessing DLL from PHP

2005-06-02 Thread Rory McKinley
Richard Davey wrote:
snip
 If the DLL has a COM interface then you can use PHP to talk to it, the
 process is actually quite straight forward (depending on what the DLL
 actually does of course).
 
 Best regards,
 
 Richard Davey
snip

Hi Richard

Rory (the other one ;) ) also mentioned a COM interface - currently I am
trying to find out if such a beast exists for the DLL, there is nothing
in the documentation. I would be interested to know if there was an easy
way to found out - still STFW though.

Have downloaded ffi as per Rory's suggestion, from the attached
documentation it looks as if it may be doable if the COM route doesn't
pan out.

Regards

Rory

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



Re: [PHP] Newbie LEFT JOIN question

2005-03-08 Thread Rory McKinley
Jackson Linux wrote:
Hi, all,
I have three tables; 'cv', the main table, 'jobcat', a definition table 
and 'cvjobcats',  an intersection table (for more detail see PS below).

I'd like to join this all together to be able to make a headline 
consisting of the plain English description of the job category followed 
by all rows within cv which contain a reference to that job category

I can follow this only to a point and that is where I ask for the List's 
help - does this even resemble the beginnings of what I want to 
accomplish? I've tried to comment as I go for my own sanity

//Select columns from 'cv', whose 'category' references numbers
//Select 'category' from 'jobcat' to translate the numbers to English
SELECT cv.cv_id,
 cv.category,
dates,
cv.job_title,
cv.company,
cv.job,
 jobcat.category
FROM cv
LEFT JOIN cvjobcats
 ON cvjobcats.cv=cv.cv_id //Let tables cv and jobcat understand each other.
//This next bit I'm confused about
LEFT JOIN jobcat
 ON jobcat.jobcat_id=cvjobcats.jobcat
WHERE
 cvjobcats.jobcat='4';
Great. I'm now lost. Can anyone advise?
Thanks in advance,
PS:
 far too much information
cv contains columns including an primary key ('cv_id') and a column 
called 'category' which refers to job categories by number.

jobcat contains two fields: a primary key (jobcat_id) and a plain 
english description

cvjobcat contains two key columns: 'cv_id' and 'jobcat_id'.
/far too much information
Hello Jackson
Are there any circumstances under which the cvjobcats table would have a 
job category entry that does not appear in the jobcats table? IF not, 
you really don't need to use the LEFT JOINS. Instead you coudl do 
something like this:

SELECT cv.cv_id,cv.category,dates,cv.job_title,cv.company,cv.job, 
jobcat.category
FROM cv, cvjobcats, jobcats
WHERE cvjobcats.cv=cv.cv_id AND cvjobcats_jobcat = 4 AND 
jobcat.jobcat_id=cvjobcats.jobcat

Less technically impressive perhaps but easier to follow ;)
Regards
Rory
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] mysql problems

2005-03-01 Thread Rory McKinley
Jed R. Brubaker wrote:
Hi all -
I could use a lead on a problem. I just don't know where to start.
I have a PHP script that populates a database table. No big deal. It creates 
mailing labels. However, a weird things keeps happening - every once in a 
while, a query is run twice. It is the same query, same information, even 
the same time (there is a now() in the query - and it is identical).

So the question is a simple one - is this a PHP problem or a MySQL problem? 
Or somewhere in the MySQL extension? And how would I know?

There is one clue to this otherwise vague problem. I believe that this 
predominantly happens when the database is under an above average load.

I would appreciate any help that I might be able to get.
Thank you.
Hi Jed
Can you post some sample code - showing how the query is called through 
PHP? IMHO, at first pass it sounds like PHP rather than MySQL - but I 
have been wrong before (many, many times);).

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


[PHP] Storing a reference to an object in another object

2005-01-19 Thread Rory McKinley
Hi All
This is probably just a case of me being Mr Thicky, but maybe someone 
can point out the error mf my ways:

I have two classes, call them admin and module. Admin stores login 
details as well as a pointer to the DB connection. Module will run 
various queries. To do that it needs access to the DB connection 
maintained by Admin. Because I don't want to have to keep on passing the 
reference to the admin instance, I thought I would store the reference 
to the admin instance within the module instance when the object is created:

class Module
{
private $admin_instance;
function __construct($admin_instance)
{
$this-admin_instance = $admin_instance;
}
public function checkConnection()
{
return $this-admin_instance-checkConnection()
}
}
I am using PHP 5 so the reference should be passed and stored in the 
relevant object attribute, not so?

Yet, if i call checkConnection it tells me that I am calling a method on 
a non-object.print_r() of the module instance  makes things even more 
confusing: print_r returns:

 [admin_instance:private] = [class_name] = blah [admin_instance] = 
Admin Object

which is followed by the various attributes of the admin object 
suggesting that the reference to the admin object is indeed within the 
module instance.

I hope someone can help with this..
Oh, and before anybody asks I am still busy RTFM, STFW, STFA but with no 
joy so far.

--
Rory McKinley
Nebula Solutions
+27 21 555 3227 - office
+27 21 551 0676 - fax
+27 82 857 2391 - mobile
www.nebula.co.za

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


[PHP] Is this a bug?

2005-01-13 Thread Rory McKinley
Hi
Probably a trivial question
While trying to use mysqli on my dev machine, PHP returns the following:
Fatal error: Trying to clone an uncloneable object of class mysqli
After STFW I have found a solution that involves swiching off 
compatibility with Zend Engine 1 in php.ini.

However, after going to bugs.php.net, it seems that it has not been 
logged as a bug.

So, the question would be - do I log it or am I wasting their time?
--
Rory McKinley
Nebula Solutions
+27 21 555 3227 - office
+27 21 551 0676 - fax
+27 82 857 2391 - mobile
www.nebula.co.za

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


[PHP] Sessions and multiple windows

2004-12-07 Thread Rory McKinley
Hi List
I am afraid that this is going to be a long complicated question. And to 
start off with I have RTFM, STFA, STFW - and have yet to find the answer 
I am looking for - unless, perhaps I am asking the wrong question?

But back to the subject - I have an app that allows users to open 
multiple windows to perform certain tasks. Even though the user has 
multiple windows, from the point of view of the app it is classified as 
a single session.

For this app I have an object  stored in a session variable that I use 
to administer logins, permissions etc. - call it $_SESSION['policeman']. 
This object stores information that is common to all windows (e.g. path 
to common error logging, current user id etc).

A simpler version fo this app did not allow for the opening of multiple 
windows and I needed to check if the user was logged in every time 
he/she went to a new page. I did this by putting a call to the 
checkLogin method inside $_SESSION['policeman']'s __wakeup method. Then 
, every time PHP unserialized $_SESSION['policeman'] it checked for the 
login.

I would like to do a similar thing with the more complex apps, but i do 
not know enough to be sure that it won't cause a problem and to be quite 
honest, I am not even entirely sure how to test it.  My problen lies in 
a scenario such as this:

User clicks through to page_3.php from page_2.php.
Page_3.php starts, unserializes $_SESSION['policeman'], and begins a 
lengthy SQL query that will take a few minutes to complete.

The user wants to do something else so he\she opens a new window for 
page_9.php (at this point page_3.php has yet to complete).

Now, the question is, what will PHP do when it starts with page_9? Will 
it unserialize $_SESSION['policeman'] again, even though it already has 
an unserialized instance of $_SESSION['policeman']? If it does 
unserialize, does that mean that it creates a second instance of 
$_SESSION['policeman'], thereby breaking the common link that I am 
trying to provide?

I hope someone will be able to point me in the right direction...
TIA
--
Rory McKinley
Nebula Solutions
+27 21 555 3227 - office
+27 21 551 0676 - fax
+27 82 857 2391 - mobile
www.nebula.co.za

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


Re: [PHP] Sessions and multiple windows

2004-12-07 Thread Rory McKinley
Jason Wong wrote:
On Tuesday 07 December 2004 20:50, Rory McKinley wrote:

snip
As Page_3.php is still doing its business the session data file is locked and 
when page_9.php tries to session_start() and finds it has no access to it 
will suspend execution until the lock is relinquished by Page_3.php.
snip
... because by the time it has access to the session data that unserialized 
instance of $_SESSION['policeman'] has already gone ...
snip
Hi Jason
Thanks for the rapid response.
So if I understand you correctly if the first page takes a half hour to 
complete its queries, then the second page is going to sit for a half an 
hour before it can access the session variables?

So the only way for the user to be able to do anything while the first 
page is at work is to get a new session id for each new window?

In such a case, is there any way to pass information between sets of 
session variables in such a case? (I.e from $_SESSION['policeman'] of 
session number 1 and $_SESSIOn['policeman'] of session number 2)

TIA


--
Rory McKinley
Nebula Solutions
+27 21 555 3227 - office
+27 21 551 0676 - fax
+27 82 857 2391 - mobile
www.nebula.co.za

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


Re: [PHP] Sessions and multiple windows

2004-12-07 Thread Rory McKinley

Richard Lynch wrote:
Now, the question is, what will PHP do when it starts with page_9? Will
it unserialize $_SESSION['policeman'] again, even though it already has
an unserialized instance of $_SESSION['policeman']? If it does
unserialize, does that mean that it creates a second instance of
$_SESSION['policeman'], thereby breaking the common link that I am
trying to provide?

page_9 does not have an unserialized instance of anything.
It is completely independent of page_2.
The $_SESSION variable is being shared, however, in some sense.
Probably the best solution here is to *NOT* store the unserialized
'policeman' in $_SESSION.
Set up a second array for your unserialized stuff, and write a function to
get/set it.
function get_session_data($field){
  global $_UNSERIALIZED;
  if (!isset($_UNSERIALIZED[$field])){
$_UNSERIALIZED[$field] = unserialize($_SESSION[$field]);
  }
  return $_UNSERIALIZED[$field];
}
function set_session_data($field, $value){
  global $_UNSERIALIZED;
  $_UNSERIALIZED[$field] = $value;
  //$_SESSION[$field] = serialize($value);
}
You can either write a function you call at the end of every script to
serialize everything and put it into $_SESSION, or you can un-comment the
line above.  Depends how much you shuffle in and out of serialized data.
Bottom line:  Don't confuse $_SESSION values by sometimes having
serialized data, and sometimes not in it.
Thanks Richard, Mike and Jason
I think I will need to sit down and sift through all the gen you guys
have given me, and decide which solution works best for me.
--
Rory McKinley
Nebula Solutions
+27 21 555 3227 - office
+27 21 551 0676 - fax
+27 82 857 2391 - mobile
www.nebula.co.za

--
Rory McKinley
Nebula Solutions
+27 21 555 3227 - office
+27 21 551 0676 - fax
+27 82 857 2391 - mobile
www.nebula.co.za

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


[PHP] $_POST and multiple windows

2004-11-20 Thread Rory McKinley
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hello List
Currently I am building an app that will have a navigation app that will
allow users to open multiple windows (every time they click on a link it
will open a new window) while the navigation window remains unchanged
(for the purpose of this question).
Therefore it will be possible for the user to work on more than one item
~ of functionality at the same time (e.g. he can have one window that he
is using to update client details and another that he uses to query
product details). All the persistent info is shared in session variables
and the session is cookies-based.
One of these session variables is an object that stores all login, and
user-permission related data. This object is accessed by each window
that is opened from the app control panel. Most of the windows will rely
on $_POST data which will be used for input to a DB.
My question is about the $_POST superglobal. I assume that there will be
only one instance of this superglobal per session and not per open
window (i.e. if I have three windows open, each running a different
module within the same app independent of one another, there is only a
single structure for storing their post data). Hence, if I have fields
in multiple windows that have a common name (e.g. I have two modules,
each of which requires a field called client name) posts from different
windows will overwrite the last post of a field with that common name,
regardless which window it came from.
E.g. doc1.php has a field called client_name
User enters client1 and hits submit.
$_POST['client_name'] = client1
doc2.php also has a field called client_name
User enters client2 and hits submit.
$_POST['client_name'] = client2
And now (finally) my question:
Let us assume that in the above example,  I renamed the field names so
that they weren't common :
doc1.php has a field called client_name1
doc2.php has a field called client_name2
When the submit button is hit in doc1.php the action page is doc1next.php
When the submit button is hit in doc2.php the action page is doc2next.php
In my scenario the user first clicks submit on doc1.php and then clicks
submit on doc2.php before doc1next.php is finished (i.e it still needs
to access the values posted from doc1next.php).
Will $_POST still contain both client_name1 and client_name2 or will the
$_POST array be emptied when submit is clicked in doc2.php - meaning
that the only field available is client_name2.
I have a sneaking suspicion that it is the latter but I am hoping that
someone will be able to tel me definitively.
Apologies for the looong email - I just wanted to make sure that my
problem was properly defined.

- --
Rory McKinley
Nebula Solutions
+27 21 555 3227 - office
+27 21 551 0676 - fax
+27 82 857 2391 - mobile
www.nebula.co.za

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.5 (MingW32)
iD8DBQFBn0BwpslJtahJIvMRArUnAKDavfdYBIYTpzxCPZJAKsM4gI4shACfX63M
ay1ZEuEa20c3eKSKkonSdFw=
=N6A5
-END PGP SIGNATURE-
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Cannot Load DLLs (WinXP, Apache 2, PHP 5)

2004-08-20 Thread Rory McKinley
Philip Olson wrote:
snip
New installation instructions exist that recommend never copying any
files to the Windows system directory.  It's preferred to leave all files
in the PHP directory and make it (the PHP folder) available to the systems
PATH by editing the appropriate system environment variable.  People copy
files into the Windows system directory because it's in the PATH so no
additional setup is required.  Do not fall into this trap.  Add the PHP
directory to your PATH as doing so will make the world a better place.
The updated manual is as follows:
 http://php.net/manual/en/install.windows.manual.php
If setup this way the above problem would not exist, PHP will find
libmysql.dll.  A FAQ on editing the systems path is here:
snip
Sorry Philip, but I have to disagree
I did an install on Wednesday of this week. I placed an entry for my PHP 
folder in the PATH and it made no difference. Only once I had 
overwritten the libmysql.dll in the Windows system folder with the 
version that ships with PHP5 did I get everything to play nicely together.

Regards
--
Rory McKinley
Nebula Solutions
+27 21 555 3227 - office
+27 21 551 0676 - fax
+27 82 857 2391 - mobile
www.nebula.co.za

This e-mail is intended only for the person to whom it is addressed and
may contain confidential information which may be legally privileged.
Nebula Solutions accepts no liability for any loss, expense or damage
arising from this e-mail and/or any attachments.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] reading txt file - certain lines

2004-07-30 Thread Rory McKinley
Dustin Krysak wrote:
snip
Now what I want to do is read this file, but only say read 5 songs 
worth, then I would place the PHP code in (another table) and display 
the next 5 songs and so on This just allows for a more flexible 
layout in the final presentation. the way I am having the text files 
written, there is no way to get it to produce seperate text files - 
otherwise this would be easy to do
snip
What you can do (if you have access to a DB) is pull the text file into 
a single field table, using br as the line terminator. Looking at my 
MySQl book, for LOAD DATA, it says you can use a string to terminate the 
line.

Then you can just run a simple query on the table (limited to the 
equivalent lines for 5 songs), and together with a loop, output the 
results.

For big files, the DB will be faster and provides you with far greater 
flexibility

HTH
--
Rory McKinley
Nebula Solutions
+27 21 555 3227 - office
+27 21 551 0676 - fax
+27 82 857 2391 - mobile
www.nebula.co.za

This e-mail is intended only for the person to whom it is addressed and
may contain confidential information which may be legally privileged.
Nebula Solutions accepts no liability for any loss, expense or damage
arising from this e-mail and/or any attachments.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Is there a brian I can pick?

2004-07-27 Thread Rory McKinley
Tom Ray [Lists] wrote:
Hey all-
I've run into a small bump in some code I'm writing for a membership 
database. The first thing that needs to be done is an index of all 
states in the US with members. The fun part is that the state 
information is stored as the abbreviation in the database (ie MI, WI) 
and the HTML page needs to display the full name of the State. I want 
to display the information in a four column table that kicks out as 
many rows as needed. Now in order to get the full name of the state, 
I'm running the state result through a switch statement. Actaully, 
it's working rather well expect for this little issue:

Row 8: South Dakota Tennessee Texas Virgina
Row 9: West Virgina Wisconsin Texas Virgina
I need to kill that extra Texas and Virgina.here's how I'm doing 
this:

table border=1
?
$query=mysql_query(SELECT DISTINCT state FROM members WHERE 
country='US' ORDER BY state ASC);  while($q=mysql_fetch_array($query)) {
snip
Hi Tom
Seeing as you are already using mysql, why not create a lookup table 
with the following fields:

state_abbreviation, state_full_name
And your query to :
SELECT DISTINCT b.state_full_name  FROM members a, state_lookup b WHERE 
a.country='US' AND b,state_abbreviation = a.state ORDER BY 
b.state_full_name ASC

This shifts the data processing work to MySQL (which is what it is 
designed for) - you can also  use the state lookup table for user input 
validation if needed.

--
Rory McKinley
Nebula Solutions
+27 21 555 3227 - office
+27 21 551 0676 - fax
+27 82 857 2391 - mobile
www.nebula.co.za

This e-mail is intended only for the person to whom it is addressed and
may contain confidential information which may be legally privileged.
Nebula Solutions accepts no liability for any loss, expense or damage
arising from this e-mail and/or any attachments.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Efficient way to filter this string

2004-07-22 Thread Rory McKinley
C.F. Scheidecker Antunes wrote:
Hello,
I have an email string that sometimes has a name and the email address 
between  and sometimes has the email adress right away.

Two examples of the possible value of $address
Joe Doe [EMAIL PROTECTED] [EMAIL PROTECTED]
snip

Off the top of my head - have you tried using a function like strrpos() 
to find  the last occurence of the  and use this (+ 1) as the start of 
a substring? This could avoid having to loop throguh he string - e.g

$raw_address =  'Joe Doe [EMAIL PROTECTED] [EMAIL PROTECTED]';
$email_address = substr($raw_address, (strrpos($raw_address, '') + 1));
--

Rory McKinley
Nebula Solutions
+27 21 555 3227 - office
+27 21 551 0676 - fax
+27 82 857 2391 - mobile
www.nebula.co.za

This e-mail is intended only for the person to whom it is addressed and
may contain confidential information which may be legally privileged.
Nebula Solutions accepts no liability for any loss, expense or damage
arising from this e-mail and/or any attachments.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Checking for character absence with regular expressions

2004-07-16 Thread Rory McKinley
Hi List
I am currently trying to check for the absence of certain substrings 
within larger strings using
regular expressions. I know that I could use on of the string functions, 
but in the interests of
flexibility I must use a regexp match of some shape or variety. Up until 
now, I have used PHP's
POSIX functions, but if someone has a solution for PCRE, I will use that 
as well.

An example of my problem:
I need to check that the substring  R (that's a space followed by an 
uppercase R) is not contained within my haystack.

E.g. Whatever pattern I match, if I match it against the following 
haystacks:

Blah Blah R 99.99 or  Blah Blah R99.99 it should return negative 
(i.e. the substring is contained within the haystack)

while
Blah Blah 99.99CR should return positive (i.e. the substring is not 
within the haystack).

I have RTFM, RTFA, STFW and perhaps I am not phraseing my search terms 
correctly, as I am having no luck.

Can anyone suggest a solution?

Rory McKinley
Nebula Solutions
+27 21 555 3227 - office
+27 21 551 0676 - fax
+27 82 857 2391 - mobile
www.nebula.co.za

This e-mail is intended only for the person to whom it is addressed and
may contain confidential information which may be legally privileged.
Nebula Solutions accepts no liability for any loss, expense or damage
arising from this e-mail and/or any attachments.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Creating Rows and Columns Using for() Loops

2004-07-09 Thread Rory McKinley
[EMAIL PROTECTED] wrote:
snip
|--|--|-
-|
 |MON JUL 5 |TUE JUL 6 | etc...
|
-||--|--|---
---||-|
Rm # |Rm Type |  First Name | Last Name  |  First Name | Last Name  | etc...
|Rm Type |Rm # |
-||--|--|---
---||-|
101  | NQQ| Isaac Newton | (empty room) | etc...
| NQQ|101  |
-||--|--|---
---||-|
102  | NK | Alexander Flemming   | Alexander Flemming   | etc...
| NK |102  |
-||--|--|---
---||-|
103  | K  | Charles Darwin   | Robert Kennedy   | etc...
| K  |103  |
-||--|--|---
---||-|
104  | QQ | Roger Rabbit | (empty room) | etc...
| QQ |104  |
-||--|--|---
---||-|
...  | ...| ... etc  | ... etc  | etc...
| ...|...  |
-||--|--|---
---||-|
 

snip
Hi
I know this not what you asked and please feel free to tell me to mind 
my own business, but a more useful design for your DB would be something 
like this:

Table : rooms
Fields: room_number (PK), room_type
Table: Customers
Fields: customer_id (PK, autoincrement), first_name, last_name, etc, etc
Table: bookings
Fields: room_number, booking_date, customer_id - PK(room_number, date)
In the short term, changing your db will be a bit of a pain cos of the 
code rework, but the db design will be more scalable and more useful in 
the long run. To get the display that you required you can do something 
like this - assuming that you want a seven day span starting from today 
(for example) - showing only the first two days

$query = SELECT a.room_number, a.room_type, IFNULL(CONCAT_WS( , 
b.first_name, b.last_name), Empty Room), d.room_number, d.room_type, 
IFNULL(CONCAT_WS( , e.first_name, e.last_name), Empty Room)
FROM rooms a LEFT JOIN bookings c ON a.room_number = c.room_number AND 
c.booking_date = 2004-07-09, customers b, rooms d LEFT JOIN bookings f 
ON d.room_number = f.room_number AND f.booking_date = 2004-07-10, 
customers e
WHERE b.customer_id = c.customer_id AND e.customer_id = f.customer_id

You will still have to add more code for the other five days, but if you 
want to be really clever and save wear and tear on your keyboard you can 
build the query dynamically using a loop...

You don't have to use a query this complicated, but if you do, you shift 
the bulk of the data processing and arranging to the DB (which does it a 
lot more efficiently than PHP). Then you just have to use PHP to create 
the table, the relevant headings and to populate the cells.

Ok, I am finished sticking my oar in...
Rory
   

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


[PHP] [ANNOUNCE] :Possibility of SA PHP conference

2004-02-17 Thread Rory McKinley
Hi All

Just a quick question.My wife has gotten tired of me complaining about the lack of PHP 
(and LAMP in general I suppose) conferences etc in South Africa. Therefore, seeing as 
she runs a conference company she is thinking of hosting a PHP conference in South 
Africa, but before she get's going she needs some idea of how large the PHP 
community in SA (and neighbours) is to see whether it will be worthwhile.

Can anyone who thinks this is a good idea drop me a mail off-list, so that we can get 
some gauge of the scale of repsonse that is likely to happen should the conference 
take 
place. Also, if you like you can give me info re: which city it should take place in, 
people 
that you would like as speakers etc.

Thanks in advance

Rory McKinley
Nebula Solutions
+27 82 857 2391
[EMAIL PROTECTED]
There are 10 kinds of people in this world, 
those who understand binary and those who don't (Unknown)

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



Re: [PHP] Variables not working!

2004-01-20 Thread Rory McKinley
On 19 Jan 2004 at 21:43, Kaushan wrote:

 Hi,
 
 I am new to PHP scripting and struggling with the following problem.
 
 I have two files, an HTML file and a PHP file.
 HTML file contains a form with one text field and a submit button.
 When a user pressed the submit button, it calls the php file (form
 action=test.php ...).
 What the php file does is just echo back the text  received from html file
 to the user again.
 Name of the text field is 'fname'. When I used this variable in the php file
 (as $fname) it does not contain the value of the text field. Query-string
 appended to the url during the submission is also correct.
 I checked for all syntax errors, but the codings are perfect.
 
 Do I have to change php.ini file to fix this problem.
 
 Could anyone can help me to solve this problem.
 
 Kaushan
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
Hi Kaushan

Little bit difficult without seeing the code, but what you are probably sitting with 
is an 
issue with globals - depending on your method of submitting (GET or POST)you can try 
and check one of these two $_POST['fname'] or $_GET['fname'] for the value of the 
text field.

Rory McKinley
Nebula Solutions
+27 82 857 2391
[EMAIL PROTECTED]
There are 10 kinds of people in this world, 
those who understand binary and those who don't (Unknown)

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



Re: [PHP][PEAR] PEAR::DB_Common::nextId()

2004-01-15 Thread Rory McKinley
On 14 Jan 2004 at 18:12, Alessandro Vitale wrote:

 I would like to get the last insert id... anyone has some experience in
 using the PEAR::DB_Common::nextId() ?
 
 any suggestion would be very much appreciated.
 
 alessandro
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
Hi Alessandro

Will mysql_insert_id() not help?

Rory McKinley
Nebula Solutions
+27 82 857 2391
[EMAIL PROTECTED]
There are 10 kinds of people in this world, 
those who understand binary and those who don't (Unknown)

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



Re: [PHP] Variable PHP Includes - Is there such a thing?

2004-01-15 Thread Rory McKinley
On 14 Jan 2004 at 21:16, Freedomware wrote:

 Suppose you design a standard banner for the top of your web pages and 
 use an include to insert it into every page on your site, like this:
 
 ?php
 include (../../../../includes/header.php);
 ?
 
 But you later decide you'd like to change just one element on each page. 
 For example, you might design a standard image banner, followed by a 
 title and subtitle for each page, but you want to change the title to 
 Alaska, Nebraska or Wyoming on each page.
 
 Is there a way to do this with PHP? If it has a name, I can search for 
 information online, but I don't even know what to call it.
 
 I've played with something of this nature in Dreamweaver. You can design 
 a template that turns out carbon copies of a page, but single out 
 certain items by enclosing them with @@, which are somehow changed on 
 individual pages, or something like that. I can't remember what it's 
 called at the moment.
 
 Another strategy would be to use a PHP include to insert an element on 
 different pages, then modify each element with a unique style sheet on 
 each page.
 
 But I just wondered if PHP offers additional possibilities for similar 
 experiments.
 
 Thanks.
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
Hi 

A possible option  could be something like  this 

{calling_template.php}

?php
/*State name does not have to be set statically, can be set from SQL query 
etc*/

$statename = 'Alaska';

include('/path/header.inc');

?

{header.inc}

?php

echo Welcome to the great state of .$statename.now go home!

?

That way you can put whatever you want as the statenameat the top of your pages, and 
the header willalways reflect it. You could also do something similar with objects 
e.g. 

?php

include('header.inc');

this_page_head = new header('Alaska')

?

if you are that way inclined.

Rory McKinley
Nebula Solutions
+27 82 857 2391
[EMAIL PROTECTED]
There are 10 kinds of people in this world, 
those who understand binary and those who don't (Unknown)

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



Re: [PHP] Variable PHP Includes - Is there such a thing?

2004-01-15 Thread Rory McKinley
On 14 Jan 2004 at 23:16, David Blomstrom wrote:

 --- Rory McKinley [EMAIL PROTECTED] wrote:
 
  A possible option  could be something like  this 
  
  {calling_template.php}
  
  ?php
  /*State name does not have to be set statically,
  can be set from SQL query 
  etc*/
 
 I think I understand what you're saying. I'm just
 getting started with PHP and haven't touched MySQL
 yet, but I can see you're setting up a database, or
 query, and...
 
  That way you can put whatever you want as the
  statenameat the top of your pages, and 
  the header willalways reflect it.
 
 Then you'd put some sort of code in the head section
 of each page that would draw on the system you set up
 to translate the codes for each page.
 
 I probably didn't work it right, but I think I get the
 general idea. I'll hang on to the code you gave me and
 play with it just as quick as I can learn more about
 this stuff.
 
 One question, is the example you gave me a pure PHP
 function, or does it indeed involve MySQL, too?
 
 Thanks!
 
 __
 Do you Yahoo!?
 Yahoo! Hotjobs: Enter the Signing Bonus Sweepstakes
 http://hotjobs.sweepstakes.yahoo.com/signingbonus
 
Hi David

You do not need to use a query - if you had a database you could retrieve the state 
names from there and perhaps save on typing. The code that I gave you does not use a 
MySQL query at all, although I perhaps could have explained it better.

Basically, the situation is like this :

If you have two scripts - the main page and the header include file and you include 
the 
header script in the main page script, there are no issues of variable scope i.e. all 
variables within the included script are visible to the including script and vice 
versa. 

Therefore if you tell the header script to echo a variable and this variable is 
defined in 
the main page script instead of the header script, the header script will have access 
to 
this variable. From your part, all you have to be willing to do is set the variable on 
each 
main page.

I hope this has clarified matters somewhat and not made things worse.


Rory McKinley
Nebula Solutions
+27 82 857 2391
[EMAIL PROTECTED]
There are 10 kinds of people in this world, 
those who understand binary and those who don't (Unknown)

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



Re: [PHP] Variable PHP Includes - Is there such a thing?

2004-01-15 Thread Rory McKinley
On 15 Jan 2004 at 0:21, Freedomware wrote:

 Rory McKinley wrote:
  
  I hope this has clarified matters somewhat and not made things worse.
  
 
 Absolutely; the only thing that has made matters worse so far is the 
 book Teach Yourself PHP, MySQL and Apache, which had me thinking 
 making PHP includes was going to be a minor wrestling match. In fact, 
 they were so simple even I can understand them, and the information you 
 just gave me is more or less the vision I had in my mind some time ago, 
 before I even heard of PHP.
 
 Thanks for the tips!
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
Glad to have helped.

I taught myself from a book called PHP and MySQL Web Development by Welling  
Thompson (I got it about 18 months ago) I found it quite understandable andthey 
probably have a new version out by now - perhaps that book will serve you better!



Rory McKinley
Nebula Solutions
+27 82 857 2391
[EMAIL PROTECTED]
There are 10 kinds of people in this world, 
those who understand binary and those who don't (Unknown)

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



Re: [PHP] Cross Server, Cross Database connection W/ JOINs

2004-01-07 Thread Rory McKinley
On 6 Jan 2004 at 14:10, Jay Blanchard wrote:

 Does anyone know how, if possible, to connect to two databases on two
 different network servers so that join queries can be performed (without
 using temporary tables)? 
 
 I am using MySQL so mysql_pconnect() or mysql_connect() will insert a
 default server ('localhost:3306', per the docs) if I do not specify one.
 Specifying two servers (with the same granted user/pw combo) throws a
 syntax error. I have tested and searched, but turned up nothing so far.
 This is an experiment, but I can see where the value would be far
 ranging for those operating database server farms within their network
 (data modularization).
 
 If you have attempted this sort of (or would like to) thing I'd like to
 hear your thought, caveats, etc.
 
 TIA!
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
Hi Jay

We are currently developing an application that will have a set of rules dbs sitting 
on a 
single server while client data is stored in dbs on different servers (for performance 
reasons). We are also faced with the issue of only wanting to keep one copy of the 
rules dbs (to ensure consistency and ease of updating) and using these rules in 
queries 
involving client data - i.e. queries using databases on separate hosts.

I raised this question (either in this list, or PHP-DB, or MySQL..my memory fails me) 
and the responses that I got suggested that the only viable option is keeping local 
copies of the rules db on each client and keeping these updated via replication. 
Currently we are developing on a single server (client and rules) but we are building 
the 
code so we have yet to sort out the replication but that looms ahead of us.

If there is a way to do what you suggest, I would be glad to hear about it, and if I 
could I 
would happily assist to the best of my meagre abilities as it would definitely make my 
life 
simpler.

Regards

Rory McKinley
Nebula Solutions
+27 82 857 2391
[EMAIL PROTECTED]
There are 10 kinds of people in this world, 
those who understand binary and those who don't (Unknown)

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



Re: [PHP] Regular Expression Help Please

2003-12-01 Thread Rory McKinley
On 27 Nov 2003 at 11:48, Shaun wrote:

 Hi,
 
 I need to generate a lowercase alphanumeric passwrord thats 8 characters
 long, has anyone got a function that can do this?
 
 Thanks for your help
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

Umm, I don't know of a function already definedbut it shouldn't be that hard to 
generate .in pseudocode :

1.Create an array containing the lower case letters as well as the digits
2. Pick a random integer between 0 and 35 (n)
3. Retrieve the character in array[n]
4. Add to password string.
5. Loop through another seven times

HTH

Rory McKinley
Nebula Solutions
+27 82 857 2391
[EMAIL PROTECTED]
There are 10 kinds of people in this world, 
those who understand binary and those who don't (Unknown)

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



Re: [PHP] Mysql backup

2003-11-28 Thread Rory McKinley
Binay

If the tables for both versions are MYISAM the steps are as follows:

1. Stop mysql on both systems.
2. Copy the contents of the 3.23.37 data folder to the 3.23.58 data folder using your 
OS tools (cp, file management tools, Windows explorer etc)
3. Start mysql on both systems.

HTH

Rory

On 28 Nov 2003 at 17:17, Binay wrote:

 Hi all !
 
 I know this is more of mysql issue than PHP but then i always get my problem 
solved here.. and hope the same this time also ...
 
 I have two systems.
 one with mysql-version: 3.23.37
 other with mysql-version: 3.23.58
 
 now i want to take the backup of 3.23.37 data and copy to 3.23.58 ...
 
 i know i can take backup using mysqldump command ... and then copy using 
mysql commands
 
 but as mysql create folder for each database . 
 is it possible to copy the particular folder(database) to 3.23.58 and then running 
 it 
smoothly ...
 
 Any body got any idea ???
 
 Please help me out..
 
 Thanks in advance 
 
 Binay
 


Rory McKinley
Nebula Solutions
+27 82 857 2391
[EMAIL PROTECTED]
There are 10 kinds of people in this world, 
those who understand binary and those who don't (Unknown)

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



Re: [PHP] Newbie question about Class

2003-10-17 Thread Rory McKinley
Hi Al

Sessions and objects are quite easy to use in the latest version of PHP, and
would be my personal recommendation. I have a coupleof test scripts that I
regularly
mangle when trying to see if something is doable...if you like, you can
contact me offlist and I will mail these to you and you can try it out for
yourself.

Regards

Rory McKinley
Nebula Solutions
+27 82 857 2391
[EMAIL PROTECTED]
There are 10 kinds of people in this world,
those who understand binary and those who don't (Unknown)
- Original Message - 
From: Al [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, October 15, 2003 8:15 PM
Subject: Re: [PHP] Newbie question about Class


 I was afraid that was the case.

 Tom Rogers wrote:

 Hi,
 
 Thursday, October 16, 2003, 3:35:56 AM, you wrote:
 A My question seems fundamental.  I want to set a variable in one
function
 A in a class and then want to use the value in a second function.
 A However, the functions are called a html page with two passes.  Submit
 A reloads the page and an if(...) calls the second function in the
class.
 
 A If I declare on the first run:
 A $get_data = new edit_tag_file();
 A $edit_args= $get_data- edit_prep();
 
 A The on the second pass, I'm stuck.  I can't declare a new instance of
 A edit_tag_data.
 A And, it appears the object is gone after I leave the page.
 
 A Will the class structure do this for me or must I save the values in
 A $GLOBAL or something?
 
 A Thanks
 
 
 You need to pass the values to the next page or save them in a session
 
 
 

 -- 
 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] How do you keep browser from timing out during lengthy process

2003-10-16 Thread Rory McKinley
James

Courtesy of a site called Freshwater Software:

To change the timeout value that Internet Explorer uses:

1. Start the Registry Editor
2. Go to HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion
\ InternetSettings
3. Select New  DWORD from the Edit menu
4. Call it ReceiveTimeout with a data value of SECONDS*1000
5. Restart your computer

For example, if you want the timeout to be 5 minutes, set the ReceiveTimeout
data value to 30 (300 * 1000)


Rory McKinley
Nebula Solutions
+27 82 857 2391
[EMAIL PROTECTED]
There are 10 kinds of people in this world,
those who understand binary and those who don't (Unknown)
- Original Message - 
From: James E Hicks III [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, October 16, 2003 5:48 PM
Subject: [PHP] How do you keep browser from timing out during lengthy
process


 I have a program that when an operator clicks on a button initiates an ftp
 transfer of a large file. The program also checks for succesful completion
of
 the transfer and advises the operator of the transfer status. How do I
keep
 the operators browser from timing out so that the status can be displayed
 upon transfer completion?

 James

 -- 
 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] Slow searches in large database

2003-10-14 Thread Rory McKinley
Hi Adrian

Somewhere in the back of my mind..I remember reading that if you are using
LIKE putting in wildcards for and aft e.g %string% slows down queries
somewhat
I will have a look at my mySQL stuff and see if I can confirm...but if I
recall correctly, is there any way you can do away with one of the
wildcards?

Rory McKinley
Nebula Solutions
+27 82 857 2391
[EMAIL PROTECTED]
There are 10 kinds of people in this world,
those who understand binary and those who don't (Unknown)
- Original Message - 
From: Adrian Teasdale [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, October 14, 2003 12:54 AM
Subject: [PHP] Slow searches in large database


 Hi there

 Wondering if someone could help or give some advice.

 We have a mysql database that has approximately 20,000 records and has a
 total size of 125mb  There are approximately 25 fields that we need to
 search each time that someone performs a search.  We have installed
 TurckMMCache onto the server which speeded up the searching, but it
 still takes around 15 seconds for the results to be displayed.

 An example of one of our search strings is:

 select docs.* from docs where 1 and CY IN ('GB')  and (TI like
 '%searchstring%' or PD like '%searchstring%' or ND like '%searchstring%'
 or DR like '%searchstring%' or DS like '%searchstring%' or DD like
 '%searchstring%' or DT like '%searchstring%' or RN like '%searchstring%'
 or HD like '%searchstring%' or TD like '%searchstring%' or NC like
 '%searchstring%' or PR like '%searchstring%' or RP like '%searchstring%'
 or AA like '%searchstring%' or TY like '%searchstring%' or AC like
 '%searchstring%' or PC like '%searchstring%' or RC like '%searchstring%'
 or RG like '%searchstring%' or AU like '%searchstring%' or TW like
 '%searchstring%' or CO like '%searchstring%' or AB like '%searchstring%'
 or TX like '%searchstring%')

 Basically, is there anything that anyone can immediately suggest that we
 need to do to speed things up?

 Thanks

 Ade

 -- 
 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] Search for an exact string inside of another string

2003-10-13 Thread Rory McKinley
Hi

What you are looking for is a regular expression function, I would suggest
the following:

if(ereg($str1, $str2) == 1)
{
/*Found Bob in string*/
}
else
{
/*didn't find Bob
}


Rory McKinley
Nebula Solutions
+27 82 857 2391
[EMAIL PROTECTED]
There are 10 kinds of people in this world,
those who understand binary and those who don't (Unknown)
- Original Message - 
From: PHP Webmaster [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, October 12, 2003 2:11 AM
Subject: [PHP] Search for an exact string inside of another string


 Hi all,

 I have a little problem that I hope you can help me with.

 I have the following strings:

 $str1 = Bob;
 $str2 = My Name Is Bob;

 How can I get PHP to look for $str1 inside of $str2?

 Also, what about if Bob inside of $str2 is in different places?

 I would like something like:

 if ($str1 IS INSIDE OF $str2) {
 echo str1 is inside of str2;
 }
 else {
 echo could not find str1 inside of str2;
 }

 Any ideas appreciated.

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