php-general Digest 7 Aug 2004 16:41:24 -0000 Issue 2923
Topics (messages 193062 through 193088):
Re: Validating Dynamic Checkboxes
193062 by: Manuel Lemos
193063 by: Albert Padley
193064 by: Manuel Lemos
193066 by: Albert Padley
193067 by: Jason Paschal
Re: Voting PHP apps
193065 by: Manuel Lemos
Re: IMPORTANT: Please Verify Your Message
193068 by: Chris Martin
Re: is there a more efficient query?
193069 by: Mattias J�nsson
Re: Need Some Direction
193070 by: Torsten Roehr
Re: Session problems under heavy load???
193071 by: Torsten Roehr
193081 by: Jerry Kita
SQL Join query
193072 by: Mattias J�nsson
193077 by: Jason Wong
193082 by: raditha dissanayake
193086 by: Lenar L�hmus
193087 by: John Holmes
Problem with class and tree-like struct
193073 by: Martin Schneider
193074 by: Martin Schneider
193075 by: Lester Caine
Re: sorting an array..dont know numeric or alpha-numeric
193076 by: Kevin Waterson
safe_mode restriction
193078 by: Kevin
193088 by: Jason Wong
Re: parameter context in functions mkdir and rmdir
193079 by: Walace
193080 by: Walace
Holding links in a database
193083 by: Shaun
Re: Advise on parsing XML
193084 by: Jason Barnett
Re: new parameter(context) in functions rmdir(), mkdir()
193085 by: Walace
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
Hello,
On 08/07/2004 12:49 AM, Albert Padley wrote:
I have a php/mysql script that returns a series of records to populate a
form. The number of records returned varies from 1 to as many as 100. On
the display page, each record has a checkbox to indicate that the record
is being edited. This is checked on the results page to know which
records to update. The checkbox code is:
<input type=\"checkbox\" name=\"ed[{$row['id']}]\" value=\"Y\">
This part of the system has been working perfectly for weeks.
Now I've been asked to add client side validation to make sure at least
one of the records (checkboxes) has been checked before sending the data
to the results page. (The results page already has working validation
code in it.)
I've have the following javascript code that should work for my purposes
if I can figure out how to dynamically build the javascript code.
<SCRIPT>
function validate() {
if (!(mainform.ed[0].checked || mainform.ed[1].checked)) {
alert('Please check at least one record before submitting this form.');
event.returnValue=false;
}
}
</SCRIPT>
This is the line I need to build dynamically:
if (!(mainform.ed[0].checked || mainform.ed[1].checked)) {
It can't be done that way because the brackets have a different meaning
in Javascript syntax. You need to quote the whole name.
You may want to take a look at the example that comes with this forms
generation and validation class that supports the exact same type of
validation that you want:
http://www.phpclasses.org/formsgeneration
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--- End Message ---
--- Begin Message ---
On Aug 6, 2004, at 10:39 PM, Manuel Lemos wrote:
Hello,
On 08/07/2004 12:49 AM, Albert Padley wrote:
I have a php/mysql script that returns a series of records to
populate a form. The number of records returned varies from 1 to as
many as 100. On the display page, each record has a checkbox to
indicate that the record is being edited. This is checked on the
results page to know which records to update. The checkbox code is:
<input type=\"checkbox\" name=\"ed[{$row['id']}]\" value=\"Y\">
This part of the system has been working perfectly for weeks.
Now I've been asked to add client side validation to make sure at
least one of the records (checkboxes) has been checked before sending
the data to the results page. (The results page already has working
validation code in it.)
I've have the following javascript code that should work for my
purposes if I can figure out how to dynamically build the javascript
code.
<SCRIPT>
function validate() {
if (!(mainform.ed[0].checked || mainform.ed[1].checked)) {
alert('Please check at least one record before submitting this
form.');
event.returnValue=false;
}
}
</SCRIPT>
This is the line I need to build dynamically:
if (!(mainform.ed[0].checked || mainform.ed[1].checked)) {
It can't be done that way because the brackets have a different
meaning in Javascript syntax. You need to quote the whole name.
You may want to take a look at the example that comes with this forms
generation and validation class that supports the exact same type of
validation that you want:
http://www.phpclasses.org/formsgeneration
Hi Manuel,
I'm not certain I understand what you mean by "quote the whole name".
Also, there are a lot of files in the formsgeneration class. Which one
has the example you are referring to?
Thanks.
Albert Padley
--- End Message ---
--- Begin Message ---
Hello,
On 08/07/2004 01:44 AM, Albert Padley wrote:
It can't be done that way because the brackets have a different
meaning in Javascript syntax. You need to quote the whole name.
You may want to take a look at the example that comes with this forms
generation and validation class that supports the exact same type of
validation that you want:
http://www.phpclasses.org/formsgeneration
Hi Manuel,
I'm not certain I understand what you mean by "quote the whole name".
The name of the input needs to be quoted (and eventually escaped) and
used as an index string.
Also, there are a lot of files in the formsgeneration class. Which one
has the example you are referring to?
The main example ( test_form.php ) has an example of how to validate a
group of check boxes making sure that at least one is set. It will do it
either on the client side and server side, despite your problem is
mostly on the client side Javascript.
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--- End Message ---
--- Begin Message ---
Jason,
You lost me on this go around. I don't understand how we got from the
following function to your new verson:
//loop through records
$id = $row['id'];
$counter++;
if ($counter > 1) {
$jscondition .= " || document.getElementById('ed" . $id .
"').checked";
} else {
$jscondition .= "document.getElementById('ed" . $id .
"').checked";
}
}
?>
<SCRIPT language="JavaScript">
function validate() {
if (!(<?php print $jscondition; ?>)) {
alert('Please check at least one edit checkbox before submitting this
form.');
return false;
}
}
</SCRIPT>
Remember that the above works insofar as it throws up the javascript
alert, but then submits the form anyway. I don't see how your new
function incorporates the loop to build $jscondition.
Thanks for any further input. I think I need to get some sleep.
Albert Padley
On Aug 6, 2004, at 11:39 PM, Jason Paschal wrote:
make ur submit button a regular button with an onClick event trigger:
<input name="button" type="button" id="button" onClick='validate()'
value="Submit">
then make ur javascript submit the form if conditions are true.
otherwise it gives an alert:
<script language="JavaScript">
function validate() {
if (document.getElementById('ed2').checked) {
document.getElementById('myform').submit();
} else {
alert("check something.");
}
}
</script>
---------------------------------------
http://www.dailymedication.com - Everything you didn't know you
needed until you went there and said to yourself, "What did I do
before I visited DailyMedication.com?" and another part of you
answered, "It does not matter. You are here now."
From: Albert Padley <[EMAIL PROTECTED]>
To: "Jason Paschal" <[EMAIL PROTECTED]>
Subject: Re: [PHP] Validating Dynamic Checkboxes
Date: Fri, 6 Aug 2004 23:27:29 -0600
We are very close. I now get the javascript alert when I don't check
any of the checkboxes. However, as soon as I click the OK button in
the alert, the results page is returned.
Albert Padley
On Aug 6, 2004, at 10:55 PM, Jason Paschal wrote:
i read the other guy's bit. he may be referring to how you identify
the elements. and that could be related to the same validation
trouble you're still having.
i've had to do similar stuff, but it wasn't exactly the same.
however, i had to give a an id different from the name of the
element.
<input type='checkbox' name='ed[2]' id='ed2'>
and in ur javascript:
if ($counter > 1) {
$jscondition .= " || document.getElementById('ed" . $id .
"').checked";
} else {
$jscondition .= "document.getElementById('ed" . $id .
"').checked";
---------------------------------------
http://www.dailymedication.com - Everything you didn't know you
needed until you went there and said to yourself, "What did I do
before I visited DailyMedication.com?" and another part of you
answered, "It does not matter. You are here now."
From: Albert Padley <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Validating Dynamic Checkboxes
Date: Fri, 6 Aug 2004 22:36:10 -0600
Jason,
Thanks. That seems to build the javascript string, but
unfortunately the form doesn't validate. In other words, if I leave
all the checkboxes unchecked the results page still is returned.
Perhaps there is a problem with the javascript? Any ideas?
Albert Padley
On Aug 6, 2004, at 10:02 PM, Jason Paschal wrote:
here's an idea:
above the HTML, you could put something like this [i'm going to
use pseudo-code since i don't know how you set it up, but you may
have to do the same query twice]:
$counter = 0;
loop through records {
$id = $row['id'];
$counter++;
if ($counter > 1) {
$jscondition .= " || mainform.ed[" . $id . "].checked";
} else {
$jscondition .= "mainform.ed[" . $id . "].checked";
}
}
then in ur javascript:
<SCRIPT>
function validate() {
if (!(<?php print $jscondition; ?>)) {
---------------------------------------
http://www.dailymedication.com - Everything you didn't know you
needed until you went there and said to yourself, "What did I do
before I visited DailyMedication.com?" and another part of you
answered, "It does not matter. You are here now."
From: Albert Padley <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: [PHP] Validating Dynamic Checkboxes
Date: Fri, 6 Aug 2004 21:49:40 -0600
I have a php/mysql script that returns a series of records to
populate a form. The number of records returned varies from 1 to
as many as 100. On the display page, each record has a checkbox
to indicate that the record is being edited. This is checked on
the results page to know which records to update. The checkbox
code is:
<input type=\"checkbox\" name=\"ed[{$row['id']}]\" value=\"Y\">
This part of the system has been working perfectly for weeks.
Now I've been asked to add client side validation to make sure at
least one of the records (checkboxes) has been checked before
sending the data to the results page. (The results page already
has working validation code in it.)
I've have the following javascript code that should work for my
purposes if I can figure out how to dynamically build the
javascript code.
<SCRIPT>
function validate() {
if (!(mainform.ed[0].checked || mainform.ed[1].checked)) {
alert('Please check at least one record before submitting this
form.');
event.returnValue=false;
}
}
</SCRIPT>
This is the line I need to build dynamically:
if (!(mainform.ed[0].checked || mainform.ed[1].checked)) {
Any help, pointers, suggestions, etc. will be greatly appreciated.
Thanks.
Albert Padley
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
_________________________________________________________________
Don�t just search. Find. Check out the new MSN Search!
http://search.msn.click-url.com/go/onm00200636ave/direct/01/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
_________________________________________________________________
Check out Election 2004 for up-to-date election news, plus voter
tools and more! http://special.msn.com/msn/election2004.armx
_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar � get it now!
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/
--- End Message ---
--- Begin Message ---
methinks you are looking for a javascript mailing list. i only post this to
the forum because you posted your reply here as well, and i wanted to save
face in front of my PHP comrades.
the js code you sent back failed to reflect any of the significant changes i
suggested.
this is what you put:
<SCRIPT language="JavaScript">
function validate() {
if (!(<?php print $jscondition; ?>)) {
alert('Please check at least one edit checkbox before submitting this
form.');
return false;
}
}
</SCRIPT>
but that cannot work. you have it so that an alert will trigger if an item
is checked, but that is when you want the form to be submitted, and an alert
to be triggered otherwise.
first, make sure that your submit button is not an actual submit button, but
a regular button that triggers an onClick event, like thus:
<input type='button' onClick='validate()' name='submit' value='Submit'>
then have ur js function work like this: (i may not have coded everything
exactly as you needed it, only made it as a model, you'll have to extract
the logic and modify it for your needs):
<SCRIPT language="JavaScript">
function validate() {
if (!(<?php print $jscondition; ?>)) {
document.getElementById('mainform').submit();
} else {
alert("Please check at least one item.");
}
}
</SCRIPT>
i tested a simple model locally and it worked fine. if you wish to continue
this thread, i'll be glad to assist, but let's keep it out of the mailing
list until we hit on something that is directly related to PHP.
good luck,
j
note: netscape doesn't always work right with JS, sometimes working
contrary to the very language they invented. i tested the code with myIE2.
---------------------------------------
http://www.dailymedication.com - Everything you didn't know you needed
until you went there and said to yourself, "What did I do before I visited
DailyMedication.com?" and another part of you answered, "It does not matter.
You are here now."
From: Albert Padley <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Validating Dynamic Checkboxes
Date: Sat, 7 Aug 2004 00:25:38 -0600
Jason,
You lost me on this go around. I don't understand how we got from the
following function to your new verson:
//loop through records
$id = $row['id'];
$counter++;
if ($counter > 1) {
$jscondition .= " || document.getElementById('ed" . $id .
"').checked";
} else {
$jscondition .= "document.getElementById('ed" . $id . "').checked";
}
}
?>
<SCRIPT language="JavaScript">
function validate() {
if (!(<?php print $jscondition; ?>)) {
alert('Please check at least one edit checkbox before submitting this
form.');
return false;
}
}
</SCRIPT>
Remember that the above works insofar as it throws up the javascript alert,
but then submits the form anyway. I don't see how your new function
incorporates the loop to build $jscondition.
Thanks for any further input. I think I need to get some sleep.
Albert Padley
On Aug 6, 2004, at 11:39 PM, Jason Paschal wrote:
make ur submit button a regular button with an onClick event trigger:
<input name="button" type="button" id="button" onClick='validate()'
value="Submit">
then make ur javascript submit the form if conditions are true. otherwise
it gives an alert:
<script language="JavaScript">
function validate() {
if (document.getElementById('ed2').checked) {
document.getElementById('myform').submit();
} else {
alert("check something.");
}
}
</script>
---------------------------------------
http://www.dailymedication.com - Everything you didn't know you needed
until you went there and said to yourself, "What did I do before I visited
DailyMedication.com?" and another part of you answered, "It does not
matter. You are here now."
From: Albert Padley <[EMAIL PROTECTED]>
To: "Jason Paschal" <[EMAIL PROTECTED]>
Subject: Re: [PHP] Validating Dynamic Checkboxes
Date: Fri, 6 Aug 2004 23:27:29 -0600
We are very close. I now get the javascript alert when I don't check any
of the checkboxes. However, as soon as I click the OK button in the
alert, the results page is returned.
Albert Padley
On Aug 6, 2004, at 10:55 PM, Jason Paschal wrote:
i read the other guy's bit. he may be referring to how you identify the
elements. and that could be related to the same validation trouble
you're still having.
i've had to do similar stuff, but it wasn't exactly the same. however,
i had to give a an id different from the name of the element.
<input type='checkbox' name='ed[2]' id='ed2'>
and in ur javascript:
if ($counter > 1) {
$jscondition .= " || document.getElementById('ed" . $id .
"').checked";
} else {
$jscondition .= "document.getElementById('ed" . $id .
"').checked";
---------------------------------------
http://www.dailymedication.com - Everything you didn't know you needed
until you went there and said to yourself, "What did I do before I
visited DailyMedication.com?" and another part of you answered, "It does
not matter. You are here now."
From: Albert Padley <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Validating Dynamic Checkboxes
Date: Fri, 6 Aug 2004 22:36:10 -0600
Jason,
Thanks. That seems to build the javascript string, but unfortunately
the form doesn't validate. In other words, if I leave all the
checkboxes unchecked the results page still is returned.
Perhaps there is a problem with the javascript? Any ideas?
Albert Padley
On Aug 6, 2004, at 10:02 PM, Jason Paschal wrote:
here's an idea:
above the HTML, you could put something like this [i'm going to use
pseudo-code since i don't know how you set it up, but you may have to
do the same query twice]:
$counter = 0;
loop through records {
$id = $row['id'];
$counter++;
if ($counter > 1) {
$jscondition .= " || mainform.ed[" . $id . "].checked";
} else {
$jscondition .= "mainform.ed[" . $id . "].checked";
}
}
then in ur javascript:
<SCRIPT>
function validate() {
if (!(<?php print $jscondition; ?>)) {
---------------------------------------
http://www.dailymedication.com - Everything you didn't know you
needed until you went there and said to yourself, "What did I do
before I visited DailyMedication.com?" and another part of you
answered, "It does not matter. You are here now."
From: Albert Padley <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: [PHP] Validating Dynamic Checkboxes
Date: Fri, 6 Aug 2004 21:49:40 -0600
I have a php/mysql script that returns a series of records to
populate a form. The number of records returned varies from 1 to as
many as 100. On the display page, each record has a checkbox to
indicate that the record is being edited. This is checked on the
results page to know which records to update. The checkbox code is:
<input type=\"checkbox\" name=\"ed[{$row['id']}]\" value=\"Y\">
This part of the system has been working perfectly for weeks.
Now I've been asked to add client side validation to make sure at
least one of the records (checkboxes) has been checked before sending
the data to the results page. (The results page already has working
validation code in it.)
I've have the following javascript code that should work for my
purposes if I can figure out how to dynamically build the javascript
code.
<SCRIPT>
function validate() {
if (!(mainform.ed[0].checked || mainform.ed[1].checked)) {
alert('Please check at least one record before submitting this
form.');
event.returnValue=false;
}
}
</SCRIPT>
This is the line I need to build dynamically:
if (!(mainform.ed[0].checked || mainform.ed[1].checked)) {
Any help, pointers, suggestions, etc. will be greatly appreciated.
Thanks.
Albert Padley
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
_________________________________________________________________
Don�t just search. Find. Check out the new MSN Search!
http://search.msn.click-url.com/go/onm00200636ave/direct/01/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
_________________________________________________________________
Check out Election 2004 for up-to-date election news, plus voter tools
and more! http://special.msn.com/msn/election2004.armx
_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar � get it now!
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
_________________________________________________________________
Don�t just search. Find. Check out the new MSN Search!
http://search.msn.click-url.com/go/onm00200636ave/direct/01/
--- End Message ---
--- Begin Message ---
Hello,
On 08/06/2004 11:00 AM, Anton Krall wrote:
> Guys.
>
> Anybody knows any PHP voting applications that would let you not only add
> your quesitons and answers but lso let the user add their own answers in
> case what they want wasn't on the included ones?
Here you may find a few classes for that purpose:
http://www.phpclasses.org/browse/class/31.html
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--- End Message ---
--- Begin Message ---
Curt Zirzow wrote:
* Thus wrote Ed Lazor:
Gawd this stuff sucks.
Nothing like a spammer posing as the list itself and farming email addresses
from members.
Its odd, i've yet to get one of those. Either the spammers dns
doesn't resolve proper (cause my server rejects those) or if its
due to the fact I only reply-to-list.
I'm assuming its a dns issue at this point.
Curt
I read and reply through gmane, and I got them. But I don't see them
anymore because they're filtered directly to the trash.
Chris
--- End Message ---
--- Begin Message ---
Well i havent seen anyone been using BETWEEN.
Anyway...
<?php
$SQL = mysql_query("SELECT value FROM table_name WHERE element BETWEEN 48
AND 53");
while($row = mysql_fetch_arrray($SQL)) {
print($row['value']);
}
mysql_free_result($SQL);
?>
From: "Jason Davidson" <[EMAIL PROTECTED]>
To: "Brian Tully" <[EMAIL PROTECTED]>, "Jay Blanchard"
<[EMAIL PROTECTED]>, " PHP" <[EMAIL PROTECTED]>
Subject: Re: [PHP] is there a more efficient query?
Date: Fri, 6 Aug 2004 09:48:29 -0700
your only getting one row beucase your only pulling one row from the
array. You need to loop thru the rows to grab them all.
Jason
Brian Tully <[EMAIL PROTECTED]> wrote:
>
> on 8/6/04 12:28 PM, Jay Blanchard at [EMAIL PROTECTED]
> wrote:
>
> > [snip]
> > Tis SQL ....
> >
> > SELECT value
> > FROM element_values
> > WHERE user = $user_id
> > AND(element=48
> > OR element=52
> > OR and so on....)
> > [/snip]
> >
> > You can also use IN
> >
> > SELECT value
> > FROM element_values
> > WHERE user = $user_id
> > AND element IN ('48', '52',...)
>
>
> thanks Jay!
>
> but that only seems to return the first value. how should I be calling
the
> results?
>
> $query2 = "SELECT value FROM element_values WHERE "
> . "(element=48 OR element=49 OR element=50 OR element=51 OR
> element=52 OR element=53) "
> . "AND user=$user_id";
>
> $result2 = mysql_query($query2) or die("could not $query2 " .
> mysql_error());
> list($user_name, $address_street, $address_city, $address_state,
> $address_zip, $phone) = mysql_fetch_array($result2);
>
> do i need to do a while loop and create an array or something?
>
> thanks again.
>
> brian
>
> --
> 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
_________________________________________________________________
Chatt: Tr�ffa nya n�tkompisar p� Habbo Hotel
http://habbohotel.msn.se/habbo/sv/channelizer
--- End Message ---
--- Begin Message ---
"Aaron Todd" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Do you recomend the same for downloading of a file. I have a few zip
files
> that need to be protected too. Do I have to open the file using fopen and
> then write it to the users machine using fwrite?
>
> Thanks,
>
> Aaron
You can do this for any type of file. Set the aprropriate headers and then
use readfile():
http://de2.php.net/manual/en/function.readfile.php
Regards, Torsten
--- End Message ---
--- Begin Message ---
"Ed Lazor" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I ran into this last month. It was a problem with the ISP's server. They
> were load balancing between different machines and PHP / Apache was having
> trouble accessing session files.
Storing the session data in a database might solve this problem.
Regards, Torsten Roehr
>
> > -----Original Message-----
> > From: BOOT [mailto:[EMAIL PROTECTED]
> > Sent: Friday, August 06, 2004 1:26 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] Session problems under heavy load???
> >
> > My server was under a heavy load (rebuilding software raid 1 array) and
my
> > PHP+MySQL site seemed to be all "messed up." From what I can makeout
> > session
> > variables were being lost. I would expect simply degraded performance
but
> > not the loss of variables. Is this normal? LOL the array is still
> > rebuilding
> > right now and the alternative problem means something happened to my
code
> > (yes I have backups :))
> >
> > Thanks for any comments!
> >
--- End Message ---
--- Begin Message ---
I had a problem with session variables being lost. However it wasn't because
of a heavy load. My hosting company does load balancing and user requests
would be directed to different servers. However, when the session was
originally defined it was placed in the /tmp file of one server. When a
request came into a different server it wouldn't "know" about the session
and hence the
variables seemed "lost" only to reappear unexpectedly a few requests later.
I fixed the problem by defining the /tmp directory to my public_html
directory.
This may have nothing to do with your isse but the heavy load you are
experiencing may be triggering some load balancing mechanism which is
directing users to another server that isn't aware of your session
variables.
"Boot" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> My server was under a heavy load (rebuilding software raid 1 array) and my
> PHP+MySQL site seemed to be all "messed up." From what I can makeout
session
> variables were being lost. I would expect simply degraded performance but
> not the loss of variables. Is this normal? LOL the array is still
rebuilding
> right now and the alternative problem means something happened to my code
> (yes I have backups :))
>
> Thanks for any comments!
--- End Message ---
--- Begin Message ---
I have a problem with my mysql query
SELECT pics.*, pic_comments.*, count(*) AS num_comments FROM pics,
pic_comments WHERE pics.category = 1 AND pics.id = pic_comments.pic_id GROUP
BY pic_comments.pic_id;
pics table:
| id | submitter | time | date | category |
pic_comments table:
| pic_id | comment |
The problem is that i only get the the pictures that have comments, i want
even the pictures where there arent no comments and the field num_comments
should be 0.
Someone who have an idea to solve this?
_________________________________________________________________
L�ttare att hitta dr�mresan med MSN Resor http://www.msn.se/resor/
--- End Message ---
--- Begin Message ---
On Saturday 07 August 2004 17:27, Mattias J�nsson wrote:
> I have a problem with my mysql query
This is a PHP list.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
share, n.:
To give in, endure humiliation.
*/
--- End Message ---
--- Begin Message ---
Mattias J�nsson wrote:
I have a problem with my mysql query
try postgres instead http://www.postgresql.org/
--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--- End Message ---
--- Begin Message ---
Raditha Dissanayake wrote:
> try postgres instead http://www.postgresql.org/
It's the most helpful comment I've seen for a long time.
You know, it won't work in Postgre too probably. If you like Postgre -
use it and don't force others to use it (for wrong reasons nevertheless).
Everyone should pick his/her own tools...
Anyway, instead of writing this:
SELECT pics.*, pic_comments.*, count(*) AS num_comments FROM pics,
pic_comments WHERE pics.category = 1 AND pics.id = pic_comments.pic_id GROUP
BY pic_comments.pic_id;
Write this:
SELECT pics.*, pic_comments.*, count(*) AS num_comments
FROM pics
LEFT JOIN pic_comments ON (pic_comments.pic_id = pics.id)
WHERE pics.category = 1
GROUP BY pics.pic_id;
Lenar
--- End Message ---
--- Begin Message ---
Mattias J�nsson wrote:
SELECT pics.*, pic_comments.*, count(*) AS num_comments FROM pics,
pic_comments WHERE pics.category = 1 AND pics.id = pic_comments.pic_id
GROUP BY pic_comments.pic_id;
[snip]
The problem is that i only get the the pictures that have comments, i
want even the pictures where there arent no comments and the field
num_comments should be 0.
Need a LEFT JOIN
SELECT pics.*, pic_comments.*, count(*) AS num_comments FROM pics LEFT
JOIN pic_comments on pics.id = pic_comments.pic_id WHERE pics.category =
1 GROUP BY pic_comments.pic_id
--
John Holmes
php|architect - The magazine for PHP professionals - http://www.phparch.com
--- End Message ---
--- Begin Message ---
Hello!
I made a class which should represent a tree-like structure (PHP 4.3.8).
I made a root-nore and added 2 childs. The problem is that the childs
are not added to the parent. Why?
Martin
class TreeItem
{ var $m_pParent;
var $m_sName;
var $m_arrChilds = array();
function TreeItem($pParent, $sName)
{ $this->m_pParent = $pParent;
$this->m_sName = $sName;
if ($pParent != NULL)
$pParent->AddChild($this);
}
function AddChild($pTreeItem)
{ array_push($this->m_arrChilds, $pTreeItem);
}
}
$root = new TreeItem(NULL, "Root");
$child1 = new TreeItem($root, "Child 1");
$child2 = new TreeItem($root, "Child 2");
print Count($root->m_arrChilds); // Outputs 0. Why????
--- End Message ---
--- Begin Message ---
Ah, i forgott to pass the paramter as a reference...
Martin
--- End Message ---
--- Begin Message ---
Martin Schneider wrote:
Ah, i forgott to pass the paramter as a reference...
Many mistakes only become visible at the moment you hit <send> ;)
--
Lester Caine
-----------------------------
L.S.Caine Electronic Services
--- End Message ---
--- Begin Message ---
This one time, at band camp, PHP Gen <[EMAIL PROTECTED]> wrote:
> Hi,
> I have a function that reads jpg files (thumbnails)
> from a directory and puts all the files names into an
> array...I want to sort that array by the filename,
> problem is, I dont know if filenames will be pure
> numeric (eg 001.jpg,002.jpg) or alpha-numeric
> (asdf001,asdf002)
<?php
$hdl = opendir('./');
while ($dirEntry = readdir($hdl)) {
if (substr($dirEntry, 0, 1) != '.') {
$listing[] = $dirEntry;
}
}
natsort($listing);
closedir($hdl);
foreach($listing as $blah) { echo $blah.'<br />'; }
?>
or something.
Kevin
--
______
(_____ \
_____) ) ____ ____ ____ ____
| ____/ / _ ) / _ | / ___) / _ )
| | ( (/ / ( ( | |( (___ ( (/ /
|_| \____) \_||_| \____) \____)
Kevin Waterson
Port Macquarie, Australia
--- End Message ---
--- Begin Message ---
Greetings,
I need to create some directories on the server using script. My server is
having safe _mode 'On'. The script is giving me some warning like this.
Warning: mkdir(): SAFE MODE Restriction in effect. The script whose uid is
10029 is not allowed to access
/home/httpd/vhosts/***......****/httpdocs/w4/full1/1 owned by uid 48 in
/home/httpd/***......****/httpdocs/w4/dir.php on line 23
<?
$uid=1;
$c_id=1;
if (!is_dir("full1/$uid"))
{
echo "creating full1/$uid";
$oldmask = umask(0);
mkdir("full1/$uid",0777);
umask($oldmask);
}
if (!is_dir("thumb/$uid"))
{
echo "<br>creating thumb/$uid";
$oldmask = umask(0);
mkdir("thumb/$uid",0777);
umask($oldmask);
}
if (!is_dir("full1/$uid/$c_id"))
{
echo "<br>creating full1/$uid/$c_id";
$oldmask = umask(0);
mkdir("full1/$uid/$c_id",0777);
umask($oldmask);
}
if (!is_dir("thumb/$uid/$c_id"))
{
echo "<br>creating thumb/$uid/$c_id";
$oldmask = umask(0);
mkdir("thumb/$uid/$c_id",0777);
umask($oldmask);
}
echo "<br>Done";
?>
I am able to make first two directories i.e 'full1/1' and 'thumb/1'. Script
do not allow me to make 'full1/1/1' and 'thumb/1/1' too. I also have tried
removing umask function.
Waiting for an answer. Thanks a ton for reading this far.
--
Kevin Javia
--- End Message ---
--- Begin Message ---
On Saturday 07 August 2004 20:17, Kevin wrote:
> I am able to make first two directories i.e 'full1/1' and 'thumb/1'. Script
> do not allow me to make 'full1/1/1' and 'thumb/1/1' too. I also have tried
> removing umask function.
What are the permissions on the directories that you are able to make?
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Paul's Law:
You can't fall off the floor.
*/
--- End Message ---
--- Begin Message ---
Hi all,
Can anyone tell me how to use parameter conext (resource) in functions mkdir
and rmdir? I would like to see a example if possible...
Regards,
Walace
--- End Message ---
--- Begin Message ---
Hi all,
Can anyone tell me how to use parameter conext (resource) in functions mkdir
and rmdir? I would like to see a example if possible...
Regards,
Walace
--- End Message ---
--- Begin Message ---
Hi,
I have a table in my database that holds links for individual pages on my
site:
mysql> DESCRIBE Page_Links;
+-----------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------+--------------+------+-----+---------+----------------+
| Link_ID | int(11) | | PRI | NULL | auto_increment |
| PHP_SELF | varchar(100) | | | | |
| Action | varchar(100) | | | | |
| Link | varchar(255) | | | | |
| Link_Text | varchar(100) | | | | |
+-----------+--------------+------+-----+---------+----------------+
5 rows in set (0.00 sec)
The links that appear on each page depend on PHP_SELF i.e./users/index.php
and $_GET[action] variable i.e. add_user.
This all works well until there is a problem with the form validation, for
example if I am on the add_user.php page and I click to add a user I am
taken back to the users list, the action is insert_user and I display the
links accordingly. However if there is a problem with the submission i.e.
the user leaves a field blank then they are redirected to the add_user.php
page, the action is still insert_user but I would not want the same links to
appear on this page.
Any help on this matter would be greatly appreciated
--- End Message ---
--- Begin Message ---
I assume you are using PHP4's DOMXML functions? If that's the case then you
have a bit of a problem. XML support changed between 4.0 and 5.0, we use
libxml2 (which supports UTF-8), but the object model / methods changed to better
conform with the DOM standard. Also AFAIK the experimental tag has been dropped
for PHP5. I reckon that upgrading scripts to work with PHP5 and fixing any bugs
that pop up is far easier than writing your own validating XML parser. Hell,
even libxml2 doesn't fully support XML Schemas yet.
--- End Message ---
--- Begin Message ---
Hi,
Anybody has an example and a desctiption about context parameter in rmdir,
mkdir functions (added in php5) ?
thx
Walace
--- End Message ---