php-general Digest 22 Apr 2005 12:57:40 -0000 Issue 3412
Topics (messages 213618 through 213642):
Re: 1 web site, 3 servers, 3 countries - best practises?
213618 by: Drewcore
213622 by: Leon Poon
213623 by: Jochem Maas
213624 by: Mark Rees
213639 by: Richard Davey
213640 by: Richard Davey
Re: Can I use $_REQUEST for file uploads?
213619 by: Prathaban Mookiah
213628 by: Richard Lynch
Re: Is it possible to save a file with UTF-8 encoding and no BOM using PHP?
213620 by: Richard Lynch
213621 by: Richard Lynch
Re: Count totals (might be 0T)
213625 by: Richard Lynch
Re: PEAR Packages
213626 by: Richard Lynch
Re: I need do paging in php, I use ODBC Access
213627 by: Richard Lynch
213629 by: Richard Lynch
213638 by: Jochem Maas
Re: reverse MD5 ???
213630 by: Richard Lynch
213635 by: Ryan A
213636 by: trlists.clayst.com
213637 by: trlists.clayst.com
213641 by: Dan Rossi
Re: view zip file contents
213631 by: Richard Lynch
Re: Need urgent help on post php long code
213632 by: Richard Lynch
Re: Replacement Question.
213633 by: Richard Lynch
Re: Sorting table columns dynamically on normalized MySQL tables
213634 by: Richard Lynch
Easy question about XML parsing
213642 by: Brian Dunning
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 ---
well, i guess it all depends...
are you talking about having one server in south america that acts as
your database server, one server in asia that's your web server, and
then another server in north america that servers some other task?
or are you talking about having a localized database, http, etc,
server for each location (read: continent/country)?
the first is easy... it'll all just mesh... the second is more difficult.
drew
--
dc .. drewcore.com
--- End Message ---
--- Begin Message ---
I think he wants mirror, sort of...
I will do this if I were you:
Select the server wif the most bandwidth. Call this the master.
The other 2 are slaves.
To sync files:
==============
Enable network file system server on the 2 slaves. Export the htdocs
directories.
Setup the master to mount the exports.
Setup file monitoring tools (maybe fam?) on the master to copy new files to
the mounted slave directories when alteration of files in htdocs is
detected.
DO NOT instead mount exports of the master's htdocs on the slaves otherwise
the slaves will be very slow in serving out files.
Of course, you have to enable security - things like IP
restriction/encryption on the NFS.
To sync database:
=================
Use database slaving tools?
If you are using MySQL, see
http://mysql.hjc.edu.sg/doc/mysql/en/replication-intro.html. All updates
from ANY server must be done at the master though.
Or you can just host the SQL server at the master. All queries goes to the
master.
Hope this helps!
-Leon
----- Original Message -----
From: "Drewcore" <[EMAIL PROTECTED]>
To: "php" <[email protected]>
Sent: Friday, April 22, 2005 11:45 AM
Subject: Re: [PHP] Re: 1 web site, 3 servers, 3 countries - best practises?
well, i guess it all depends...
are you talking about having one server in south america that acts as
your database server, one server in asia that's your web server, and
then another server in north america that servers some other task?
or are you talking about having a localized database, http, etc,
server for each location (read: continent/country)?
the first is easy... it'll all just mesh... the second is more difficult.
drew
--
dc .. drewcore.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Richard Davey wrote:
Hello Satyam,
Thursday, April 21, 2005, 5:07:52 PM, you wrote:
S> My domain, satyam.com.ar, though supposedly in Argentina resides in Spain,
S> where I currently live hundreds of kilometers away from it, which I mention
S> to point out that domain names do not correlate to physical locations.
S> Unless there is a political issue regarding who owns the actual machine and
S> budgeting problems, I would rather keep just one server farm fed from
S> multiple international locations.
No offense, but that entire post was completely useless with regards
to my original message.
in a round about way he seems to be asking 'why'? which is not totally
invalid.
This is nothing to do with domain names, I was simply asking if anyone
had experience of handling one site spread across multiple remote
located servers from a PHP/SQL perspective (syncing content, user
accounts, etc).
I don't have any answers, but maybe some questions might be useful:
do you want/need a master/slave configuration
or true decentralisation and/or two way syncing?
what definition of 'seamless' have you been given?
what kind of content?
sounds like a costly undertaking, not to be taken lightly...
I'm interested to understand the requirement that dictates
such server redundancy. Given the implied cost,
planning/implementation should probably left to a company
who already knows the answers to your questions :-/?
anyway interesting problem you have before you!
Best regards,
Richard Davey
--- End Message ---
--- Begin Message ---
Be very careful with timezones. If you have dedicated servers with full
control over each one, you can simplify this by setting them all to the
same timezone. If not, you have a lot of work to do.
Mark
-----Original Message-----
From: Jochem Maas [mailto:[EMAIL PROTECTED]
Sent: 22 April 2005 08:13
To: Richard Davey
Cc: [email protected]
Subject: Re: [PHP] Re: 1 web site, 3 servers, 3 countries - best
practises?
Richard Davey wrote:
> Hello Satyam,
>
> Thursday, April 21, 2005, 5:07:52 PM, you wrote:
>
> S> My domain, satyam.com.ar, though supposedly in Argentina resides in
> S> Spain, where I currently live hundreds of kilometers away from it,
> S> which I mention to point out that domain names do not correlate to
> S> physical locations. Unless there is a political issue regarding who
> S> owns the actual machine and budgeting problems, I would rather keep
> S> just one server farm fed from multiple international locations.
>
> No offense, but that entire post was completely useless with regards
> to my original message.
in a round about way he seems to be asking 'why'? which is not totally
invalid.
>
> This is nothing to do with domain names, I was simply asking if anyone
> had experience of handling one site spread across multiple remote
> located servers from a PHP/SQL perspective (syncing content, user
> accounts, etc).
I don't have any answers, but maybe some questions might be useful:
do you want/need a master/slave configuration
or true decentralisation and/or two way syncing?
what definition of 'seamless' have you been given?
what kind of content?
sounds like a costly undertaking, not to be taken lightly... I'm
interested to understand the requirement that dictates such server
redundancy. Given the implied cost, planning/implementation should
probably left to a company who already knows the answers to your
questions :-/?
anyway interesting problem you have before you!
>
> Best regards,
>
> Richard Davey
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link,
Cisco, Sun Microsystems, 3Com
GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001
2000' REGISTERED COMPANY
**********************************************************************
CONFIDENTIALITY NOTICE:
This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.
GENERAL STATEMENT:
Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order, subject to our Terms and Conditions available from
http://www.gammaglobal.com
E&OE
**********************************************************************
**********************************************************************
--- End Message ---
--- Begin Message ---
Hello Drewcore / Jochem,
Friday, April 22, 2005, 4:45:37 AM, you wrote:
D> are you talking about having one server in south america that acts
D> as your database server, one server in asia that's your web server,
D> and then another server in north america that servers some other
D> task?
Not really - the scenario is more like this:
There is a primary set of servers in the US (one web, one DB, one file
server) - this handles all the "master" content (in English) as well
as the user logins, shop, etc. Content is translated to several
languages which the user can pick from, the site handles this just
fine. This all exists now.
But a vast majority of our customers live in Europe, and smaller but
no less significant sets in Russia and Japan, so duplicating this
content across a set of servers physically located there would be
extremely beneficial for them (speed-wise) where they don't all live
on the end of ADSL/cable connections.
The question originally was the best way to ensure these slaves
provide the exact same content as the master does.
For example one approach could be to sync the content on a file level,
perhaps another is that when the master CMS is updated these changes
are then propagated to the slaves in sequence (i.e. something done
from the PHP code itself rather than on a system level). It's really a
form of load balancing I guess, but application design for this kind
of environment is inherently different to the "all sits on one box"
that most people only have to deal with.
Further digging around has revealed this book on the subject:
"Multi-Tier Application Planning with Php: Practical Guide for Programmers"
(which I've ordered). I also found slides by Theo Schlossnagle from his
Scalable Internet Architecture talk at ApacheCon this year. Both these
things are addressing the design issues I'm now faced with, I'm just
extremely surprised no-one here has encountered them before.
Best regards,
Richard Davey
--
http://www.launchcode.co.uk - PHP Development Services
"I do not fear computers. I fear the lack of them." - Isaac Asimov
--- End Message ---
--- Begin Message ---
Hello Jochem,
Friday, April 22, 2005, 8:13:15 AM, you wrote:
JM> in a round about way he seems to be asking 'why'? which is not
JM> totally invalid.
To be honest when I ask people "why?" I actually use that word (or at
least something closely related to it).
JM> do you want/need a master/slave configuration
JM> or true decentralisation and/or two way syncing?
See my reply to Drewcore for far more detail which answers the above.
JM> sounds like a costly undertaking, not to be taken lightly... I'm
JM> interested to understand the requirement that dictates such server
JM> redundancy. Given the implied cost, planning/implementation should
JM> probably left to a company who already knows the answers to your
JM> questions :-/?
This isn't about redundancy, it's about enhancing the experience for
customers physically located thousands of miles away from the server
they are trying to access. So, bring the content closer to them and
drop their wait times massively. It's easy for those of us sat on the
end of cable connections to become complacent about this IMHO (i.e.
"the Internet is fast enough now that you don't need to do this"), but
in reality that's not really yet the case.
Best regards,
Richard Davey
--
http://www.launchcode.co.uk - PHP Development Services
"I do not fear computers. I fear the lack of them." - Isaac Asimov
--- End Message ---
--- Begin Message ---
$_REQUEST should work fine with 4.3.10 IF $_FILES does not have any problems
since both depend more or less on the same php.ini directives. Take a look at
http://www.php.net/manual/en/reserved.variables.php#reserved.variables.files
Cheers,
Prathap
---------- Original Message -----------
From: Srinadh Sannidhanam <[EMAIL PROTECTED]>
To:
Sent: Fri, 22 Apr 2005 01:18:19 +0530
Subject: [PHP] Can I use $_REQUEST for file uploads?
> Hi
> When I use $_REQUEST for accessing files uploaded, it is working
> fine in PHP PHP 4.3.10.
> But it is not working in PHP 4.3.4.
> $_FILES working in both the versions. Can I use $_REQUEST in PHP
> 4.3.10 also? Do I need to change any configuration in php.ini?
> server is Apache/2.0.49
> Please help me in this regard.
>
> Thanks,
> S.Srinadh.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
------- End of Original Message -------
--- End Message ---
--- Begin Message ---
On Thu, April 21, 2005 12:48 pm, Srinadh Sannidhanam said:
> Hi
> When I use $_REQUEST for accessing files uploaded, it is working
> fine in PHP PHP 4.3.10.
> But it is not working in PHP 4.3.4.
> $_FILES working in both the versions. Can I use $_REQUEST in PHP
> 4.3.10 also? Do I need to change any configuration in php.ini?
> server is Apache/2.0.49
> Please help me in this regard.
When $_REQUEST doesn't seem to work with file uploads, it almost always,
in my experience, means I forgot the ENCTYPE="multipart/form-data" on the
FORM tag.
D'oh!
I did that several times, over the years, before it became a habit to type
it for file uploads.
YMMV
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
On Thu, April 21, 2005 5:07 pm, Jon M. said:
> I am trying to have a file that I generated with PHP saved as UTF-8
> without
> the BOM (Byte Order Mark). Does PHP do anything like this? I am a beginner
> with PHP, but very technically experienced otherwise. I'm talking about
> the
> FILE encoding here -just to be clear.
>
> e.g. fopen("what_ever_file", "a+") now I want PHP save the file itself
> with
> UTF-8, NOT system default.
>
> I have searched for hours to find an answer, but have not found any info
> on
> the subject.
>
> Does PHP have any ability to create a text file saved in UTF-8 encoding???
Maybe I'm just being dumb, but I think if you UTF-8 encode your data, and
http://php.net/fwrite it, you're gonna get what you want...
Dunno about the Byte-Order-Mark part, but I guess you could strip it out
of the UTF-8 encoded data before writing, if you wanted to.
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
On Thu, April 21, 2005 5:07 pm, Jon M. said:
> I am trying to have a file that I generated with PHP saved as UTF-8
> without
> the BOM (Byte Order Mark). Does PHP do anything like this? I am a beginner
> with PHP, but very technically experienced otherwise. I'm talking about
> the
> FILE encoding here -just to be clear.
>
> e.g. fopen("what_ever_file", "a+") now I want PHP save the file itself
> with
> UTF-8, NOT system default.
>
> I have searched for hours to find an answer, but have not found any info
> on
> the subject.
>
> Does PHP have any ability to create a text file saved in UTF-8 encoding???
Maybe I'm just being dumb, but I think if you UTF-8 encode your data, and
http://php.net/fwrite it, you're gonna get what you want...
Dunno about the Byte-Order-Mark part, but I guess you could strip it out
of the UTF-8 encoded data before writing, if you wanted to.
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
On Thu, April 21, 2005 3:36 pm, Ryan A said:
> Hey,
> Thanks for replying.
> That means I will have to run a query per category....which I would like
> to
> avoid if possible as they could be
> a high amount of categories as they are user created and not defined by
> us.
<?php
/*
category_count.inc
Provides $CATEGORY_COUNT and $CATEGORY_SIZE variables for the application.
*/
$query = "select cno, count(*), sum(pic_size_kb) from <TABLE> group by
cno";
$cat_info = mysql_query($query) or die(mysql_error());
$CATEGORY_COUNT = array();
$CATEGORY_SIZE = array();
while (list($cno, $count, $size) = mysql_fetch_row($cat_info)){
$CATEGORY_COUNT[$cno] = $count;
$CATEGORY_SIZE[$cno] = $size;
}
?>
Only problem is that you could have a slight "timing" issue where the
select above gets done, then somebody adds a new image, and then you
display your counts, and then you display the list, and that extra image
is in the list, but not counted.
You *COULD* solve this by wrapping a transaction around the whole mess if
it's really critical, but you probably don't need it.
> Thanks,
> Ryan
>
>
> On 4/22/2005 12:08:31 AM, Drewcore ([EMAIL PROTECTED]) wrote:
>> run another sql query:
>> "select pic_size_kb from <table> where
>> pic_category='$current_category",
>> then make a loop that increments a)
>>
>> the total number of records (ie total number of pics in category), and
>>
>> then adds the pic size from each record to some variable (eg
>>
>> $total_kb) and then you have your total.
>>
>>
>>
>> hope that helps.
>>
>>
>>
>> drew
>>
>>
>>
>> On 4/21/05, Ryan A <[EMAIL PROTECTED]> wrote:
>>
>> > Hi again,
>>
>> > Am faced with a new problem (either that or working straight 10 hours
>> is
>>
>> > catching up!)
>>
>> >
>>
>> > Heres my table (easy to figure out so i wont waste your time
>> explaining
>> the
>>
>> > fields):
>>
>> > cno,
>>
>> > date_added,
>>
>> > pic_name,
>>
>> > pic_size_kb,
>>
>> > pic_desc_text,
>>
>> > pic_category
>>
>> >
>>
>> > the way i am displaying the data is like this (thanks to Phillip and
>> Andy
>>
>> > from this list)
>>
>> >
>>
>> > __________________________________
>>
>> > category here
>
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.10.1 - Release Date: 4/20/2005
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
On Thu, April 21, 2005 2:08 pm, Jason Barnett said:
> Correction: so I browsed the site a bit and maybe GTK2 is ready to go
> after all. But I haven't used it at all so YMMV.
I think it's in early alpha.
Which is not quite ready to go, really, but a decade seems very pessimistic.
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
On Thu, April 21, 2005 2:02 pm, chris said:
> You are right about MSSQL not having a limit, but here is an article that
> shows a work around....
> http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=850&lngWId=5
Just use a cursor.
It's not that tricky.
Honest.
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
On Thu, April 21, 2005 12:23 pm, Warren Vail said:
> The only approach left that I could come up with is to transfer the
> entire sequence set to your application, and count the rows, perhaps
> only displaying the rows you want to show. This is obviously not very
> efficient (in fact, with enough rows it may prove impossible because of
> memory limitations), but it will produce what appears to be a paged
> result.
If this is the best answer your database software will let you come up
with, it's time to switch databases :-)
Fortunately, the databases that don't do "LIMIT" have this nifty thing
called "CURSOR" which lets you kind of do the same thing.
At least, all the databases I know of.
Maybe something really stupid and broken like MS Access or something that
doesn't even claim to do SQL like, errrr, FileMaker???
Even there, I'll bet there's some better answer than pulling all the rows
down just to display a tiny fraction of them.
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
Richard Lynch wrote:
On Thu, April 21, 2005 12:23 pm, Warren Vail said:
The only approach left that I could come up with is to transfer the
entire sequence set to your application, and count the rows, perhaps
only displaying the rows you want to show. This is obviously not very
efficient (in fact, with enough rows it may prove impossible because of
memory limitations), but it will produce what appears to be a paged
result.
If this is the best answer your database software will let you come up
with, it's time to switch databases :-)
Fortunately, the databases that don't do "LIMIT" have this nifty thing
I was under the impression that LIMIT was mySQL specific (although its
quite likely that their use of the keyword and the ubiqitous nature of mySQL
that other vendors have also adopted it.
anyway, many other DBs do implement an alternative in the form of FIRST, SKIP
keywords which effectively does the same as the LIMIT clause. (AFAICR
FIRST/SKIP is part of the SQL std)
called "CURSOR" which lets you kind of do the same thing.
At least, all the databases I know of.
Maybe something really stupid and broken like MS Access or something that
doesn't even claim to do SQL like, errrr, FileMaker???
Even there, I'll bet there's some better answer than pulling all the rows
down just to display a tiny fraction of them.
--- End Message ---
--- Begin Message ---
On Thu, April 21, 2005 10:28 am, Ryan A said:
> Interesting reading, even though most of it went over my head :-)
> There ar'nt any tools freely available to the average joe to decypher a
> md5
> hash though...right?
No, there aren't.
And even the collisions found don't really mean much in the grand scheme
of things, from what I've read.
The worst-case scenario is that in a few years' time, more likely in MANY
years' time, somebody will figure out a way to use hardware not yet
available to crack MD5... Even that is more likely to be "crack one out
of every 2 billion MD5 values" rather than crack any old MD5 they run
across.
I really wouldn't sweat this in terms of your day-to-day life/programming,
other than to keep your code modular enough to replace "md5" with
something else in the year 2020 or whatever.
>> MD5 collisions were found last year:
>> http://cryptography.hyperlink.cz/md5/MD5_collisions.pdf
>>
>> Just a matter of time/cpu power.
Maybe I'm mis-remembering the article and its implications, but I don't
think they can apply that to an arbitrary MD5 hash and reverse it to the
plain-text original...
It's more like a theoretical "hole" that may some day prove to be the
first step in a long long long process of understanding something that
might maybe some day yield a way to de-crypt MD5.
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
Hey,
> I really
> wouldn't sweat this in terms of your day-to-day life/programming,
> other than to keep your code modular enough to replace "md5" with
> something else in the year 2020 or whatever.
Thats fine by me, by 2020 the spaceship would have landed and I will be
declared
sub ruler of planet earth before being taken to planet #Xgdwgd to rule...
BTW, I'm
recruiting sub-sub rulers for earth if anybodys intrested.... requirments
are: must be
able to PHP program using MySql as the DB...no oracle high class sh*t.
Cheers,
Ryan
P.S Just got up...feeling funny.
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.10.1 - Release Date: 4/20/2005
--- End Message ---
--- Begin Message ---
On 21 Apr 2005 M Saleh EG wrote:
> It's simple.
> If your system supports it performance wise.....
> Grab the id and compare it against the md5 version of the id saved in the
> cookie.
Actually I think the discussion was about reversing the MD5 to get back
the original message -- not about cookies or IDs. What you are
discussing is a different issue.
--
Tom
--- End Message ---
--- Begin Message ---
On 21 Apr 2005 Greg Donald wrote:
> > Same thing with MD5, it
> > is just one way, it can't be reversed.
>
> MD5 collisions were found last year:
> http://cryptography.hyperlink.cz/md5/MD5_collisions.pdf
>
> Just a matter of time/cpu power.
I don't think that's right. Collisions allow certain kinds of
cryptographic attacks against things like MD5-based signatures but that
is not at all the same as being able to simply determine the original
message content from the digest. Rather, they allow you to substitute
the original message with a different one which generates the same MD5
hash. This may or may not be useful as an attack, depending on how MD5
is being used.
--
Tom
--- End Message ---
--- Begin Message ---
I don't think that's right. Collisions allow certain kinds of
cryptographic attacks against things like MD5-based signatures but that
is not at all the same as being able to simply determine the original
message content from the digest. Rather, they allow you to substitute
the original message with a different one which generates the same MD5
hash. This may or may not be useful as an attack, depending on how MD5
is being used.
Anyone ever tried using ENCODE and DECODE functions in mysql ?
--- End Message ---
--- Begin Message ---
On Thu, April 21, 2005 7:33 am, Sebastian said:
> does anyone know of a way to view the contents of a zip file and its
> directory structure?
> i know there are zip file functions in php but they require extra libs i
> would rather not load right now.
>
> i know its possible, at least by looking at this download manager that
> does
> this: http://phpatm.free.fr/
>
> i tried looking at the source code but its messy. nice app, but awful
> coding
> practice.
> anyway, if anyone knows a method to do this, please let me know.
http://php.net/exec
Not nearly as efficient as adding gzlib to your PHP, but maybe you only
need to do it occasionally...
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
On Thu, April 21, 2005 12:55 am, Pieter du Toit said:
> I have the following code:
> $result = mysql_query("SELECT users.user_first_name, users.user_last_name,
> users.user_cell, users.user_idnom, users.user_email, users.user_adres1,
> users.user_adres2, users.user_pcode, users.user_city, users.user_prov FROM
> users WHERE users.user_id = '$user_id'");
>
> extract($row);
>
> $ewal_result = mysql_query("SELECT DECODE(ewallet.ewal_pass,
> '{$config["password_password"]}') AS ewal_pass FROM ewallet WHERE
> ewallet.user_id = '$user_id'");
>
> extract($row);
>
> dprint($row);
>
> $Co_ID = $config["e_wallet"]["Co_ID"];
>
> $Outlet = $config["e_wallet"]["Outlet"];
>
> $transac = get_nextid($_SESSION["database"], "transacs", "tran_id",
> "tran");
>
> !!!!! this is where i echo all my required vars to post, and i get a value
> for each, but when i post to the next form only $co_id and $outlet is
> posted
> !!!!!!
POST variables come from the HTTP interaction.
HTTP is stateless -- Nothing from one POST will get carried over to the
next unless *YOU* do something to make that happen.
You can pass them as HIDDEN INPUT, you can put them in your SESSION, you
can hire/train a squirrel to read them and repeat them, but they ain't
gonna get carried over unles YOU do it.
Neither $co_id nor $Outlet is POSTed. You assign them in your script, so
of course they have values.
>
> echo "Admin testing<br>";
>
> echo "coid = ".$Co_ID;
>
> echo "Outlet = ".$Outlet;
>
> echo "user_email = ".$user_email;
>
> echo "ewal_pass = ".$ewal_pass;
>
> echo "user_id = ".$user_id.$transac;
>
> echo <<< END
These other variables would work *ONLY* if you manage to transmit $user_id
(used in the queries above) from page to page.
> <input type="hidden" name="Co_ID" value="$Co_ID">
>
> <input type="hidden" name="Outlet" value="$Outlet">
>
> <input type="hidden" name="UserName" value="$user_email">
>
> <input type="hidden" name="Password" value="$ewal_pass">
>
> <input type="hidden" name="Reference" value="$user_id:$transac">
>
> <input type="hidden" name="Lang" value="ENG">
Here you are passing two variables you're going to ignore anyway ($Co_ID
and $Outlet) and *NOT* passing $user_id you need in your queris, and,
well, I don't really know what you are trying to do with the other four
variables, but you've given me a headache. :-)
Sit down with a pencil and figure out exactly what data you need to
transmit from page to page, and what you can just lookup again, and where
the data will come from.
I say again: POST data will not propogate itself. You MUST
store/propogate it in $_SESSION or as more hidden INPUT or propogate at
least the $user_id so you can look up their info again.
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
On Wed, April 20, 2005 7:22 am, Bob Palma said:
> I have a database field that I need to read and do some conversion on.
> Here is what the raw data from the database looks like:
>
> --
> 1084751309jpenaDisney Vignette Fleximon disk utilization
> alert C:\ at 85%1084799703bpalmafixed.1084799713bpalmaclosed
> --
>
> After conversion, it should look like this:
>
> --
> 5/16/2004 7:48:29 PM jpena
> Disney Vignette Fleximon disk utilization alert C:\ at 85%
>
> 5/17/2004 9:15:03 AM bpalma
> fixed.
>
> 5/17/2004 9:15:13 AM bpalma
> closed
> --
>
>
> I have tried to use eregi_replace to convert the timestamps to DateTime,
> but I end up with all three timestamps being changed to the same time
> (5/16/2004 7:48:29 PM).
>
> Here is the quick, albeit ugly, code I've tried to come close
>
> --
> $worklogt3 = eregi_replace("","<br>", $worklogt1);
> $worklogt4 = eregi_replace("","<br><br>", $worklogt3);
> $worklog = eregi_replace("[0-9]{10,10}",date("m/j/y g:i
> a",$worklogt4),$worklogt4);
> --
>
> $worklogt1 is the value of the field from the database and the first two
> replacements are actually for different characters, even though they
> look the same.
>
> Can anyone help me with this? I've been beating myself up for almost
> three days over this.
Your problem is that you are passing in all of $worklogt4 to the date
function, and that *BEGINS* with the first date/time, and that's what PHP
uses.
You need to FIRST break up your single line into separeate lines, based on
the 10-digit time-stamps.
Something like:
$lines = split('[0-9]{10,10}', $worklogt4);
But then I'm not sure you get to keep the date/time -- I never use split
much, myself...
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
On Wed, April 20, 2005 5:53 am, Leif Gregory said:
> So joining on four tables isn't considered bad practice?
No, it's great practice.
The only thing to watch for is just how *BIG* will the number of tuples grow?
If you can multiply together the number of rows in all four tables and
come up with << 1,000,000 you're fine.
If not, you have to start thinking about how you can get just the ones you
want for each query, and do it in such a way the MySQL never has to cope
with 1,000,000 rows at once.
Actually MySQL is quite happy to do 1,000,000 rows -- It's your hardware
that won't like it. :-)
So it really depends on what's *IN* the data, rather than the actual
number of tables.
Be sure you always get your WHERE clauses right.
One rule of thumb:
Work your way through all tables being joined from left to right:
FROM table1, table2, table3, table4, ...
For each tableX, make sure that you are relating it back to a previous
table, with an INDEXED key field in your WHERE clause with AND between
them:
WHERE table1.indexA = table2.indexB
AND table2.indexC = table3.indexD
AND table3.indexE = table4.indexE
It doesn't matter on table3 if you have it tied to table2 (as above) or
table 1 -- So long as the fields are indexed, and you can trace back from
every tableX to table1 *somehow*
But you wouldn't want just *this*
WHERE table1.indexA = table2.indexB
AND table3.indexC = table4.indexD
You've got nothing to tie table3 and table4 back to table1, so every
single row in the 3/4 combination is going to be listed with every single
row with the 1/2 combination, in every possible permutation...
Try it with some very small (number of rows) tables just to see what happens!
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
I've been going through a number of easy XML parsing examples on the
web, and they all have one thing in common: the XML is in a file, which
they read in 4K chunks and parse.
My application will be retrieving the XML from a web service,
presumably like $xml = file_get_contents($url). I was assuming that I
could parse the XML in memory using that $xml variable, but since NONE
of the examples I've seen do this, I was wondering if it's a
requirement that the XML be in a local file, and needing to do the 4K
chunk thing.
- Brian
--- End Message ---