php-windows Digest 29 Sep 2003 16:00:56 -0000 Issue 1932
Topics (messages 21583 through 21607):
Re: Problem: URL Encoded Parameters
21583 by: Warren Vail
21584 by: The Hub
21585 by: The Hub
Re: Writing to a file
21586 by: Fabian Cenedese
Re: File Ext
21587 by: Svensson, B.A.T. (HKG)
21589 by: H Marc Bower
unsuscribe
21588 by: Vikas Pande
Array matching to build table
21590 by: Mike Quinn
unsubscribe
21591 by: Herzog, Hermann
21593 by: Herzog, Hermann
21594 by: Herzog, Hermann
21595 by: Herzog, Hermann
21596 by: Duane Lakoduk
21597 by: Svensson, B.A.T. (HKG)
Matching arrays to build tables
21592 by: Mike Quinn
21598 by: Svensson, B.A.T. (HKG)
21599 by: Mike Quinn
21600 by: Svensson, B.A.T. (HKG)
21601 by: Mike Quinn
21604 by: Svensson, B.A.T. (HKG)
SQL query problem
21602 by: George Pitcher
21603 by: Mike Quinn
Re: SQL query problem - SOLVED
21605 by: George Pitcher
Matching arrays to build tables (Solved)
21606 by: Mike Quinn
form vars missing...
21607 by: Jas
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 ---
probably one of the more annoying differences between windows and Unix/Linux
is that Unix recognizes the "\n" as end of line, windows requires "\r\n".
Warren Vail
[EMAIL PROTECTED]
-----Original Message-----
From: The Hub [mailto:[EMAIL PROTECTED]
Sent: Sunday, September 28, 2003 8:15 PM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] Problem: URL Encoded Parameters
I've found it very useful to put PHP parameters after the ? in URLs, and
then access it with it's name in the next page.
e.g.
file.php?param=true¶m2=hello
Then in file.php:
echo $param . "\n";
echo $param2 . "\n";
Here's my problem:
this seems to only work on Linux systems, because whenever I try it on a
Windows machine I get nothing. It's as if the URL just said file.php
How do I fix this?
- Patrick
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
That isn't it, the problem is I end up with "\n\n" instead of
"true\nhello\n"
"Warren Vail" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> probably one of the more annoying differences between windows and
Unix/Linux
> is that Unix recognizes the "\n" as end of line, windows requires "\r\n".
>
> Warren Vail
> [EMAIL PROTECTED]
>
>
> -----Original Message-----
> From: The Hub [mailto:[EMAIL PROTECTED]
> Sent: Sunday, September 28, 2003 8:15 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] Problem: URL Encoded Parameters
>
>
> I've found it very useful to put PHP parameters after the ? in URLs, and
> then access it with it's name in the next page.
> e.g.
> file.php?param=true¶m2=hello
>
> Then in file.php:
> echo $param . "\n";
> echo $param2 . "\n";
>
> Here's my problem:
> this seems to only work on Linux systems, because whenever I try it on a
> Windows machine I get nothing. It's as if the URL just said file.php
>
> How do I fix this?
>
>
> - Patrick
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Thank you to Allan Tan for the following.
echo $_GET["parem"];
echo $_GET["parem2"];
This worked.
"The Hub" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> That isn't it, the problem is I end up with "\n\n" instead of
> "true\nhello\n"
>
> "Warren Vail" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > probably one of the more annoying differences between windows and
> Unix/Linux
> > is that Unix recognizes the "\n" as end of line, windows requires
"\r\n".
> >
> > Warren Vail
> > [EMAIL PROTECTED]
> >
> >
> > -----Original Message-----
> > From: The Hub [mailto:[EMAIL PROTECTED]
> > Sent: Sunday, September 28, 2003 8:15 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP-WIN] Problem: URL Encoded Parameters
> >
> >
> > I've found it very useful to put PHP parameters after the ? in URLs, and
> > then access it with it's name in the next page.
> > e.g.
> > file.php?param=true¶m2=hello
> >
> > Then in file.php:
> > echo $param . "\n";
> > echo $param2 . "\n";
> >
> > Here's my problem:
> > this seems to only work on Linux systems, because whenever I try it on a
> > Windows machine I get nothing. It's as if the URL just said file.php
> >
> > How do I fix this?
> >
> >
> > - Patrick
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
>this doesn't work. It will still write the new line after the line (I matched).
>Everytime I read a line from a file, the $fd gets incremented, so when I say fwrite,
>$fd is already pointing to the next line in the file? Any suggestions as to working
>around this? I can't rewrite the entire file (design time controls on page, they
>wouldn't work if I did). As soon as I fix the Cascading Style Sheet line, I want to
>get out of the file.
Might not be fast, but it seems that if you can't go back then you have to
start over again. So in the first run read and count the lines and when you
found the one start reading again and then you know where to do it.
bye Fabi
--- End Message ---
--- Begin Message ---
> I can\ only assume that it does work ok with a linux-based
> webserver or it wouldn't be in there. In fact, if I put in is_file()
> instead of !is_dir, it returns nothing at all.
That code wont work on a unix based system since in many cases
files does not have an exstensions at all, like executables and
plain text files.
If a file extension is present it is in most case only two
characters long (.sh, .pl, .gz, .ps, etc).
The file name convention with 8 + 3 chars is an old artifact
remaining from DOS and Win3.x. The dot (not being the first
character) does not carry any special mening as in DOS for
windows. However if the dot is the first character of the
file name under Unix, it means that the file should be
"hidden", and this might casue a problem. Additional code
would be needed to handle special cases like this.
> checks to see if it's a directory or a file (theoretically...),
On a unix based system you might find special files like pipes,
links, block devices, and a lot of other "funny" files.
I don't know how your code will react on this type of files,
but one might like to test on special cases to find out.
>extension. Things it won't include that you might need: files with a
>4-character-or-more or a 2-character-or-less extension. It only grabs
>-character extensions. From here, though, I think you can modify it to
>o chatever it is you need done.
This is fairly easy solved by scanning for a
dot at the end of the file name and then cut
out that part.
Probaly strrpos() (note the dubble R's) will be
easiet to use here. A generic code to extract the
"tail" of a file name would then be:
$pos = strrpos($FileName, "."); // Find the last occurence of a dot
@FileExtension = "";
if (@pos) {
@FileExtension = substr($FileName, $pos);
}
----- Original Message -----
From: "Dean Hayes" <[EMAIL PROTECTED]>
> Hey,
>
> I need to be able to find out what the file ext is on all files within
the
> dir i am reading. I am searched the php manual and i can not find
anything
> that does this does anyone know of a way i can and print it out.
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
----- Original Message -----
From: "Svensson, B.A.T. (HKG)" <[EMAIL PROTECTED]>
> > I can\ only assume that it does work ok with a linux-based
> > webserver or it wouldn't be in there. In fact, if I put in is_file()
> > instead of !is_dir, it returns nothing at all.
>
> That code wont work on a unix based system since in many cases
> files does not have an exstensions at all, like executables and
> plain text files.
What I meant was the is_dir and is_file functions - they don't seem to
function at all on a windows box.
> If a file extension is present it is in most case only two
> characters long (.sh, .pl, .gz, .ps, etc).
I assumed - too much, perhaps - that the poster was using a windows machine
for this, given the content of his message.
> The file name convention with 8 + 3 chars is an old artifact
> remaining from DOS and Win3.x. The dot (not being the first
> character) does not carry any special mening as in DOS for
> windows. However if the dot is the first character of the
> file name under Unix, it means that the file should be
> "hidden", and this might casue a problem. Additional code
> would be needed to handle special cases like this.
I fully understand what the 8.3 naming convention is and where it comes
from... but despite it not being required anymore, it is still a very common
way of naming files (well, at least the .3 part).
> > checks to see if it's a directory or a file (theoretically...),
>
> On a unix based system you might find special files like pipes,
> links, block devices, and a lot of other "funny" files.
The is_dir function, obviously, will only grab regular directories
(according to the docs). is_file only grabs regular files. There is also
an is_link function. As for the others... your guess is as good as mine, as
I am not a unix/linux person. :)
> I don't know how your code will react on this type of files,
> but one might like to test on special cases to find out.
>
> >extension. Things it won't include that you might need: files with a
> >4-character-or-more or a 2-character-or-less extension. It only grabs
> >-character extensions. From here, though, I think you can modify it to
> >o chatever it is you need done.
>
> This is fairly easy solved by scanning for a
> dot at the end of the file name and then cut
> out that part.
>
> Probaly strrpos() (note the dubble R's) will be
> easiet to use here. A generic code to extract the
> "tail" of a file name would then be:
>
> $pos = strrpos($FileName, "."); // Find the last occurence of a dot
> @FileExtension = "";
> if (@pos) {
> @FileExtension = substr($FileName, $pos);
> }
I knew there had to be someone who knew a much better way than I'd put out
there, but I still figured I'd toss something out for the person who asked.
:) I certainly don't consider myself an "expert" (as, from previous posts
I've read from you indicate, you are) when it comes to php programming, but
I do like to try. Thanks for the improvement, B.A.T.
(V)
--- End Message ---
--- Begin Message ---
---------------------------------
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
--- End Message ---
--- Begin Message ---
Hi,
I have 3 dynamic arrays which is related data pulled from a mySQL database,
the first being day $days[],second being amount $amount[] and third being a
specific code $code[]. What I need to do is display a table with 1 to 15 in
the left hand column (days) but where the array $days[] contains an item I
need to add a column with the related data but add the values of amount if
there are two entries for a given day, something like the below.
$days[] = ('2', '2', '5');
$amount[] = ('150', '100', '90');
$code[] = ('LAC', 'LAC', 'NCA');
+++++++++++++++++++++
Day | Amount | Code |
1 | 0 | |
2 | 250 | LAC |
3 | 90 | NCA |
4 | 0 | |
etc. until 15!
Any help would be greatly appreciated my code is getting jumbled and
confusing :(.
Thanks
--- End Message ---
--- Begin Message ---
Hello,
please unsubscribe me from the PHP-WIN - mailinglist.
Thank you !
Hermann
--- End Message ---
--- Begin Message ---
Hello,
please unsubscribe me from the PHP-WIN - mailinglist.
Thank you !
Hermann
--- End Message ---
--- Begin Message ---
Hello,
please unsubscribe me from the PHP-WIN - mailinglist.
Thank you !
Hermann
--- End Message ---
--- Begin Message ---
Hello,
please unsubscribe me from the PHP-WIN - mailinglist.
Thank you !
Hermann
--- End Message ---
--- Begin Message ---
Herman,
Use the link at the bottom and unsubscribe yourself.
> please unsubscribe me from the PHP-WIN - mailinglist.
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
Hello,
please raise my sallary!
-----Original Message-----
From: Herzog, Hermann
To: [EMAIL PROTECTED]
Sent: 29-9-2003 12:30
Subject: [PHP-WIN] unsubscribe
Hello,
please unsubscribe me from the PHP-WIN - mailinglist.
Thank you !
Hermann
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hi,
I have 3 dynamic arrays which is related data pulled from a mySQL database,
the first being day $days[],second being amount $amount[] and third being a
specific code $code[]. What I need to do is display a table with 1 to 15 in
the left hand column (days) but where the array $days[] contains an item I
need to add a column with the related data but add the values of amount if
there are two entries for a given day, something like the below.
$days[] = ('2', '2', '5');
$amount[] = ('150', '100', '90');
$code[] = ('LAC', 'LAC', 'NCA');
+++++++++++++
Day |Amt. | Code |
1 | 0 | |
2 | 250 | LAC |
3 | 90 | NCA |
4 | 0 | |
etc. until 15!
Any help would be greatly appreciated my code is getting jumbled and
confusing :(.
Thanks
--- End Message ---
--- Begin Message ---
Would something like
SELECT day, SUM(amount) AS amount_sum, DISTINCT(code) AS code
FROM <some tables>
WHERE <some conditions are true>
GROUP BY day,amount _sum, Code
be usefull for you? Or do you already do this?
-----Original Message-----
From: Mike Quinn
To: [EMAIL PROTECTED]
Sent: 29-9-2003 6:30
Subject: [PHP-WIN] Matching arrays to build tables
Hi,
I have 3 dynamic arrays which is related data pulled from a mySQL
database,
the first being day $days[],second being amount $amount[] and third
being a
specific code $code[]. What I need to do is display a table with 1 to 15
in
the left hand column (days) but where the array $days[] contains an item
I
need to add a column with the related data but add the values of amount
if
there are two entries for a given day, something like the below.
$days[] = ('2', '2', '5');
$amount[] = ('150', '100', '90');
$code[] = ('LAC', 'LAC', 'NCA');
+++++++++++++
Day |Amt. | Code |
1 | 0 | |
2 | 250 | LAC |
3 | 90 | NCA |
4 | 0 | |
etc. until 15!
Any help would be greatly appreciated my code is getting jumbled and
confusing :(.
Thanks
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hi Svensson,
Thanks for that. (I can certainly use that to get the values for the added
amounts for me) but I wish for the table to be built with 15 days in the
left hand column some of which will not contain entries but for the days
that there are items I wish for the HTML table to display these beside the
correct date of entry. I have no quams with SQL but with arrays in PHP. I
guess what I have to do is loop from 1 to 15 using $i to display all of the
days in left column, then within the loop check the value $i to see if it is
equal to $days[] if it is then add the values for this day and pop it into a
column beside the day and then the code next to this. I have tried what I
believe to be the best way to do this but have failed miserably as I am crap
with array manipulation.
Thanks a mil for the SQL though,
Michael
"B.A.T. Svensson" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
> Would something like
>
> SELECT day, SUM(amount) AS amount_sum, DISTINCT(code) AS code
> FROM <some tables>
> WHERE <some conditions are true>
> GROUP BY day,amount _sum, Code
>
> be usefull for you? Or do you already do this?
>
> -----Original Message-----
> From: Mike Quinn
> To: [EMAIL PROTECTED]
> Sent: 29-9-2003 6:30
> Subject: [PHP-WIN] Matching arrays to build tables
>
> Hi,
>
> I have 3 dynamic arrays which is related data pulled from a mySQL
> database,
> the first being day $days[],second being amount $amount[] and third
> being a
> specific code $code[]. What I need to do is display a table with 1 to 15
> in
> the left hand column (days) but where the array $days[] contains an item
> I
> need to add a column with the related data but add the values of amount
> if
> there are two entries for a given day, something like the below.
>
> $days[] = ('2', '2', '5');
> $amount[] = ('150', '100', '90');
> $code[] = ('LAC', 'LAC', 'NCA');
>
> +++++++++++++
> Day |Amt. | Code |
> 1 | 0 | |
> 2 | 250 | LAC |
> 3 | 90 | NCA |
> 4 | 0 | |
>
> etc. until 15!
>
> Any help would be greatly appreciated my code is getting jumbled and
> confusing :(.
>
> Thanks
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Just a question for the purpose of giving a proper answer:
is it possible to have different codes on the very same day?
-----Original Message-----
From: Mike Quinn
To: [EMAIL PROTECTED]
Sent: 29-9-2003 7:11
Subject: Re: [PHP-WIN] Matching arrays to build tables
Hi Svensson,
Thanks for that. (I can certainly use that to get the values for the
added
amounts for me) but I wish for the table to be built with 15 days in the
left hand column some of which will not contain entries but for the days
that there are items I wish for the HTML table to display these beside
the
correct date of entry. I have no quams with SQL but with arrays in PHP.
I
guess what I have to do is loop from 1 to 15 using $i to display all of
the
days in left column, then within the loop check the value $i to see if
it is
equal to $days[] if it is then add the values for this day and pop it
into a
column beside the day and then the code next to this. I have tried what
I
believe to be the best way to do this but have failed miserably as I am
crap
with array manipulation.
Thanks a mil for the SQL though,
Michael
"B.A.T. Svensson" <[EMAIL PROTECTED]> escribio en el mensaje
news:[EMAIL PROTECTED]
> Would something like
>
> SELECT day, SUM(amount) AS amount_sum, DISTINCT(code) AS code
> FROM <some tables>
> WHERE <some conditions are true>
> GROUP BY day,amount _sum, Code
>
> be usefull for you? Or do you already do this?
>
> -----Original Message-----
> From: Mike Quinn
> To: [EMAIL PROTECTED]
> Sent: 29-9-2003 6:30
> Subject: [PHP-WIN] Matching arrays to build tables
>
> Hi,
>
> I have 3 dynamic arrays which is related data pulled from a mySQL
> database,
> the first being day $days[],second being amount $amount[] and third
> being a
> specific code $code[]. What I need to do is display a table with 1 to
15
> in
> the left hand column (days) but where the array $days[] contains an
item
> I
> need to add a column with the related data but add the values of
amount
> if
> there are two entries for a given day, something like the below.
>
> $days[] = ('2', '2', '5');
> $amount[] = ('150', '100', '90');
> $code[] = ('LAC', 'LAC', 'NCA');
>
> +++++++++++++
> Day |Amt. | Code |
> 1 | 0 | |
> 2 | 250 | LAC |
> 3 | 90 | NCA |
> 4 | 0 | |
>
> etc. until 15!
>
> Any help would be greatly appreciated my code is getting jumbled and
> confusing :(.
>
> Thanks
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Sorry,
very well spotted and I should have said so before - the codes will be the
same as they will be related to the same transaction.
Thnks,
Michael
"B.A.T. Svensson" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
> Just a question for the purpose of giving a proper answer:
> is it possible to have different codes on the very same day?
>
> -----Original Message-----
> From: Mike Quinn
> To: [EMAIL PROTECTED]
> Sent: 29-9-2003 7:11
> Subject: Re: [PHP-WIN] Matching arrays to build tables
>
> Hi Svensson,
>
> Thanks for that. (I can certainly use that to get the values for the
> added
> amounts for me) but I wish for the table to be built with 15 days in the
> left hand column some of which will not contain entries but for the days
> that there are items I wish for the HTML table to display these beside
> the
> correct date of entry. I have no quams with SQL but with arrays in PHP.
> I
> guess what I have to do is loop from 1 to 15 using $i to display all of
> the
> days in left column, then within the loop check the value $i to see if
> it is
> equal to $days[] if it is then add the values for this day and pop it
> into a
> column beside the day and then the code next to this. I have tried what
> I
> believe to be the best way to do this but have failed miserably as I am
> crap
> with array manipulation.
>
> Thanks a mil for the SQL though,
>
> Michael
>
>
> "B.A.T. Svensson" <[EMAIL PROTECTED]> escribio en el mensaje
> news:[EMAIL PROTECTED]
> > Would something like
> >
> > SELECT day, SUM(amount) AS amount_sum, DISTINCT(code) AS code
> > FROM <some tables>
> > WHERE <some conditions are true>
> > GROUP BY day,amount _sum, Code
> >
> > be usefull for you? Or do you already do this?
> >
> > -----Original Message-----
> > From: Mike Quinn
> > To: [EMAIL PROTECTED]
> > Sent: 29-9-2003 6:30
> > Subject: [PHP-WIN] Matching arrays to build tables
> >
> > Hi,
> >
> > I have 3 dynamic arrays which is related data pulled from a mySQL
> > database,
> > the first being day $days[],second being amount $amount[] and third
> > being a
> > specific code $code[]. What I need to do is display a table with 1 to
> 15
> > in
> > the left hand column (days) but where the array $days[] contains an
> item
> > I
> > need to add a column with the related data but add the values of
> amount
> > if
> > there are two entries for a given day, something like the below.
> >
> > $days[] = ('2', '2', '5');
> > $amount[] = ('150', '100', '90');
> > $code[] = ('LAC', 'LAC', 'NCA');
> >
> > +++++++++++++
> > Day |Amt. | Code |
> > 1 | 0 | |
> > 2 | 250 | LAC |
> > 3 | 90 | NCA |
> > 4 | 0 | |
> >
> > etc. until 15!
> >
> > Any help would be greatly appreciated my code is getting jumbled and
> > confusing :(.
> >
> > Thanks
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
I am not sure I understand your problem or what it consist
of, but maybe you might like to do it like this then:
SELECT day, SUM(amount) AS amount_sum, DISTINCT(code) AS code
FROM <some tables>
WHERE <some conditions are true>
GROUP BY day, amount_sum, code
ORDER BY code, day
Displaying this result set should not be much of
a problem. In pseudo code it might look like this:
WHILE (not_end_of_result_set) {
@Itter = 0;
WHILE (still_a_certain_code_type && @Itter < 15) {
@Itter++;
IF ($day_number == $Itter ) {
Display_Sum_and_Code_in_HTML_Table();
}
ELSE {
// Skips this block if you don't want to display "empty" days
Display_Empty_Day_in_HTML_Table();
}
} // WHILE inner
} // WHILE outter
Or you can just make this a function and call
it for each code type... or whatever....
-----Original Message-----
From: Mike Quinn
To: [EMAIL PROTECTED]
Sent: 29-9-2003 7:18
Subject: Re: [PHP-WIN] Matching arrays to build tables
Sorry,
very well spotted and I should have said so before - the codes will be
the
same as they will be related to the same transaction.
Thnks,
Michael
"B.A.T. Svensson" <[EMAIL PROTECTED]> escribio en el mensaje
news:[EMAIL PROTECTED]
> Just a question for the purpose of giving a proper answer:
> is it possible to have different codes on the very same day?
>
> -----Original Message-----
> From: Mike Quinn
> To: [EMAIL PROTECTED]
> Sent: 29-9-2003 7:11
> Subject: Re: [PHP-WIN] Matching arrays to build tables
>
> Hi Svensson,
>
> Thanks for that. (I can certainly use that to get the values for the
> added
> amounts for me) but I wish for the table to be built with 15 days in
the
> left hand column some of which will not contain entries but for the
days
> that there are items I wish for the HTML table to display these beside
> the
> correct date of entry. I have no quams with SQL but with arrays in
PHP.
> I
> guess what I have to do is loop from 1 to 15 using $i to display all
of
> the
> days in left column, then within the loop check the value $i to see if
> it is
> equal to $days[] if it is then add the values for this day and pop it
> into a
> column beside the day and then the code next to this. I have tried
what
> I
> believe to be the best way to do this but have failed miserably as I
am
> crap
> with array manipulation.
>
> Thanks a mil for the SQL though,
>
> Michael
>
>
> "B.A.T. Svensson" <[EMAIL PROTECTED]> escribio en el mensaje
> news:[EMAIL PROTECTED]
> > Would something like
> >
> > SELECT day, SUM(amount) AS amount_sum, DISTINCT(code) AS code
> > FROM <some tables>
> > WHERE <some conditions are true>
> > GROUP BY day,amount _sum, Code
> >
> > be usefull for you? Or do you already do this?
> >
> > -----Original Message-----
> > From: Mike Quinn
> > To: [EMAIL PROTECTED]
> > Sent: 29-9-2003 6:30
> > Subject: [PHP-WIN] Matching arrays to build tables
> >
> > Hi,
> >
> > I have 3 dynamic arrays which is related data pulled from a mySQL
> > database,
> > the first being day $days[],second being amount $amount[] and third
> > being a
> > specific code $code[]. What I need to do is display a table with 1
to
> 15
> > in
> > the left hand column (days) but where the array $days[] contains an
> item
> > I
> > need to add a column with the related data but add the values of
> amount
> > if
> > there are two entries for a given day, something like the below.
> >
> > $days[] = ('2', '2', '5');
> > $amount[] = ('150', '100', '90');
> > $code[] = ('LAC', 'LAC', 'NCA');
> >
> > +++++++++++++
> > Day |Amt. | Code |
> > 1 | 0 | |
> > 2 | 250 | LAC |
> > 3 | 90 | NCA |
> > 4 | 0 | |
> >
> > etc. until 15!
> >
> > Any help would be greatly appreciated my code is getting jumbled and
> > confusing :(.
> >
> > Thanks
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hi,
I'm having a problem with the following query (ODBC on M$ Access):
select Pack.*, Transacts.*, Extracts.* from Pack, Transacts, Extracts where
(
Pack.End > date() and Pack.Term='Lent' and Transacts.Week=1 and
Transacts.Pack_ID=Pack.Pack_ID and Extracts.ID=Transacts.Extract_ID)
ORDER BY Pack.Term DESC, Transacts.Week ASC, Pack.Course_ref ASC
I get a 'no records' return.
Any suggestions for re-jigging the query.
Cheers
George in Oxford
--- End Message ---
--- Begin Message ---
Hi George,
Just at a quick glance it might be to do with the Date(); Remove that
clause and see what happens. I could be wrong.
Rgds,
Michael
"George Pitcher" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
> Hi,
>
> I'm having a problem with the following query (ODBC on M$ Access):
>
> select Pack.*, Transacts.*, Extracts.* from Pack, Transacts, Extracts
where
> (
> Pack.End > date() and Pack.Term='Lent' and Transacts.Week=1 and
> Transacts.Pack_ID=Pack.Pack_ID and Extracts.ID=Transacts.Extract_ID)
> ORDER BY Pack.Term DESC, Transacts.Week ASC, Pack.Course_ref ASC
>
> I get a 'no records' return.
>
> Any suggestions for re-jigging the query.
>
> Cheers
>
> George in Oxford
--- End Message ---
--- Begin Message ---
The date format in my query works fine with Access.
I solved the problem by splitting the query into two separate queries and it
now works fine.
Cheers
George
> -----Original Message-----
> From: Disko_kex [mailto:[EMAIL PROTECTED]
> Sent: 29 September 2003 1:25 pm
> To: 'George Pitcher'
> Subject: RE: [PHP-WIN] SQL query problem
>
>
> Try this: Pack.End > "'.date("Y-m-d").'"
>
> be sure that you have the same dateformat
>
>
>
>
> Hi,
>
> I'm having a problem with the following query (ODBC on M$ Access):
>
> select Pack.*, Transacts.*, Extracts.* from Pack, Transacts, Extracts
> where
> (
> Pack.End > date() and Pack.Term='Lent' and Transacts.Week=1 and
> Transacts.Pack_ID=Pack.Pack_ID and Extracts.ID=Transacts.Extract_ID)
> ORDER BY Pack.Term DESC, Transacts.Week ASC, Pack.Course_ref ASC
>
> I get a 'no records' return.
>
> Any suggestions for re-jigging the query.
>
> Cheers
>
> George in Oxford
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
--- End Message ---
--- Begin Message ---
I got a very modest email from Bill Baron with the following code which
works absolutely perfectly even though Bill never tested it! (Slick!).
Thank's a million for that Bill and also thanks to Svensson for all the
help - very much appreciated. Here is the code which I modified ever so
slightly to work with an HTML table as opposed to the seperators I initially
asked for and Bill used. Hope it can be of use to others.
echo "<table border='1' cellpadding='0' cellspacing='1'>\n" .
"<tr>\n";
$i=0;
$dayscount=count($days);
while ($i < $dayscount) {
if (empty($outputdata[$days[$i]]['amount'])) {
$outputdata[$days[$i]]['amount']=0;
}
$outputdata[$days[$i]]['amount']+=$amount[$i];
$outputdata[$days[$i]]['code']=$code[$i];
++$i;
}
for ($i=0;$i<=15;$i++) {
echo "<td>" . $i . "</td><td bgcolor='silver'>";
if (!empty($outputdata[$i]['amount'])) {
echo $outputdata[$i]['amount'];
}
echo "</td>\n";
if (!empty($outputdata[$i]['code'])) {
echo $outputdata[$i]['code'];
}
echo "</tr>\n";
}
echo "</table>";
--- End Message ---
--- Begin Message ---
Here is my problem:
Using both the Get and Post methods my variables are missing on the
resulting page. Example of code is listed below:
<form method="post" url="result.php" name="form">
<input type="text" name="name"><br>
<input type="text" name="url"><br>
<input type="submit" value="send">
<?php
if ((!$name) || (!url)) {
do nothing;
} elseif (($name) || ($url)) {
do rest of code;
} else {
broken; }
Should be simple and every time I have done this in a *nix environment it
has worked but this time I have installed php on my IIS 5 server and check
the scripting permissions and everything looks ok, except my variables are
not being passed or recognized in the resulting script using post. Using
the Get method my variables are listed in the URL of resulting page but the
script isn't picking them up.
Anyone else have troubles with this?
Any help is appreciated,
Jas
--- End Message ---