Re: [PHP] parent::construct not reliable working on php5.1 b2/b3

2005-08-03 Thread Meno Abels

Thanks,

the problem with cut an paste i have not only one of these messages
i get huge amounts of these. So i stripped down to one, sorry my fault.

a) usally 4-6
b) no
c) yes, as I mentioned i tried both (old/new)
d) never tested i jump over 5.0

the problem with the code is currently the problem only occures in the
real application which as about 2 lines of code. I tried to  
stripped down

but there was not success. So I ask about how could i work out an idea
from the php source to find these problem. I'am pretty sure that i done
everything rightly in my application code. It works perfectly with  
the old-style and php 4.x
and i converted all to the new style which is easy of course it is  
generated

php source code so there is not really a general fault possible. If the
generator works-:)

your questions aren't silly

meno

Am 02.08.2005 um 23:34 schrieb Jochem Maas:


Meno Abels wrote:


it is only a typo in my email i use __construct



ok - I would recommend cut-n-paste for this kind of output
to prevent idiots like me pointing out you typos and to avoid  
confusion

in general.

the next questions would be:

a, how many parents does the problem class (Link or Links?) have?
b, is Rank the base class?
c, does Rank::__construct() actually exist?
d, does the error also occur with php5.0.x? (as apposed to php5.1beta)

given these questions may seem silly - but I can't see your code from
here :-) so I figured I'd ask anyway!



Meno
2005/8/2, Jochem Maas <[EMAIL PROTECTED]>:


Pawel Bernat wrote:



On Tue, Aug 02, 2005 at 03:42:00PM +0100, Meno Abels wrote:




Hello,

With my application that uses heavily inherent classes,  
sometimes I




dep class heirarchies can lead to brainfreeze - beware of  
going to deep :-)





get the following message:
PHP Fatal error:  Call to undefined method Rank::_construtor() in
.../inc/Links.class.php.   It works  
with php

4.x when I use the old style of constructor calling
$this->(CLASSNAME) . But when working with php 5.2 b2 or b3 in  
the old

OR the new style, I get the PHP Fatal error from above.
Is there any hints to look at this problem?



Why do you call _construct instead of __construct? And how do  
you do it?




he seems to be calling _construtor() which although not wrong is  
not the
method he is looking for (cue voice of Alex Guiness for the  
second time this week :-)


try __construct()

PS - this kind of thing belongs on generals until you are _sure_  
it's an

internals problem. IMHO.



Did you read everything at http://php.net/construct (including  
Note)?

What about php 5.0?













--
Meno Abels   20six AG
Office: Home:
2 Lampton Place  21 Clarendon Road,Flat 4
W11 2SH LondonRH1 1QJ Redhill
UK   UK
P: +44 20 7243 4781   P: +44 17 3776 3809
F: +44 20 7243 4762   M: +44 78 7159 9638



Re: [PHP] parent::construct not reliable working on php5.1 b2/b3

2005-08-03 Thread Jochem Maas

Meno Abels wrote:

Thanks,

the problem with cut an paste i have not only one of these messages
i get huge amounts of these. So i stripped down to one, sorry my fault.

a) usally 4-6


any given class will never have a variable number of parents ;-)
IMHO 6 levels deep is pushing the boat out a bit - but technically it
should be no problem


b) no
c) yes, as I mentioned i tried both (old/new)


again it may sound stupid but double check spelling in the file.
also check for weird non-printing chars in the problem file -


d) never tested i jump over 5.0


5.1 is still beta - test it on 5.0 (consider that the mailing list equivelant
of a military order ;-)

does the problem occur in only 1 baseclass? or in a fixed number of
baseclasses? or is does it occur anywhere/everywhere.

are you trying to reassign $this or are you using the reference token (&)
when passing objects around? (I ask because you seem to indicate that the
codebase is being moved from php4 where such things are almost required to
make usuable OO code - whereas in php5 it's asking for trouble)

pump up error_reporting to full i.e. error_reporting( E_ALL | E_STRICT )
- maybe it will give you a hint.

also you might consider placing a call to debug_print_backtrace() in each
and every constructor to help see wtf is going on.

lastly get a copy of Zend Studio Client/Server and set it up so that you
can do step by step debugging to see _exactly_ what is going on.

I'm running out of ideas here ... I can only suggest now to post code
- and plenty of it - if that is possible, send a link to somewhere rather than
bombard everyone on the list with 1000's of lines of code.



the problem with the code is currently the problem only occures in the
real application which as about 2 lines of code. I tried to  
stripped down

but there was not success. So I ask about how could i work out an idea
from the php source to find these problem. I'am pretty sure that i done
everything rightly in my application code. It works perfectly with  the 
old-style and php 4.x
and i converted all to the new style which is easy of course it is  
generated

php source code so there is not really a general fault possible. If the
generator works-:)


that last IF is a big one though!



your questions aren't silly


I know that ;-) I was just trying to make sure you didn't feel as if I was
talking down to you :-)



meno

Am 02.08.2005 um 23:34 schrieb Jochem Maas:


Meno Abels wrote:


it is only a typo in my email i use __construct



ok - I would recommend cut-n-paste for this kind of output
to prevent idiots like me pointing out you typos and to avoid  confusion
in general.

the next questions would be:

a, how many parents does the problem class (Link or Links?) have?
b, is Rank the base class?
c, does Rank::__construct() actually exist?
d, does the error also occur with php5.0.x? (as apposed to php5.1beta)

given these questions may seem silly - but I can't see your code from
here :-) so I figured I'd ask anyway!



Meno
2005/8/2, Jochem Maas <[EMAIL PROTECTED]>:


Pawel Bernat wrote:



On Tue, Aug 02, 2005 at 03:42:00PM +0100, Meno Abels wrote:




Hello,

With my application that uses heavily inherent classes,  sometimes I



dep class heirarchies can lead to brainfreeze - beware of  going 
to deep :-)





get the following message:
PHP Fatal error:  Call to undefined method Rank::_construtor() in
.../inc/Links.class.php.   It works  with php
4.x when I use the old style of constructor calling
$this->(CLASSNAME) . But when working with php 5.2 b2 or b3 in  
the old

OR the new style, I get the PHP Fatal error from above.
Is there any hints to look at this problem?



Why do you call _construct instead of __construct? And how do  you 
do it?




he seems to be calling _construtor() which although not wrong is  
not the
method he is looking for (cue voice of Alex Guiness for the  second 
time this week :-)


try __construct()

PS - this kind of thing belongs on generals until you are _sure_  
it's an

internals problem. IMHO.




Did you read everything at http://php.net/construct (including  Note)?
What about php 5.0?















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



Re: [PHP] parent::construct not reliable working on php5.1 b2/b3

2005-08-03 Thread Meno Abels


Am 03.08.2005 um 09:22 schrieb Jochem Maas:


Meno Abels wrote:


Thanks,
the problem with cut an paste i have not only one of these messages
i get huge amounts of these. So i stripped down to one, sorry my  
fault.

a) usally 4-6



any given class will never have a variable number of parents ;-)
IMHO 6 levels deep is pushing the boat out a bit - but technically it
should be no problem


depends on the application





b) no
c) yes, as I mentioned i tried both (old/new)



again it may sound stupid but double check spelling in the file.
also check for weird non-printing chars in the problem file -


there are is alot of code which works as i mentioned all the code
is generated. The pattern of the working code is not different to the
none working. Also i have some examples where i call the same class
in other scripts and they are working. So there is no write error. Also
the old syntax should work without change and php 4 it works perfect.





d) never tested i jump over 5.0



5.1 is still beta - test it on 5.0 (consider that the mailing list  
equivelant

of a military order ;-)


that will take a while to do



does the problem occur in only 1 baseclass? or in a fixed number of
baseclasses? or is does it occur anywhere/everywhere.


i occurs with a random pattern



are you trying to reassign $this or are you using the reference  
token (&)
when passing objects around? (I ask because you seem to indicate  
that the
codebase is being moved from php4 where such things are almost  
required to

make usuable OO code - whereas in php5 it's asking for trouble)


NO not used!



pump up error_reporting to full i.e. error_reporting( E_ALL |  
E_STRICT )

- maybe it will give you a hint.


DONE, i see nothing which is seams to be helpfull



also you might consider placing a call to debug_print_backtrace()  
in each

and every constructor to help see wtf is going on.


i'am not clear what is should help for.



lastly get a copy of Zend Studio Client/Server and set it up so  
that you

can do step by step debugging to see _exactly_ what is going on.


-:)



I'm running out of ideas here ... I can only suggest now to post code
- and plenty of it - if that is possible, send a link to somewhere  
rather than

bombard everyone on the list with 1000's of lines of code.


i will work to strip down you can't run the code without 20 own  
written c++/c

extentions.





the problem with the code is currently the problem only occures in  
the
real application which as about 2 lines of code. I tried to   
stripped down
but there was not success. So I ask about how could i work out an  
idea
from the php source to find these problem. I'am pretty sure that i  
done
everything rightly in my application code. It works perfectly  
with  the old-style and php 4.x
and i converted all to the new style which is easy of course it  
is  generated
php source code so there is not really a general fault possible.  
If the

generator works-:)



that last IF is a big one though!



your questions aren't silly



I know that ;-) I was just trying to make sure you didn't feel as  
if I was

talking down to you :-)


you are welcome







meno
Am 02.08.2005 um 23:34 schrieb Jochem Maas:


Meno Abels wrote:



it is only a typo in my email i use __construct




ok - I would recommend cut-n-paste for this kind of output
to prevent idiots like me pointing out you typos and to avoid   
confusion

in general.

the next questions would be:

a, how many parents does the problem class (Link or Links?) have?
b, is Rank the base class?
c, does Rank::__construct() actually exist?
d, does the error also occur with php5.0.x? (as apposed to  
php5.1beta)


given these questions may seem silly - but I can't see your code  
from

here :-) so I figured I'd ask anyway!




Meno
2005/8/2, Jochem Maas <[EMAIL PROTECTED]>:



Pawel Bernat wrote:




On Tue, Aug 02, 2005 at 03:42:00PM +0100, Meno Abels wrote:





Hello,

With my application that uses heavily inherent classes,   
sometimes I





dep class heirarchies can lead to brainfreeze - beware of   
going to deep :-)






get the following message:
PHP Fatal error:  Call to undefined method Rank::_construtor 
() in
.../inc/Links.class.php.   It works   
with php

4.x when I use the old style of constructor calling
$this->(CLASSNAME) . But when working with php 5.2 b2 or b3  
in  the old

OR the new style, I get the PHP Fatal error from above.
Is there any hints to look at this problem?




Why do you call _construct instead of __construct? And how do   
you do it?





he seems to be calling _construtor() which although not wrong  
is  not the
method he is looking for (cue voice of Alex Guiness for the   
second time this week :-)


try __construct()

PS - this kind of thing belongs on generals until you are  
_sure_  it's an

internals problem. IMHO.




Did you read everything at http://php.net/construct  
(including  Note)?

What about php 5.0?




















Re: [PHP] parent::construct not reliable working on php5.1 b2/b3

2005-08-03 Thread Jochem Maas

Meno Abels wrote:


Am 03.08.2005 um 09:22 schrieb Jochem Maas:


Meno Abels wrote:


Thanks,
the problem with cut an paste i have not only one of these messages
i get huge amounts of these. So i stripped down to one, sorry my  fault.
a) usally 4-6



any given class will never have a variable number of parents ;-)
IMHO 6 levels deep is pushing the boat out a bit - but technically it
should be no problem



depends on the application


IC.







b) no
c) yes, as I mentioned i tried both (old/new)



again it may sound stupid but double check spelling in the file.
also check for weird non-printing chars in the problem file -



there are is alot of code which works as i mentioned all the code
is generated. The pattern of the working code is not different to the
none working. Also i have some examples where i call the same class
in other scripts and they are working. So there is no write error. Also
the old syntax should work without change and php 4 it works perfect.





d) never tested i jump over 5.0



5.1 is still beta - test it on 5.0 (consider that the mailing list  
equivelant

of a military order ;-)



that will take a while to do


its worth it - regardless of whether it works properly on 5.0 or not
it strengthens any eventual bug report you may make - i.e. you can indicate
in depth problem research.

also try a fresh build of the latest php5.1 beta - just in case.

no hurry on my account, I'm just an interested bystander :-)





does the problem occur in only 1 baseclass? or in a fixed number of
baseclasses? or is does it occur anywhere/everywhere.



i occurs with a random pattern


ouch. when you say random does that mean that running the exact same code
will not always produce the error?

what OS are you on?





are you trying to reassign $this or are you using the reference  token 
(&)
when passing objects around? (I ask because you seem to indicate  that 
the
codebase is being moved from php4 where such things are almost  
required to

make usuable OO code - whereas in php5 it's asking for trouble)



NO not used!


we can rule that out then
!





pump up error_reporting to full i.e. error_reporting( E_ALL |  E_STRICT )
- maybe it will give you a hint.



DONE, i see nothing which is seams to be helpfull


darn. so you're not even getting any E_STRICT errors?





also you might consider placing a call to debug_print_backtrace()  in 
each

and every constructor to help see wtf is going on.



i'am not clear what is should help for.


it may help you to see a pattern that is not obvious by viewing the stack trace
preceeding each fatal error. just a thought - it may turn up nothing :-/





lastly get a copy of Zend Studio Client/Server and set it up so  that you
can do step by step debugging to see _exactly_ what is going on.



-:)



I'm running out of ideas here ... I can only suggest now to post code
- and plenty of it - if that is possible, send a link to somewhere  
rather than

bombard everyone on the list with 1000's of lines of code.



i will work to strip down you can't run the code without 20 own  written 
c++/c

extentions.



 (alarm bell goes off) - you have 20+ of your own extensions that
are required, there is a distinct possibility that the problem lies within them 
...

recompling php with all the debug configure options turned on
and using valgrind and/or gdb to debug maybe what you need to be doing.

Side Note: you have code generators and a bunch of custom extensions - it sounds
interesting to say the least! I'd love to see your stuff ... will you be going 
open
source with it per chance? (maybe that is not even a decision you are allowed 
to make)

rgds,
Jochem










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



Re: [PHP] parent::construct not reliable working on php5.1 b2/b3

2005-08-03 Thread Meno Abels


Am 03.08.2005 um 11:03 schrieb Jochem Maas:


Meno Abels wrote:


Am 03.08.2005 um 09:22 schrieb Jochem Maas:


Meno Abels wrote:



Thanks,
the problem with cut an paste i have not only one of these messages
i get huge amounts of these. So i stripped down to one, sorry  
my  fault.

a) usally 4-6




any given class will never have a variable number of parents ;-)
IMHO 6 levels deep is pushing the boat out a bit - but  
technically it

should be no problem


depends on the application



IC.







b) no
c) yes, as I mentioned i tried both (old/new)




again it may sound stupid but double check spelling in the file.
also check for weird non-printing chars in the problem file -


there are is alot of code which works as i mentioned all the code
is generated. The pattern of the working code is not different to the
none working. Also i have some examples where i call the same class
in other scripts and they are working. So there is no write error.  
Also

the old syntax should work without change and php 4 it works perfect.






d) never tested i jump over 5.0




5.1 is still beta - test it on 5.0 (consider that the mailing  
list  equivelant

of a military order ;-)


that will take a while to do



its worth it - regardless of whether it works properly on 5.0 or not
it strengthens any eventual bug report you may make - i.e. you can  
indicate

in depth problem research.

also try a fresh build of the latest php5.1 beta - just in case.

no hurry on my account, I'm just an interested bystander :-)




does the problem occur in only 1 baseclass? or in a fixed number of
baseclasses? or is does it occur anywhere/everywhere.


i occurs with a random pattern



ouch. when you say random does that mean that running the exact  
same code

will not always produce the error?

what OS are you on?


FREEBSD 5.4-p6






are you trying to reassign $this or are you using the reference   
token (&)
when passing objects around? (I ask because you seem to indicate   
that the
codebase is being moved from php4 where such things are almost   
required to

make usuable OO code - whereas in php5 it's asking for trouble)


NO not used!



we can rule that out then
!




pump up error_reporting to full i.e. error_reporting( E_ALL |   
E_STRICT )

- maybe it will give you a hint.


DONE, i see nothing which is seams to be helpfull



darn. so you're not even getting any E_STRICT errors?


i fixed them year go we are working only with E_STRICT on-:)






also you might consider placing a call to debug_print_backtrace 
()  in each

and every constructor to help see wtf is going on.


i'am not clear what is should help for.



it may help you to see a pattern that is not obvious by viewing the  
stack trace
preceeding each fatal error. just a thought - it may turn up  
nothing :-/





lastly get a copy of Zend Studio Client/Server and set it up so   
that you

can do step by step debugging to see _exactly_ what is going on.


-:)



I'm running out of ideas here ... I can only suggest now to post  
code
- and plenty of it - if that is possible, send a link to  
somewhere  rather than

bombard everyone on the list with 1000's of lines of code.

i will work to strip down you can't run the code without 20 own   
written c++/c

extentions.



 (alarm bell goes off) - you have 20+ of your own  
extensions that
are required, there is a distinct possibility that the problem lies  
within them ...


recompling php with all the debug configure options turned on
and using valgrind and/or gdb to debug maybe what you need to be  
doing.




LONG Done, standard procedure, the extentions working all without  
change from 4.x.
Our extentions only doing some weired algorithmens on integer and  
float matrixes which
are too slow in native php. They do not allocated memory only on the  
stack-:). All around

it is pretty simple stuff.

Side Note: you have code generators and a bunch of custom  
extensions - it sounds
interesting to say the least! I'd love to see your stuff ... will  
you be going open
source with it per chance? (maybe that is not even a decision you  
are allowed to make)


it is for you just useless stuff the application is the rapid  
development enviroment for a
real huge a datamining application which is mostly design by the use  
of MDA(Model Driven Architecture).
We use php for this to safe the huge compile times we need to have on  
the also generated
c++ application. PHP is only used for testing and and safe turnaround  
times-:) but without the
backend databases which believe me are unsharable-:) you gets out of  
the code nothing.


regards

meno


rgds,
Jochem







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



[PHP] Everything works...Unless they hit the "back" button...

2005-08-03 Thread Jack Jackson

Hi all. This has been an interesting week.

Now the form works, and I am able to error check, if no errors look into 
user answer table and delete from that all q_ids matching the ones just 
picked, insert this page of question/answer info (q_id/a_id) into the 
user answer db, and if successful advance the category by 1 and get more 
questions. It works.


I must have a logic error though because for some reason even though I 
say to delete matching  q_ids and reinsert, then move on, if the user 
hits the back button, changes answers and hits submit again, the table 
does not update . .  . and the category does not increment. We get stuck 
on this page of questions/answers forever.


What DOES happen after BACK is that the answers they select get passed 
back to error check (eg if they select a select box to nothing, error 
checking reenters its value into $message) and those values get passed 
back to the display page (eg $_POST[$qname] == $aid) because the 
"selected" answers change. It's just the db call and category advance 
which get stuck.


Any help will be greatly appreciated - Here's the code:

";
print_r($_POST);
echo "";
echo "required session:";
var_dump($_SESSION['required_fields']);

echo "\$ cat:" . $cat . "";
echo "\$message: ";
var_dump($message);

//error_reporting(E_ALL);


/* A script to retrieve from database questions and answers,
 * create a multi-page HTML form, error check answers and
 * submit them to the database on a per-user basis.
 * August 2005
 */

//Some basic vars
 if (!isset($cat)) { $cat = "1"; }
$error=0;
$SUCCESS=0;


if (!isset($message))
{
$message = array();
}

if (!isset($_SESSION['required_fields']))
{
$_SESSION['required_fields'] = array();
}

if(!sizeof($_POST))
{
include_once(QUESTIONS . 'q.inc');
}

 //error checking

 reset($_SESSION['required_fields']);
  foreach ($_SESSION['required_fields'] as $fieldname)
{
   if (!isset($_POST[$fieldname]) || empty($_POST[$fieldname]))
   {
$message[$fieldname]=1;
   }

 }//error check
  if (!empty($message))
  {   $cat=$_POST['cat'];
  include_once(QUESTIONS . 'q.inc');
  }

//No errors? Store what's been done so far

  if ( ($_POST['action'] == 'process') && (!sizeof($message) ) )
  {
  foreach($_POST as $key=>$val)
   {
   //find key/val sets within posts which are both numeric
   if(is_numeric($key) && is_numeric($val))
   {
  $nkey=$key;
  //add keys to the qidlist
  $qidlist[] .= $key;
  //add these values ( q_id, a_id ) to sql statement
  $qanda[] .= "('1' , '" . $nkey . "' , '" . $val . 
"')";

   }
   //find key/val sets within sub-arrays of $_POST 
which are numeric

   if(is_array($val))
   {
   foreach ($val as $akey=>$aval)
   {
   //add these values ( q_id, a_id ) to sql 
statement
   $qanda[] .= "('1' , '" . $key . "' , '" . 
$aval . "')";

   var_dump($qanda);
   }
   }
   }


   $qidlist_sql="DELETE FROM $userAnswers WHERE q_id IN (" 
. (implode(",",$qidlist)) . ");";


   $q_a_sql="INSERT INTO $userAnswers (u_id, q_id, a_id )
VALUES " . (implode(",",$qanda)) . ";";

 mysql_query($qidlist_sql);


  if($q_a_result = mysql_query($q_a_sql))
{
  unset($_SESSION['required_fields']);
  $cat = $_POST['cat']+1;
  include_once(QUESTIONS . 'q.inc');
}

else
{
echo "A fatal MySQL error occured.\n
Query: " . $q_a_sql . "\nError: (" . 
mysql_error();

die;
}

  }
?>

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



[PHP] Re: Everything works...Unless they hit the "back" button...

2005-08-03 Thread Mark Rees
"Jack Jackson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi all. This has been an interesting week.
>
> Now the form works, and I am able to error check, if no errors look into
> user answer table and delete from that all q_ids matching the ones just
> picked, insert this page of question/answer info (q_id/a_id) into the
> user answer db, and if successful advance the category by 1 and get more
> questions. It works.
>
> I must have a logic error though because for some reason even though I
> say to delete matching  q_ids and reinsert, then move on, if the user
> hits the back button, changes answers and hits submit again, the table
> does not update . .  . and the category does not increment. We get stuck
> on this page of questions/answers forever.

Do you want to allow people to go back and chnage things ?

If so, write a suitable UPDATE statement

Sample UPDATE syntax

UPDATE table
SET field=1
WHERE field2='x'

You will probably want to check whether the answers already exist, use a
select statement for this. Unsure if this works in mysql, but

IF NOT EXISTS
(select id from table where field=1)
UPDATE table
SET field=1
WHERE field2='x'

might do the trick, or something similar will at any rate.

If you want to stop people going  back, check the referer (sic)
>
> What DOES happen after BACK is that the answers they select get passed
> back to error check (eg if they select a select box to nothing, error
> checking reenters its value into $message) and those values get passed
> back to the display page (eg $_POST[$qname] == $aid) because the
> "selected" answers change. It's just the db call and category advance
> which get stuck.

>
> Any help will be greatly appreciated - Here's the code:
>
>  //Start the session
> session_start();
> //Error announcements
> echo "POST:";
> print_r($_POST);
> echo "";
> echo "required session:";
> var_dump($_SESSION['required_fields']);
>
> echo "\$ cat:" . $cat . "";
> echo "\$message: ";
> var_dump($message);
>
> //error_reporting(E_ALL);
>
>
> /* A script to retrieve from database questions and answers,
>   * create a multi-page HTML form, error check answers and
>   * submit them to the database on a per-user basis.
>   * August 2005
>   */
>
> //Some basic vars
>   if (!isset($cat)) { $cat = "1"; }
> $error=0;
> $SUCCESS=0;
>
>
> if (!isset($message))
>  {
>  $message = array();
>  }
>
> if (!isset($_SESSION['required_fields']))
>  {
>  $_SESSION['required_fields'] = array();
>  }
>
> if(!sizeof($_POST))
> {
> include_once(QUESTIONS . 'q.inc');
>  }
>
>   //error checking
>
>   reset($_SESSION['required_fields']);
>foreach ($_SESSION['required_fields'] as $fieldname)
>  {
> if (!isset($_POST[$fieldname]) || empty($_POST[$fieldname]))
> {
>  $message[$fieldname]=1;
> }
>
>   }//error check
>if (!empty($message))
>{   $cat=$_POST['cat'];
>include_once(QUESTIONS . 'q.inc');
>}
>
> //No errors? Store what's been done so far
>
>if ( ($_POST['action'] == 'process') && (!sizeof($message) ) )
>{
>foreach($_POST as $key=>$val)
> {
> //find key/val sets within posts which are both
numeric
> if(is_numeric($key) && is_numeric($val))
> {
>$nkey=$key;
>//add keys to the qidlist
>$qidlist[] .= $key;
>//add these values ( q_id, a_id ) to sql statement
>$qanda[] .= "('1' , '" . $nkey . "' , '" . $val .
> "')";
> }
> //find key/val sets within sub-arrays of $_POST
> which are numeric
> if(is_array($val))
> {
> foreach ($val as $akey=>$aval)
> {
> //add these values ( q_id, a_id ) to sql
> statement
> $qanda[] .= "('1' , '" . $key . "' , '" .
> $aval . "')";
> var_dump($qanda);
> }
> }
> }
>
>
> $qidlist_sql="DELETE FROM $userAnswers WHERE q_id IN ("
> . (implode(",",$qidlist)) . ");";
>
> $q_a_sql="INSERT INTO $userAnswers (u_id, q_id, a_id )
>  VALUES " . (implode(",",$qanda)) . ";";
>
>   mysql_query($qidlist_sql);
>
>
>if($q_a_result = mysql_query($q_a_sql))
>  {
>unset($_SESSION['required_fields']);
>$cat = $_POST['cat']+1;
>include_once(QUESTIONS . 'q.inc');
>  }
>
>  else
>  {
>  echo "A fatal MySQL error occured.\n
>  Query: " . $q_a_sql . "\nError: (" .
> mysql_error();
> 

Re: [PHP] Re: Everything works...Unless they hit the "back" button...

2005-08-03 Thread Jack Jackson

Hi, mark,


Mark Rees wrote:
> Do you want to allow people to go back and change things ?
> If so, write a suitable UPDATE statement


Thanks, but I think the update function should be built in  -- the sql 
checks whether the userAnswer table contains the q_id the user has just 
entered; if so, it deletes the row containing it and then the second 
query inserts the new values.


   $qidlist_sql="DELETE FROM teresa WHERE q_id IN (" . 
(implode(",",$qidlist)) . ");"


   $q_a_sql="INSERT INTO teresa (u_id, q_id, a_id )
VALUES " . (implode(",",$qanda)) . ";";


I think there's something wrong with the logic of how I'm handling 
$_POST info and passing it back and forth: here's why: if I close the 
browser and reopen it and  refill the same questions, the answer table 
shows the updated answers. there's something in the logic I am using 
about how I am advancing the $cat and managing the $_POST information. I 
think . But I cannot find it.


Anyone?


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



RE: [PHP] AJAX & PHP

2005-08-03 Thread Miguel Guirao


Hey!!! What resources do you used to learn AJAX?

I saw a presentation about AJAX hosted by PHP Architect and I like it, but I
want to go deep in the subject, so far I have not found resources.

Thanks in advance!!

-Original Message-
From: Graham Anderson [mailto:[EMAIL PROTECTED]
Sent: Martes, 02 de Agosto de 2005 01:46 p.m.
To: php
Subject: Re: [PHP] AJAX & PHP


Has anyone integrated JPGraph [or another php graph class]  into a
PHP/AJAX setup ?

I would really like to integrate interactive graphs based upon user
variables.
Would be fantastic.
Are there any examples out there ?

g


Este mensaje es exclusivamente para el uso de la persona o entidad a quien esta 
dirigido; contiene informacion estrictamente confidencial y legalmente 
protegida, cuya divulgacion es sancionada por la ley. Si el lector de este 
mensaje no es a quien esta dirigido, ni se trata del empleado o agente 
responsable de esta informacion, se le notifica por medio del presente, que su 
reproduccion y distribucion, esta estrictamente prohibida. Si Usted recibio 
este comunicado por error, favor de notificarlo inmediatamente al remitente y 
destruir el mensaje. Todas las opiniones contenidas en este mail son propias 
del autor del mensaje y no necesariamente coinciden con las de Radiomovil 
Dipsa, S.A. de C.V. o alguna de sus empresas controladas, controladoras, 
afiliadas y subsidiarias. Este mensaje intencionalmente no contiene acentos.

This message is for the sole use of the person or entity to whom it is being 
sent.  Therefore, it contains strictly confidential and legally protected 
material whose disclosure is subject to penalty by law.  If the person reading 
this message is not the one to whom it is being sent and/or is not an employee 
or the responsible agent for this information, this person is herein notified 
that any unauthorized dissemination, distribution or copying of the materials 
included in this facsimile is strictly prohibited.  If you received this 
document by mistake please notify  immediately to the subscriber and destroy 
the message. Any opinions contained in this e-mail are those of the author of 
the message and do not necessarily coincide with those of Radiomovil Dipsa, 
S.A. de C.V. or any of its control, controlled, affiliates and subsidiaries 
companies. No part of this message or attachments may be used or reproduced in 
any manner whatsoever.

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



[PHP] Access and PHP

2005-08-03 Thread David Wills
I am looking for some resources to use my Access Databases with PHP, anyone 
have a good link?

David

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



Re: [PHP] Access and PHP

2005-08-03 Thread Rory Browne
I haven't used access with php(mainly due to the fact that I use php
on linux), but any access use I've seen so far was through OBDC(and
that was in phpBB). I suggest you consider both this, and dogging your
way through MS's COM docs.

On 8/3/05, David Wills <[EMAIL PROTECTED]> wrote:
> I am looking for some resources to use my Access Databases with PHP, anyone 
> have a good link?
> 
> David
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

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



Re: [PHP] Re: Everything works...Unless they hit the "back" button...

2005-08-03 Thread Kristen G. Thorson
The code below isn't much help to debug.  Do some checking to figure out 
how far into your IF statement you're getting.  Is the query running?  
Is it the query you expect?  (Step #1 when inserting or creating dynamic 
queries that aren't working: print them out to make sure they are what 
you think they are.)  Is the category being incremented?  You say you 
can go back, but you can't go forward.  Look at the page source, is the 
form action what it should be?  Look at the form hidden variables (if 
any) are they what you expect?



kgt



Jack Jackson wrote:


Hi, mark,


Mark Rees wrote:
> Do you want to allow people to go back and change things ?
> If so, write a suitable UPDATE statement


Thanks, but I think the update function should be built in  -- the sql 
checks whether the userAnswer table contains the q_id the user has 
just entered; if so, it deletes the row containing it and then the 
second query inserts the new values.


   $qidlist_sql="DELETE FROM teresa WHERE q_id IN (" . 
(implode(",",$qidlist)) . ");"


   $q_a_sql="INSERT INTO teresa (u_id, q_id, a_id )
VALUES " . (implode(",",$qanda)) . ";";


I think there's something wrong with the logic of how I'm handling 
$_POST info and passing it back and forth: here's why: if I close the 
browser and reopen it and  refill the same questions, the answer table 
shows the updated answers. there's something in the logic I am using 
about how I am advancing the $cat and managing the $_POST information. 
I think . But I cannot find it.


Anyone?




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



[PHP] Calculation error - PHP not following math hierarchi ???

2005-08-03 Thread Rene Brehmer
I've run into a situation where PHP is way off when doing a relatively
simple calculation of distance between two points in 2-dimensional space,
where coordinates go from 1 to 300 in both X and Y directions. When passing
300, it goes back to 1, and vise-versa (it's for a game and is supposed to
approximate the movement over a sphere).

Using this function:

function calc_distance($curX,$curY,$newX,$newY) {
  // calculate distance to new location
  $distX = abs($curX - $newX);
  $distY = abs($curY - $newY);
  
  if ($distX <= 150 && $distY <= 150) {
$dist = sqrt($distX^2 + $distY^2);
  } elseif ($distX > 150 && $distY <= 150) {
$dist = sqrt((abs(300 - $newX))^2 + $distY^2);
  } elseif ($distX <= 150 && $distY > 150) {
$dist = sqrt($distX^2 + (abs(300 - $newY))^2);
  } else {
$dist = sqrt((abs(300 - $newX))^2 + (abs(300 - $newY))^2);
  }
  
  return $dist;
}

And using 150,150 as $curX,$curY and 300,300 as $newX,$newY ... PHP
calculates $dist as 3.46410161514
which obviously is far off target ...referring to my calcultor, the correct
result for the same code is supposed to be 212.1320

What happens here ? And how the heck do I get to calculate right ?

Float errors usually isn't this severe, so I'm assuming it's a problem with
properly acknowledging the hierarchi of the mathematical operators ... 

It's PHP ver. 4.3.0, on Apache/2.0.53 (Win32), on WinXP SP1

I've been trying to manually calculate the formula out of order to figure
out how the strange result comes about, but haven't had any success yet ... 

Any suggestions ?

Rene
-- 
Rene Brehmer
aka Metalbunny

We have nothing to fear from free speech and free information on the
Internet, but pop-up advertising! 

http://metalbunny.net/
My little mess of things...

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



Re: [PHP] Re: Everything works...Unless they hit the "back" button...

2005-08-03 Thread Jack Jackson

Hi Kristen, there's a misunderstanding:

Kristen G. Thorson wrote:
The code below isn't much help to debug.  Do some checking to figure out 
how far into your IF statement you're getting.  Is the query running?  


Yes it runs successfully

Is it the query you expect?  


Yes it is perfect, and provided this is a new session and we're going 
forward page by page, it properly deletes from and inserts to the db as 
expected


(Step #1 when inserting or creating dynamic
queries that aren't working: print them out to make sure they are what 
you think they are.)  Is the category being incremented?


Yes, absolutely

You say you 
can go back, but you can't go forward.  


Actually no. In a new session, I can start and go forward page by page 
to the end of the questionnaire, advancing each stage perfectly, storing 
all values exactly as I'd expect.


The trouble starts if, during the process, the user hits the BACK 
button. At that point, user can reload the last page of questions, 
displaying the answers they gave. If the user makes changes, those 
changes get error checked but do not become part of the sql query. Also, 
user can not move forwards any more. So it's as the subject says - 
everything works...until they hit the back button, from which point the 
whole thing goes gablooey.


Look at the page source, is the

form action what it should be?


Yes

  Look at the form hidden variables (if

any) are they what you expect?
No. $cat remains what it was BEFORE the user hit the BACK button. 
However the questions dispayed are from the $cat which is in fact $cat-1


??!!

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



Re: [PHP] Access and PHP

2005-08-03 Thread tg-php
Just looked into this recently and here's a brief rundown of what I've found:

1. If you run PHP on a non-Windows system, your only option seems to be making 
a connection to a remote ODBC data source (hosted on a Windows machine 
presumably).  There was something..err..  ODBTP (?) that would work on linux to 
connect to remote ODBC connections

If you run PHP on a Windows server, then you have the following options:

2. ODBC connection via DSN
3. DSNLess connection (you can do this with a DB abstraction layer like ADODB)
4. COM connection (requires Access be installed on the server and, in my 
opinion, is the worst solution out of the group due to it's resource use)


There doesn't appear to be a good direct way to read Access files on a linux 
machine.  I may have come across a commercial Access driver ($$$) for linux, 
but can't remember.  If I did, I would have dismissed it fairly quickly as 
'free' is more my budget right now :)

If you need links to the stuff above, let me know and I'll try to dig up some.  
I also have a script I wrote using WinBinder and ADODB on a Windows box to hit 
an Access database, pull data, scrub it, then insert it into a MySQL database 
via ODBC.


-TG

= = = Original message = = =

I am looking for some resources to use my Access Databases with PHP, anyone 
have a good link?

David


___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

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



Re: [PHP] Regex help

2005-08-03 Thread Marcus Bointon

On 2 Aug 2005, at 15:12, Robin Vickery wrote:


I don't suppose this is the place for a rant about the futility of
checking email addresses with a regexp?


Though I will agree with you to some extent, I've had quite a lot of  
success with this, which is pretty thorough:


^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\- 
\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.)){0,61} 
[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-Z0-9]?)| 
(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4] 
\d|25[0-5])\]))$


Which I got from here:

http://www.hexillion.com/samples/#Regex

Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk

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



[PHP] Regular expressions book

2005-08-03 Thread Stefan Lemmen
Hi,

I've want to dig a bit deeper into regular expressions for php.
I wonder if anyone can help me choosing between 2 books I'm considering buying:

1. Open Source Regular Expression Recipes - Nathan A Good
2. Mastering Regular Expressions - Jeffrey Freidl

If your using/reading one of these books, please let me know which one
is best for PHP regex.

Thnx

Stefan Lemmen
Apeldoorn Holland

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



[Fwd: [PHP] varibles defination]

2005-08-03 Thread edwardspl
Dear you,

So, if I need to define a set of varibles ( two dimension array, eg :
$func[0,0] ) and via the varibles of form tag ( format, eg :
$_GET["varname"] or $_POST["varname"] ), how about the example sources ?

Thank for your help !

Edward.
--- Begin Message ---
> If I want to define and display a set of varibles, for example :
> $func1 = 0
> $func2 = 1
> $func3 = 2
> $func4 = 3
> $func5 = 4
> 
> How can we define and display the varibles by using for loop 
> function ?



This uses an array, so, in this case, your variables would be referenced as
$func[0]..$func[9].

JM

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

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

[PHP] Job for SQL or PHP?

2005-08-03 Thread -k.
Just for the sake of example let's say i keep track of all of a customers 
previous orders in a
table like this:

Last_Order
--
Cust_ID
Item_No
No_ordered

When a customer places an order i put the order details in an a table like this:

Orders
---
Order_ID
Cust_ID
Item_No
No_ordered


Let's say when my customer returns he decides he wants everything he ordered 
previously plus some
other stuff. Assuming this customer has unique customer ID of 345 and his 
current new order id is
678. Can i copy his last order into the orders table with just a SQL statement 
like:

INSERT INTO Orders VALUES ('678',(SELECT * FROM Last_Order WHERE Cust_ID = 
'678')) 

What i want to do is grab all the data from Last_Order associated with cust_id 
345 (or whatever)
and insert it into the Orders table with a Order_ID in this case 678. Let me 
know if this isn’t
clear. This SQL obviously doesn't work, however, my question is there a way to 
do this with SQL
alone? Or do i need to grab all the records from the Last_Order table loop 
through the record set
and insert each new row into Orders individually?



-k.

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Re: [PHP] Calculation error - PHP not following math hierarchi ???

2005-08-03 Thread Robin Vickery
On 8/3/05, Rene Brehmer <[EMAIL PROTECTED]> wrote:
> I've run into a situation where PHP is way off when doing a relatively
> simple calculation of distance between two points in 2-dimensional space,
> where coordinates go from 1 to 300 in both X and Y directions. When passing
> 300, it goes back to 1, and vise-versa (it's for a game and is supposed to
> approximate the movement over a sphere).
> 
> Using this function:
> 
> function calc_distance($curX,$curY,$newX,$newY) {
>   // calculate distance to new location
>   $distX = abs($curX - $newX);
>   $distY = abs($curY - $newY);
> 
>   if ($distX <= 150 && $distY <= 150) {
> $dist = sqrt($distX^2 + $distY^2);

I don't think you really want to do a bitwise xor there.

http://www.php.net/manual/en/language.operators.bitwise.php

Try pow() instead

http://www.php.net/manual/en/function.pow.php

-robin

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



[PHP] skip a row in foreach loop

2005-08-03 Thread [EMAIL PROTECTED]

I have a code

foreach($results as $key => $value)
{
   echo $key.': '. $value .'';
}

But, $value could be zero too.
How to skip printing on screen when $vlaue == 0?

I know I can do
foreach($results as $key => $value)
{
   if(!empty($value))
   {
   echo $key.': '. $value .'';
   }
}

but there is a tons of code lines inside the loop and was thingking is 
there any part in foreach function that can do that? something like:


foraech($results as $key => $value, skip(empty($value)))
{
   //
}

Tahnks.

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



Re: [PHP] skip a row in foreach loop

2005-08-03 Thread John Nichel

[EMAIL PROTECTED] wrote:

I have a code

foreach($results as $key => $value)
{
   echo $key.': '. $value .'';
}

But, $value could be zero too.
How to skip printing on screen when $vlaue == 0?

I know I can do
foreach($results as $key => $value)
{
   if(!empty($value))
   {
   echo $key.': '. $value .'';
   }
}


Is $results coming from a db?  Select only the rows which do not have a 
value of 0.


--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] skip a row in foreach loop

2005-08-03 Thread Chris Boget
but there is a tons of code lines inside the loop and was thingking is 
there any part in foreach function that can do that? something like:

foraech($results as $key => $value, skip(empty($value)))
{
   //
}


'continue' is your friend.

http://us3.php.net/manual/en/control-structures.continue.php

thnx,
Chris

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



Re: [PHP] skip a row in foreach loop

2005-08-03 Thread Stut

[EMAIL PROTECTED] wrote:

I have a code

foreach($results as $key => $value)
{
   echo $key.': '. $value .'';
}

But, $value could be zero too.
How to skip printing on screen when $vlaue == 0?


foreach($results as $key => $value)
{
   if ($value == 0) continue;
   echo $key.': '. $value .'';
}

-Stut

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



Re: [PHP] Calculation error - PHP not following math hierarchi ???

2005-08-03 Thread Kristen G. Thorson

See

http://us3.php.net/manual/en/language.operators.php
http://us3.php.net/manual/en/language.operators.bitwise.php


You want this:

function calc_distance($curX,$curY,$newX,$newY) {
 // calculate distance to new location
 $distX = abs($curX - $newX);
 $distY = abs($curY - $newY);

 if ($distX <= 150 && $distY <= 150) {
   $dist = sqrt(pow( $distX,2) + pow($distY,2));
 } elseif ($distX > 150 && $distY <= 150) {
   $dist = sqrt(pow((abs(300 - $newX)),2) + pow($distY,2));
 } elseif ($distX <= 150 && $distY > 150) {
   $dist = sqrt(pow($distX,2) + pow((abs(300 - $newY)),2));
 } else {
   $dist = sqrt(pow((abs(300 - $newX)),2) + pow((abs(300 - $newY)),2));
 }

 return $dist;
}

echo calc_distance( 150, 150, 300, 300 );  //echoes 212.13203435596
echo "150^2=".(150^2)." and pow(150,2)=".(pow(150,2));  //echoes 
150^2=148 and pow(150,2)=22500





kgt




Rene Brehmer wrote:


I've run into a situation where PHP is way off when doing a relatively
simple calculation of distance between two points in 2-dimensional space,
where coordinates go from 1 to 300 in both X and Y directions. When passing
300, it goes back to 1, and vise-versa (it's for a game and is supposed to
approximate the movement over a sphere).

Using this function:

function calc_distance($curX,$curY,$newX,$newY) {
 // calculate distance to new location
 $distX = abs($curX - $newX);
 $distY = abs($curY - $newY);
 
 if ($distX <= 150 && $distY <= 150) {

   $dist = sqrt($distX^2 + $distY^2);
 } elseif ($distX > 150 && $distY <= 150) {
   $dist = sqrt((abs(300 - $newX))^2 + $distY^2);
 } elseif ($distX <= 150 && $distY > 150) {
   $dist = sqrt($distX^2 + (abs(300 - $newY))^2);
 } else {
   $dist = sqrt((abs(300 - $newX))^2 + (abs(300 - $newY))^2);
 }
 
 return $dist;

}

And using 150,150 as $curX,$curY and 300,300 as $newX,$newY ... PHP
calculates $dist as 3.46410161514
which obviously is far off target ...referring to my calcultor, the correct
result for the same code is supposed to be 212.1320

What happens here ? And how the heck do I get to calculate right ?

Float errors usually isn't this severe, so I'm assuming it's a problem with
properly acknowledging the hierarchi of the mathematical operators ... 


It's PHP ver. 4.3.0, on Apache/2.0.53 (Win32), on WinXP SP1

I've been trying to manually calculate the formula out of order to figure
out how the strange result comes about, but haven't had any success yet ... 


Any suggestions ?

Rene
 



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



Re: [PHP] skip a row in foreach loop

2005-08-03 Thread [EMAIL PROTECTED]
Yes, it comes fro DB, but, quesry is alerady "to complex" (for me :)) 
with union, joint, ... and expanding with something else ill take 
additional few hours to figure it out.


And, Stut's and Chris' "continue" solution sound perfect for me :)

Thanks guys on such a fast respond!

-afan




John Nichel wrote:


[EMAIL PROTECTED] wrote:


I have a code

foreach($results as $key => $value)
{
   echo $key.': '. $value .'';
}

But, $value could be zero too.
How to skip printing on screen when $vlaue == 0?

I know I can do
foreach($results as $key => $value)
{
   if(!empty($value))
   {
   echo $key.': '. $value .'';
   }
}



Is $results coming from a db?  Select only the rows which do not have 
a value of 0.




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



Re: [PHP] Job for SQL or PHP?

2005-08-03 Thread Kristen G. Thorson

Try

INSERT INTO Orders (SELECT '678',Cust_ID,Item_No,No_ordered FROM 
Last_Order WHERE Cust_ID = '678')




kgt




-k. wrote:


Just for the sake of example let's say i keep track of all of a customers 
previous orders in a
table like this:

Last_Order
--
Cust_ID
Item_No
No_ordered

When a customer places an order i put the order details in an a table like this:

Orders
---
Order_ID
Cust_ID
Item_No
No_ordered


Let's say when my customer returns he decides he wants everything he ordered 
previously plus some
other stuff. Assuming this customer has unique customer ID of 345 and his 
current new order id is
678. Can i copy his last order into the orders table with just a SQL statement 
like:

INSERT INTO Orders VALUES ('678',(SELECT * FROM Last_Order WHERE Cust_ID = '678')) 


What i want to do is grab all the data from Last_Order associated with cust_id 
345 (or whatever)
and insert it into the Orders table with a Order_ID in this case 678. Let me 
know if this isn’t
clear. This SQL obviously doesn't work, however, my question is there a way to 
do this with SQL
alone? Or do i need to grab all the records from the Last_Order table loop 
through the record set
and insert each new row into Orders individually?



-k.

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

 



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



Re: [PHP] AJAX & PHP

2005-08-03 Thread Graham Anderson

not a whole lot of info on the subject for working with graph classes :(
at least at this point


g



On Aug 3, 2005, at 7:05 AM, Miguel Guirao wrote:



Hey!!! What resources do you used to learn AJAX?

I saw a presentation about AJAX hosted by PHP Architect and I like it, 
but I

want to go deep in the subject, so far I have not found resources.

Thanks in advance!!

-Original Message-
From: Graham Anderson [mailto:[EMAIL PROTECTED]
Sent: Martes, 02 de Agosto de 2005 01:46 p.m.
To: php
Subject: Re: [PHP] AJAX & PHP


Has anyone integrated JPGraph [or another php graph class]  into a
PHP/AJAX setup ?

I would really like to integrate interactive graphs based upon user
variables.
Would be fantastic.
Are there any examples out there ?

g


Este mensaje es exclusivamente para el uso de la persona o entidad a 
quien esta dirigido; contiene informacion estrictamente confidencial y 
legalmente protegida, cuya divulgacion es sancionada por la ley. Si el 
lector de este mensaje no es a quien esta dirigido, ni se trata del 
empleado o agente responsable de esta informacion, se le notifica por 
medio del presente, que su reproduccion y distribucion, esta 
estrictamente prohibida. Si Usted recibio este comunicado por error, 
favor de notificarlo inmediatamente al remitente y destruir el mensaje. 
Todas las opiniones contenidas en este mail son propias del autor del 
mensaje y no necesariamente coinciden con las de Radiomovil Dipsa, S.A. 
de C.V. o alguna de sus empresas controladas, controladoras, afiliadas 
y subsidiarias. Este mensaje intencionalmente no contiene acentos.


This message is for the sole use of the person or entity to whom it is 
being sent.  Therefore, it contains strictly confidential and legally 
protected material whose disclosure is subject to penalty by law.  If 
the person reading this message is not the one to whom it is being sent 
and/or is not an employee or the responsible agent for this 
information, this person is herein notified that any unauthorized 
dissemination, distribution or copying of the materials included in 
this facsimile is strictly prohibited.  If you received this document 
by mistake please notify  immediately to the subscriber and destroy the 
message. Any opinions contained in this e-mail are those of the author 
of the message and do not necessarily coincide with those of Radiomovil 
Dipsa, S.A. de C.V. or any of its control, controlled, affiliates and 
subsidiaries companies. No part of this message or attachments may be 
used or reproduced in any manner whatsoever.


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



Re: [PHP] Job for SQL or PHP?

2005-08-03 Thread -k.
--- "Kristen G. Thorson" <[EMAIL PROTECTED]> wrote:
> Try
> 
> INSERT INTO Orders (SELECT '678',Cust_ID,Item_No,No_ordered FROM 
> Last_Order WHERE Cust_ID = '678')

Thanks that nailed it. You rock.



-k. 


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Re: [PHP] AJAX & PHP

2005-08-03 Thread Mikey

Graham Anderson wrote:


not a whole lot of info on the subject for working with graph classes :(
at least at this point


g

Surely it would be much simpler to just use have javascript to set a 
placed image to a new (or the same) location - this image is then 
generated by JPGraph et al with no modification to code.  I have been 
using this technique for years to make server calls without page 
refreshing.  (Well, that or an invisible frame/iframe/layer)


HTH,

Mikey

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



Re: [PHP] Sessions Issue

2005-08-03 Thread Tom Ray [Lists]
Yeah, I thought about that. But to be honest, I don't know how to 
recompile with builds from the CD/rpms. This is the first time I've ever 
done it this way. So if I get the latest RPM and install it it should 
activate session right? And then I just need to restart apache2 and I 
should be good?


Burhan Khalid wrote:



On Jul 29, 2005, at 8:07 PM, Tom Ray [Lists] wrote:

We built a box about 7 months or so ago using the SuSE 9.1 cd's,  
straight install from the CDs. While I've read that sessions are  
turned on by default, when we try to call on the sessions functions  
(like with phpOpenChat or start_session()) we get calls to  undefined 
function errors. This is leading me to belive that  sessions are 
disabled for some reason. I need to enable the  sessions so I have a 
few questions


1) Can I do this without recompiling?
2) If I can't, how do I recompile this since I used the SuSE cds?

It's SuSE 9.1 running Php 4.3.4 with APache 2.0.49



I don't *think* there is a separate module/rpm for sessions, so you  
are off to a recompile job.


While you are it, upgrade your PHP to the latest stable version.  
4.3.4 is quite old.  Maybe there is a new package for SuSE that does  
it? (not really familiar with SuSE).


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



Re: [PHP] Sessions Issue

2005-08-03 Thread Tom Ray [Lists]
Again, this won't affect anything since I installed from the CD's and 
I've always noticed that things installed via CD/rpm have different 
install paths then source. I'm worried it will look in the wrong spot 
for Apache...but that could be a un-needed worry.


Rory Browne wrote:


On 7/29/05, Tom Ray [Lists] <[EMAIL PROTECTED]> wrote:
 


We built a box about 7 months or so ago using the SuSE 9.1 cd's,
straight install from the CDs. While I've read that sessions are turned
on by default, when we try to call on the sessions functions (like with
phpOpenChat or start_session()) we get calls to undefined function
errors. This is leading me to belive that sessions are disabled for some
reason. I need to enable the sessions so I have a few questions

1) Can I do this without recompiling?
   



Don't know - Don't have SuSE

 


2) If I can't, how do I recompile this since I used the SuSE cds?
   



Head to www.php.net and hit the downloads section. 


unArchive the source, and type ./configure --help to get a list of the
compilabel extensions. Once you're done, you can ./configure
--with-this --without-that --enable this-thing --disable-that-thing

The compile instructions(a file called INSTALL AFAIR) and the PHP
manual are among the best docs I've ever seen.

 


It's SuSE 9.1 running Php 4.3.4 with APache 2.0.49

any help would be great!

Thanks!

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


   



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



Re: [PHP] Regular expressions book

2005-08-03 Thread Edward Vermillion

Stefan Lemmen wrote:

Hi,

I've want to dig a bit deeper into regular expressions for php.
I wonder if anyone can help me choosing between 2 books I'm considering buying:

1. Open Source Regular Expression Recipes - Nathan A Good
2. Mastering Regular Expressions - Jeffrey Freidl

If your using/reading one of these books, please let me know which one
is best for PHP regex.

Thnx

Stefan Lemmen
Apeldoorn Holland



Haven't read the first, but the second is very good. It really helped me 
to grasp the concepts of regex.


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



[PHP] ftp_put(), move_uploaded_file() problem

2005-08-03 Thread tripwater
Hello, I have a site that allows developers to upload current modules to 
the webserver. It has been requested that when this is done, I also ftp a 
backup copy to a remote server. Something is wrong here. The file upload 
code works. The back ftp code works,only  if I comment out the 
move_uploaded_file() function. I can not get them both to work. After the 
move_uploaded_file() function moves the file to the webserver, the 
ftp_put() fails, but if I comment out the move_uploaded_file(), the 
ftp_put() works. Can anyone help me with this? I have posted this on other 
forums and working on this for a couple of weeks now. 



1. I am uploading the module to the webserver. 
2. Then in the next step want to ftp same module to backup server. 

So Step 1 
Code: 

$path= "../modules"; 

if (!is_dir($path)) 
  mkdir($path,0700);   
   
   
if (!move_uploaded_file($_FILES['srcfile']['tmp_name'], 
$path."/".strtolower(trim($_FILES['srcfile']['name'] 



Which works. THis uploads the module to the webserver to the set location 



then Step 2 

Code: 

$ftp = ftp_connect('server goes here'); 

 
// login with username and password 
if (ftp_login($ftp, 'username', 'password')) 
  { 
  ftp_pasv ( $ftp, true ); 



  if (ftp_put($ftp, "public_html/temp/" . $_FILES['srcfile']['name'], 
$_FILES['srcfile']['tmp_name'], FTP_BINARY)) 
 { 
 $message = "File uploaded"; 
 } 
 else 
 { 
 die("Could not upload file"); 
 } 
  } 
else 
  { 
  die("Could not login to FTP account"); 
  } 

if (!empty($message)) 
  { 
  echo $message; 
  } 
 
// close the FTP stream 
ftp_close($ftp); 




The only way this second FTP code works is if I comment out the first 
upload code, 
Code: 

$path= "../modules"; 

if (!is_dir($path)) 
  mkdir($path,0700);   
   
   
//if (!move_uploaded_file($_FILES['srcfile']['tmp_name'], 
$path."/".strtolower(trim($_FILES['srcfile']['name'] 



Can anyone tell me if the problem is a ftp stream being left open and that 
is why I can not get the second portion of my code to work? Is there a way 
to get both of these to work together? I need not only to be able to 
upload to the webserver but ftp a backup copy to the remote server as 
well. 

Thank you for any help. 


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



[PHP] ftp problems

2005-08-03 Thread tripwater
Hello, I have a site that allows developers to upload current modules to 
the webserver. It has been requested that when this is done, I also ftp a 
backup copy to a remote server. Something is wrong here. The file upload 
code works. The back ftp code works,only  if I comment out the 
move_uploaded_file() function. I can not get them both to work. After the 
move_uploaded_file() function moves the file to the webserver, the 
ftp_put() fails, but if I comment out the move_uploaded_file(), the 
ftp_put() works. Can anyone help me with this? I have posted this on other 
forums and working on this for a couple of weeks now. 



1. I am uploading the module to the webserver. 
2. Then in the next step want to ftp same module to backup server. 

I tried posting my code but it got rejected by the server for security 
reasons...


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



[PHP] Write from form to DB

2005-08-03 Thread George B

Ok, I got this far.

include("config.php");
$username = $_GET['name'];
$password = $_GET['pword'];
echo "Username = " . $username . "";
echo "Password = " . $password . "";
$query = "INSERT INTO user (name,password) VALUES ($username","$password")
$result = mysql_query($query)


config is just all the info to connect to server. i have to forms. name 
which is a for for entering username, and pword for entering password. I 
 would like it so that when I enter the info for the forms, it puts all 
the data that I entered into a database. In this case I THOUGHT this


$query = "INSERT INTO user (name,password) VALUES ($username","$password")

would do the job but, it dosent. It gives a


Parse error: syntax error, unexpected T_VARIABLE in C:\Program 
Files\Apache Group\Apache2\htdocs\php\login\registration_action.php on 
line 15


How do I fix this, and make it send the data from the form, into the 
database?


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



Re: [PHP] AJAX & PHP

2005-08-03 Thread Graham Anderson

is there an example of this somewhere ?
Google does not come up with much.
I have seen simple AJAX examples...but none related to graphing classes.

I am a bit new at combining php with javascript with regards to image 
creation.


basically, I want the user to enter variables and have a graph 
generated without a full page reload on the same page...

kind of an  interactive graphing web  tool.

any examples  of this sort are appreciated  :)
g


On Aug 3, 2005, at 9:36 AM, Mikey wrote:

Graham Anderson wrote:

not a whole lot of info on the subject for working with graph classes 
:(

at least at this point


g

Surely it would be much simpler to just use have javascript to set a 
placed image to a new (or the same) location - this image is then 
generated by JPGraph et al with no modification to code.  I have been 
using this technique for years to make server calls without page 
refreshing.  (Well, that or an invisible frame/iframe/layer)


HTH,

Mikey

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

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



RE: [PHP] ftp problems

2005-08-03 Thread Jay Blanchard
[snip]
Hello, I have a site that allows developers to upload current modules to

the webserver. It has been requested that when this is done, I also ftp
a 
backup copy to a remote server. Something is wrong here. The file upload

code works. The back ftp code works,only  if I comment out the 
move_uploaded_file() function. I can not get them both to work. After
the 
move_uploaded_file() function moves the file to the webserver, the 
ftp_put() fails, but if I comment out the move_uploaded_file(), the 
ftp_put() works. Can anyone help me with this? I have posted this on
other 
forums and working on this for a couple of weeks now. 
[snip]

And now you have posted it here twice within 30 minutes under different
headers.

[snip]
1. I am uploading the module to the webserver. 
2. Then in the next step want to ftp same module to backup server. 
[/snip]

Looks like a pretty good flowchart. move_uploaded_file() is part of the
upload process. Then you want to ftp the file from where you moved it to
with your ftp process. move_uploaded_file() is not part of ftp

[snip]
I tried posting my code but it got rejected by the server for security 
reasons...
[/snip]

Cut and paste your code into the e-mail, attachments to lists aren't
generally welcomed.

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



RE: [PHP] Write from form to DB

2005-08-03 Thread Jim Moseby
> Ok, I got this far.
> 
> include("config.php");
> $username = $_GET['name'];
> $password = $_GET['pword'];
> echo "Username = " . $username . "";
> echo "Password = " . $password . "";
> $query = "INSERT INTO user (name,password) VALUES 
> ($username","$password")
> $result = mysql_query($query)
> 
> 
> config is just all the info to connect to server. i have to 
> forms. name 
> which is a for for entering username, and pword for entering 
> password. I 
>   would like it so that when I enter the info for the forms, 
> it puts all 
> the data that I entered into a database. In this case I THOUGHT this
> 
> $query = "INSERT INTO user (name,password) VALUES 
> ($username","$password")
> 
> would do the job but, it dosent. It gives a
> 
> 
> Parse error: syntax error, unexpected T_VARIABLE in C:\Program 
> Files\Apache 
> Group\Apache2\htdocs\php\login\registration_action.php on 
> line 15
> 
> How do I fix this, and make it send the data from the form, into the 
> database?
> 

We're missing some semicolons there on the $query and the $result lines,
aren't we?

JM

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



RE: [PHP] Write from form to DB

2005-08-03 Thread Jay Blanchard
[snip]
$query = "INSERT INTO user (name,password) VALUES
($username","$password")

would do the job but, it dosent. It gives a

Parse error: syntax error, unexpected T_VARIABLE in C:\Program 
Files\Apache Group\Apache2\htdocs\php\login\registration_action.php on 
line 15
[/snip]

$query = "INSERT INTO user (name,password) VALUES
("'.$username.'","'.$password.'") ";

Try that... should work. your query syntax is mangled.

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



RE: [PHP] Access and PHP

2005-08-03 Thread Nathan Tobik
Have you checked out FreeTDS?  We use FreeTDS to connect PHP on Linux to
SQL Server 2000.  Best of luck.

Nate Tobik
(412)661-5700 x206
VigilantMinds

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 03, 2005 10:47 AM
To: php-general@lists.php.net
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Access and PHP

Just looked into this recently and here's a brief rundown of what I've
found:

1. If you run PHP on a non-Windows system, your only option seems to be
making a connection to a remote ODBC data source (hosted on a Windows
machine presumably).  There was something..err..  ODBTP (?) that would
work on linux to connect to remote ODBC connections

If you run PHP on a Windows server, then you have the following options:

2. ODBC connection via DSN
3. DSNLess connection (you can do this with a DB abstraction layer like
ADODB)
4. COM connection (requires Access be installed on the server and, in my
opinion, is the worst solution out of the group due to it's resource
use)


There doesn't appear to be a good direct way to read Access files on a
linux machine.  I may have come across a commercial Access driver ($$$)
for linux, but can't remember.  If I did, I would have dismissed it
fairly quickly as 'free' is more my budget right now :)

If you need links to the stuff above, let me know and I'll try to dig up
some.  I also have a script I wrote using WinBinder and ADODB on a
Windows box to hit an Access database, pull data, scrub it, then insert
it into a MySQL database via ODBC.


-TG

= = = Original message = = =

I am looking for some resources to use my Access Databases with PHP,
anyone have a good link?

David


___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

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

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



Re: [PHP] Write from form to DB

2005-08-03 Thread George B

Jay Blanchard wrote:

[snip]
$query = "INSERT INTO user (name,password) VALUES
($username","$password")

would do the job but, it dosent. It gives a

Parse error: syntax error, unexpected T_VARIABLE in C:\Program 
Files\Apache Group\Apache2\htdocs\php\login\registration_action.php on 
line 15

[/snip]

$query = "INSERT INTO user (name,password) VALUES
("'.$username.'","'.$password.'") ";

Try that... should work. your query syntax is mangled.


Nope, now it gives


Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in 
C:\Program Files\Apache 
Group\Apache2\htdocs\php\login\registration_action.php on line 15


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



RE: [PHP] Write from form to DB

2005-08-03 Thread Jay Blanchard
[snip]
>[snip]
>$query = "INSERT INTO user (name,password) VALUES
>($username","$password")
>
>would do the job but, it dosent. It gives a
>
>Parse error: syntax error, unexpected T_VARIABLE in C:\Program 
>Files\Apache Group\Apache2\htdocs\php\login\registration_action.php on 
>line 15
>[/snip]
>
>$query = "INSERT INTO user (name,password) VALUES
>("'.$username.'","'.$password.'") ";
>
>Try that... should work. your query syntax is mangled.
>
>  
>
Nope, now it gives this

*Parse error*: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in 
*C:\Program Files\Apache 
Group\Apache2\htdocs\php\login\registration_action.php* on line *15*
[/snip]

Add a semi-colon at the end of your $result line. And alweays hit
reply-all.

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



[PHP] Event Registration Software?

2005-08-03 Thread aaronjw
Hey guys,

Sorry for the OT but I'm having difficulty with this.

Client wants us to develop an event registration system for their company
(multiple events) with the ability to accept credit card payments.

Just wondering if there is a PHP solution already available - paid or
opensource - that someone knows of?

Thanks in advance!

Aaron

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



Re: [PHP] Write from form to DB

2005-08-03 Thread Richard Davey
Hello George,

Wednesday, August 3, 2005, 6:50:07 PM, you wrote:

GB> $query = "INSERT INTO user (name,password) VALUES ($username","$password")

$query = "INSERT INTO user (name, password) VALUES ('$username',
'$password')";

And don't forget to validate your user input before slamming it
directly into your database.

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 Zend Certified Engineer
 "I do not fear computers. I fear the lack of them." - Isaac Asimov

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



[PHP] preg_replace single quote

2005-08-03 Thread Paul Nowosielski
Hi All,

 I'm trying to strip single quotes using preg_replace() with no luck.
Can someone give me some advice on achieving this?

TIA!

-- 
Paul Nowosielski

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



Re: [PHP] Write from form to DB

2005-08-03 Thread John Nichel

George B wrote:

Ok, I got this far.

include("config.php");
$username = $_GET['name'];
$password = $_GET['pword'];
echo "Username = " . $username . "";
echo "Password = " . $password . "";
$query = "INSERT INTO user (name,password) VALUES ($username","$password")
$result = mysql_query($query)


config is just all the info to connect to server. i have to forms. name 
which is a for for entering username, and pword for entering password. I 
 would like it so that when I enter the info for the forms, it puts all 
the data that I entered into a database. In this case I THOUGHT this


$query = "INSERT INTO user (name,password) VALUES ($username","$password")


Your query is mis-quotes and missing the semi-colon.

$query = "INSERT INTO user (name,password) VALUES ('$username', 
'$password')";



would do the job but, it dosent. It gives a


Parse error: syntax error, unexpected T_VARIABLE in C:\Program 
Files\Apache Group\Apache2\htdocs\php\login\registration_action.php on 
line 15


How do I fix this, and make it send the data from the form, into the 
database?





--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] Write from form to DB

2005-08-03 Thread John Nichel

Jay Blanchard wrote:

[snip]
$query = "INSERT INTO user (name,password) VALUES
($username","$password")

would do the job but, it dosent. It gives a

Parse error: syntax error, unexpected T_VARIABLE in C:\Program 
Files\Apache Group\Apache2\htdocs\php\login\registration_action.php on 
line 15

[/snip]

$query = "INSERT INTO user (name,password) VALUES
("'.$username.'","'.$password.'") ";

Try that... should work. your query syntax is mangled.



Backwards on your quotes Jay.  Go home and get some sleep. ;)

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

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



RE: [PHP] ftp problems

2005-08-03 Thread Jay Blanchard
[snip]
What is top-post? and also, how can I show you my code is I can not send
it
in the email? DO I need to attach it?
[/snip]


Top posting is posting your reply above the message. It makes the
subject read out of order.

Because it is backwards.
Why?
Top posting is bad.

Cut and paste your code into the e-mail. Only cut and paste the relevant
section of code.

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



RE: [PHP] Write from form to DB

2005-08-03 Thread Jay Blanchard
[snip]
> $query = "INSERT INTO user (name,password) VALUES
> ("'.$username.'","'.$password.'") ";
> 
> Try that... should work. your query syntax is mangled.
> 

Backwards on your quotes Jay.  Go home and get some sleep. ;)
[/snip]

Damn these corporate mergers!

Corrected query

$query = "INSERT INTO user (name,password) VALUES
('".$username."','".$password."') ";

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



RE: [PHP] Write from form to DB

2005-08-03 Thread Jim Moseby
> [snip]
> > $query = "INSERT INTO user (name,password) VALUES
> > ("'.$username.'","'.$password.'") ";
> > 
> > Try that... should work. your query syntax is mangled.
> > 
> 
> Backwards on your quotes Jay.  Go home and get some sleep. ;)
> [/snip]
> 
> Damn these corporate mergers!
> 
> Corrected query
> 
> $query = "INSERT INTO user (name,password) VALUES
> ('".$username."','".$password."') ";

Why not:

$query = "INSERT INTO user (name,password) VALUES>
('$username','$password')";

...?

JM

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



RE: [PHP] Write from form to DB

2005-08-03 Thread Jim Moseby
> > [snip]
> > > $query = "INSERT INTO user (name,password) VALUES
> > > ("'.$username.'","'.$password.'") ";
> > > 
> > > Try that... should work. your query syntax is mangled.
> > > 
> > 
> > Backwards on your quotes Jay.  Go home and get some sleep. ;)
> > [/snip]
> > 
> > Damn these corporate mergers!
> > 
> > Corrected query
> > 
> > $query = "INSERT INTO user (name,password) VALUES
> > ('".$username."','".$password."') ";
> 
> Why not:
> 
> $query = "INSERT INTO user (name,password) VALUES>
> ('$username','$password')";
> 

Or:

$query = "INSERT INTO user (name,password) VALUES('$username','$password')";

...rather.

JM

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



Re: [PHP] Calculation error - PHP not following math hierarchi ???

2005-08-03 Thread Rene Brehmer
Documented research indicate that on Wed, 3 Aug 2005 16:38:08 +0100, Robin
Vickery wrote:

> On 8/3/05, Rene Brehmer <[EMAIL PROTECTED]> wrote:
>> Using this function:
>> 
>> function calc_distance($curX,$curY,$newX,$newY) {
>>   // calculate distance to new location
>>   $distX = abs($curX - $newX);
>>   $distY = abs($curY - $newY);
>> 
>>   if ($distX <= 150 && $distY <= 150) {
>> $dist = sqrt($distX^2 + $distY^2);
> 
> I don't think you really want to do a bitwise xor there.
> 
> http://www.php.net/manual/en/language.operators.bitwise.php
> 
> Try pow() instead
> 
> http://www.php.net/manual/en/function.pow.php

Thanks. I didn't know it was a bitwise operator ... Was trying to find the
right way to go about it in the manual, but when you don't know what it's
called in English, it's a bit of a problem ... and since the Danish version
of the manual isn't up to date, I don't really use it...

But thanks, looks like what I want ... thank you...


Rene

-- 
Rene Brehmer
aka Metalbunny

We have nothing to fear from free speech and free information on the
Internet, but pop-up advertising! 

http://metalbunny.net/
My little mess of things...

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



RE: [PHP] Write from form to DB

2005-08-03 Thread Jay Blanchard
[snip]
Why not:

$query = "INSERT INTO user (name,password) VALUES>
('$username','$password')";
[/snip]

You could do that. The reason that I don't is because of the mixing of
quote types.

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



Re: [PHP] preg_replace single quote

2005-08-03 Thread Psystorm

Paul Nowosielski wrote:


Hi All,

I'm trying to strip single quotes using preg_replace() with no luck.
Can someone give me some advice on achieving this?

TIA!

 


$string = preg_replace('/\'/', '', $string);

should work fine

Kind regards,
Thomas Obermüller

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



Re: [PHP] Write from form to DB

2005-08-03 Thread George B

Jim Moseby wrote:

[snip]


$query = "INSERT INTO user (name,password) VALUES
("'.$username.'","'.$password.'") ";

Try that... should work. your query syntax is mangled.



Backwards on your quotes Jay.  Go home and get some sleep. ;)
[/snip]

Damn these corporate mergers!

Corrected query

$query = "INSERT INTO user (name,password) VALUES
('".$username."','".$password."') ";


Why not:

$query = "INSERT INTO user (name,password) VALUES>
('$username','$password')";




Or:

$query = "INSERT INTO user (name,password) VALUES('$username','$password')";

...rather.

JM


It does not seem to be putting anything into the DB. Gives no errors, 
but I check PHP My Admin, and there is nothing in the users and 
passwords field. I think something isnt working hmmm


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



[PHP] syntax highlighting your php code on a web page

2005-08-03 Thread Steve Turnbull
Hi

Is there a class or some code out there which enables you to print your
PHP code to a web page and make it appear with syntax highlighting?

As an example of what I am after, have a look here;

http://www.phpfreaks.com/phpmanual/page/function.ldap-add.html

Please note this is just an example page which highlights what I am after...

Thanks
Steve

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



RE: [PHP] Write from form to DB

2005-08-03 Thread Jay Blanchard
[snip]
It does not seem to be putting anything into the DB. Gives no errors, 
but I check PHP My Admin, and there is nothing in the users and 
passwords field. I think something isnt working hmmm
[/snip]

There is a brilliant statement if there ever was one! ROFLMMFAO!

Does the mysql user you are using for this little drill have permission
to do inserts?

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



RE: [PHP] syntax highlighting your php code on a web page

2005-08-03 Thread Jay Blanchard
[snip]
Is there a class or some code out there which enables you to print your
PHP code to a web page and make it appear with syntax highlighting?

As an example of what I am after, have a look here;

http://www.phpfreaks.com/phpmanual/page/function.ldap-add.html

Please note this is just an example page which highlights what I am
after...
[/snip]

http://us2.php.net/highlight_file

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



RE: [PHP] Write from form to DB

2005-08-03 Thread Jim Moseby
> [snip]
> Why not:
> 
> $query = "INSERT INTO user (name,password) VALUES>
> ('$username','$password')";
> [/snip]
> 
> You could do that. The reason that I don't is because of the mixing of
> quote types.

So, is that a "Really Bad Thing(tm)", or is it just bad form?  If the
former, why?

JM
 

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



Re: [PHP] Write from form to DB

2005-08-03 Thread George B

Jay Blanchard wrote:

[snip]
It does not seem to be putting anything into the DB. Gives no errors, 
but I check PHP My Admin, and there is nothing in the users and 
passwords field. I think something isnt working hmmm

[/snip]

There is a brilliant statement if there ever was one! ROFLMMFAO!

Does the mysql user you are using for this little drill have permission
to do inserts?


Yeah I am using "root" which has all permissions

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



RE: [PHP] Write from form to DB

2005-08-03 Thread Jay Blanchard
[snip]
Jay Blanchard wrote:
> [snip]
> It does not seem to be putting anything into the DB. Gives no errors, 
> but I check PHP My Admin, and there is nothing in the users and 
> passwords field. I think something isnt working hmmm
> [/snip]
> 
> There is a brilliant statement if there ever was one! ROFLMMFAO!
> 
> Does the mysql user you are using for this little drill have
permission
> to do inserts?

Yeah I am using "root" which has all permissions
[/snip]

Are you sure? Did you specifically GRANT ALL to root? When you did, did
you flush the permissions? BTW, using root is a Bad Idead[tm].

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



RE: [PHP] Write from form to DB

2005-08-03 Thread Jay Blanchard
[snip]
So, is that a "Really Bad Thing(tm)", or is it just bad form?  If the
former, why?
[/snip]

I personally think it is just bad form. I also know that it can make
trouble-shooting a bear sometimes.

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



RE: [PHP] Write from form to DB

2005-08-03 Thread Jay Blanchard
[snip]
Yeah I am using "root" which has all permissions
[/snip]

Are you sure? Did you specifically GRANT ALL to root? When you did, did
you flush the permissions? BTW, using root is a Bad Idead[tm].
[/snip]

Also, check the mysql error log
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

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



Re: [PHP] Write from form to DB

2005-08-03 Thread George B

Jay Blanchard wrote:

[snip]
Yeah I am using "root" which has all permissions
[/snip]

Are you sure? Did you specifically GRANT ALL to root? When you did, did
you flush the permissions? BTW, using root is a Bad Idead[tm].
[/snip]

Also, check the mysql error log

Never mind guys! I got it working!

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



[PHP] Reference problem... (got bounced from php.bugs #33984)

2005-08-03 Thread Andrey Nikolaev
I'm not php noobie, but still can't understand this behaviour of references.
Anybody can show me where the hell is it documented ?
Or show any logical conclusions why is it act like this... Just anything.

Thanks.

Description:

See reproduce code.


Reproduce code:
---
a = new A;
$this->b =& $this->a;
}
}
$rt = new RefTest();
var_dump($rt);
?>


Expected result:

object(reftest)(2) {
  ["a"]=>
  object(a)(0) {
  }
  ["b"]=>
  &object(a)(0) {
  }
}

Actual result:
--
object(reftest)(2) {
  ["a"]=>
  &object(a)(0) {
  }
  ["b"]=>
  &object(a)(0) {
  }
}

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



RE: [PHP] Write from form to DB

2005-08-03 Thread Jay Blanchard
[snip]
Jay Blanchard wrote:
> [snip]
> Yeah I am using "root" which has all permissions
> [/snip]
> 
> Are you sure? Did you specifically GRANT ALL to root? When you did,
did
> you flush the permissions? BTW, using root is a Bad Idead[tm].
> [/snip]
> 
> Also, check the mysql error log
Never mind guys! I got it working!
[/snip]

C an you tell us how you got it working in the event someone else needs
to duplicate your efforts?

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



Re[2]: [PHP] Write from form to DB

2005-08-03 Thread Richard Davey
Hello Jim,

Wednesday, August 3, 2005, 7:43:15 PM, you wrote:

>> You could do that. The reason that I don't is because of the mixing of
>> quote types.

JM> So, is that a "Really Bad Thing(tm)", or is it just bad form?  If the
JM> former, why?

It's in no way a "Really Bad Thing", probably just a personal coding preference.

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 Zend Certified Engineer
 "I do not fear computers. I fear the lack of them." - Isaac Asimov

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



Re: [PHP] Write from form to DB

2005-08-03 Thread John Nichel

George B wrote:

It does not seem to be putting anything into the DB. Gives no errors, 
but I check PHP My Admin, and there is nothing in the users and 
passwords field. I think something isnt working hmmm




Without seeing more of your code, we won't be able to tell for sure, but 
if I was a betting man, I'm going to say you didn't select the db (and 
it's not in your query).


Right after you run your query, echo out mysql_error()

mysql_query ( $query );
echo ( "" . mysql_error() . "\n" );

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] AJAX & PHP

2005-08-03 Thread Mikey

Graham Anderson wrote:


is there an example of this somewhere ?
Google does not come up with much.
I have seen simple AJAX examples...but none related to graphing classes.

I am a bit new at combining php with javascript with regards to image 
creation.


basically, I want the user to enter variables and have a graph 
generated without a full page reload on the same page...

kind of an  interactive graphing web  tool.

any examples  of this sort are appreciated  :)
g


On Aug 3, 2005, at 9:36 AM, Mikey wrote:

Graham Anderson wrote:


not a whole lot of info on the subject for working with graph classes :(
at least at this point


g

Surely it would be much simpler to just use have javascript to set a 
placed image to a new (or the same) location - this image is then 
generated by JPGraph et al with no modification to code.  I have been 
using this technique for years to make server calls without page 
refreshing.  (Well, that or an invisible frame/iframe/layer)


HTH,

Mikey


ok, so you have html like



and you have js like

// some event that triggers the script
document.images['img'].location = "/images/updated_graph.php";

And php makes your graph.  Using whatever classes you choose.

HTH,

Mikey

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



Re: [PHP] skip a row in foreach loop

2005-08-03 Thread Jochem Maas

[EMAIL PROTECTED] wrote:
Yes, it comes fro DB, but, quesry is alerady "to complex" (for me :)) 
with union, joint, ... and expanding with something else ill take 

^
 \__ I think to many of these are the problem ;-)


additional few hours to figure it out.


...

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



RE: [PHP] Write from form to DB

2005-08-03 Thread Jay Blanchard
[snip]
> Also, check the mysql error log
Never mind guys! I got it working!
[/snip]

C an you tell us how you got it working in the event someone else needs
to duplicate your efforts?
[/snip]

Can you tell us what the problem was so that it is available for the
archive?

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



Re: [PHP] Re: Everything works...Unless they hit the "back" button...

2005-08-03 Thread Jack Jackson
I've tried playing with the $_SERVER['HTTP_REFERER'] and that's no good 
because it's all coming from the same page - index.php!!


What am I missing. . . ?


Jack Jackson wrote:

Hi Kristen, there's a misunderstanding:

Kristen G. Thorson wrote:

The code below isn't much help to debug.  Do some checking to figure 
out how far into your IF statement you're getting.  Is the query 
running?  



Yes it runs successfully

Is it the query you expect?  



Yes it is perfect, and provided this is a new session and we're going 
forward page by page, it properly deletes from and inserts to the db as 
expected


(Step #1 when inserting or creating dynamic

queries that aren't working: print them out to make sure they are what 
you think they are.)  Is the category being incremented?



Yes, absolutely

You say you can go back, but you can't go forward.  



Actually no. In a new session, I can start and go forward page by page 
to the end of the questionnaire, advancing each stage perfectly, storing 
all values exactly as I'd expect.


The trouble starts if, during the process, the user hits the BACK 
button. At that point, user can reload the last page of questions, 
displaying the answers they gave. If the user makes changes, those 
changes get error checked but do not become part of the sql query. Also, 
user can not move forwards any more. So it's as the subject says - 
everything works...until they hit the back button, from which point the 
whole thing goes gablooey.


Look at the page source, is the


form action what it should be?



Yes

  Look at the form hidden variables (if


any) are they what you expect?


No. $cat remains what it was BEFORE the user hit the BACK button. 
However the questions dispayed are from the $cat which is in fact $cat-1


??!!



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



Re: [PHP] Re: Everything works...Unless they hit the "back" button...

2005-08-03 Thread Kristen G. Thorson
You said "If the user makes changes, those changes get error checked but 
do not become part of the sql query."  Where in your code is it failing 
to become part of the query?  Put a check at each level and see where 
*exactly* it fails to get deep enough to become one with the query.  
Also, I'm confused.  I asked if the query was what you're expecting, and 
you answered yes, which implies the data becomes part of the query.



kgt






Jack Jackson wrote:

I've tried playing with the $_SERVER['HTTP_REFERER'] and that's no 
good because it's all coming from the same page - index.php!!


What am I missing. . . ?


Jack Jackson wrote:


Hi Kristen, there's a misunderstanding:

Kristen G. Thorson wrote:

The code below isn't much help to debug.  Do some checking to figure 
out how far into your IF statement you're getting.  Is the query 
running?  




Yes it runs successfully

Is it the query you expect?  




Yes it is perfect, and provided this is a new session and we're going 
forward page by page, it properly deletes from and inserts to the db 
as expected


(Step #1 when inserting or creating dynamic

queries that aren't working: print them out to make sure they are 
what you think they are.)  Is the category being incremented?




Yes, absolutely

You say you can go back, but you can't go forward.  




Actually no. In a new session, I can start and go forward page by 
page to the end of the questionnaire, advancing each stage perfectly, 
storing all values exactly as I'd expect.


The trouble starts if, during the process, the user hits the BACK 
button. At that point, user can reload the last page of questions, 
displaying the answers they gave. If the user makes changes, those 
changes get error checked but do not become part of the sql query. 
Also, user can not move forwards any more. So it's as the subject 
says - everything works...until they hit the back button, from which 
point the whole thing goes gablooey.


Look at the page source, is the


form action what it should be?




Yes

  Look at the form hidden variables (if


any) are they what you expect?



No. $cat remains what it was BEFORE the user hit the BACK button. 
However the questions dispayed are from the $cat which is in fact $cat-1


??!!





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



Re: [PHP] Regular expressions book

2005-08-03 Thread Steve Turnbull
On Wed, 03 Aug 2005 12:10:40 -0500, Edward Vermillion wrote:

> Stefan Lemmen wrote:
>> Hi,
>> 
>> I've want to dig a bit deeper into regular expressions for php.
>> I wonder if anyone can help me choosing between 2 books I'm considering 
>> buying:
>> 
>> 1. Open Source Regular Expression Recipes - Nathan A Good
>> 2. Mastering Regular Expressions - Jeffrey Freidl
>> 
>> If your using/reading one of these books, please let me know which one
>> is best for PHP regex.
>> 
>> Thnx
>> 
>> Stefan Lemmen
>> Apeldoorn Holland
>> 
> 
> Haven't read the first, but the second is very good. It really helped me 
> to grasp the concepts of regex.

Also, you could try the O'Reilly book - Mastering Regular Expressions.
It's hardly bedside reading, but very thorougher.

It isn't PHP specific, but it is a very good guide from the ground up. It
isn't very good for 'quick reference' cookbook type stuff, but it will
give you a very good understanding of regex.

If you run Linux as a OS, there are a couple of regex gui's
(KregExpEditor for KDE) which are helpful. You 'design' the expression in
the interface and it gives you the actual reular exp as the result. I
am finding this a good way of learning, i.e. figuring out how the result
came about...

Just my thoughts...

Steve

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



Re: [PHP] Regular expressions book

2005-08-03 Thread -k.
Has anyone here tried to learn  Regular expressions with RegexBuddy?

http://www.regular-expressions.info/regexbuddy.html

It looks pretty cool, and even has some PHP specific stuff, but you have to pay 
to play.




-k.

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Re: [PHP] very simple, yet can't think how.

2005-08-03 Thread Esteamedpw
 
Thanks Mark and Sonu... as much as I've learned over the last few months I  
think I'm still a little confused about some of this stuff. I appreciate the  
Help you've given me :-)
 
Would any of you know about any tutorials on something like this? books  with 
tutorials, etc? If I knew what it was called I would google it - I'm just  
not sure exactly what it might be called lol
 
Thanks again fellas :-D
 
 
In a message dated 8/1/2005 10:45:14 P.M. Central Standard Time,  
[EMAIL PROTECTED] writes:

I have  coded this type of website for many years and have run the gamut of
trying  different things -- originally, 8 years ago, I used perl with flat
files  and physical folders but in the recent past I have used PHP, MySQL  and
dynamic folders.

In my opinion the best way to build this site  is with dynamic folders via
custom 404 error handling.  Here how it  works:

You build the pages for things like "contact us" "my store" "my  stuff" or
whatever.  Then you send someone to the site with an address  like:
mydomain.com/joe which doesn't exist.  A custom 404 error  handler picks up
the error and parses the URL to identify "joe" as a unique  ID.  The 404
script pulls "joe's" info from a database and populates  the pages with his
custom contact info then delivers the page.  Joe's  ID usually gets stuffed
into a cookie and then when the person comes back  to the site at a later
date, they are delivered joe's info.

That's  it in a nut shell.  Be sure that you deliver 200 headers and not  404
headers when delivering the dynamic folder.

Now you can do the  physical folders and every  time someone "signs up" you
can take the  template and populate their pages and store these pages in a
real folder  named "joe."  But, be aware using this method.  Success  (if
having lots of users is your goal) will be your downfall because this  system
is not easily scalable.  Just think what happens if you have  500 folders, or
5,000 or 50,000 folders with every folder having a copy of  the files in
them.

Here is a 404 script I  use:



And here  is the start of the getinfo.php script:



Be sure to code the handling of an actual 404  just in case you don't have a
user named joe or the surfer miss  types.

There's a ton of work in getting all of the bases covered - but  it's sweet
when it's done and you will know a lot of how a server  works.

Hope this helps.

Mark Cain


 


Re: [PHP] Write from form to DB

2005-08-03 Thread George B

Jay Blanchard wrote:

[snip]
Yeah I am using "root" which has all permissions
[/snip]

Are you sure? Did you specifically GRANT ALL to root? When you did, did
you flush the permissions? BTW, using root is a Bad Idead[tm].
[/snip]

Also, check the mysql error log


Thanks for all the help guys. It all worked out! The problem was that 
the table in the database was misspelled so it was not going in. It was 
my stupid fault again :-P


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



[PHP] Message check then post

2005-08-03 Thread George B
I am coding a message board. I am about done. I have all the forms 
needed for the message. So it all works out. The user types in his name, 
 message title, and the message itself. Then clicks submit. The Submit 
button takes him to the message check. The message check shows all the 
stuff the user entered. Then it has "echo" which says 'Is this correct'? 
And then there is a button. "Yes" When the user clicks yes it goes to 
another PHP file which runs the SQL query to put in the entereddata into 
the database
$query = "INSERT INTO forum (user,name,message) VALUES 
('$username','$name','$message')";

$result = mysql_query($query);

But see, the problem is that it is entering blanks into the DB. I think 
that is because the $username $name and $message are in the other file? 
I have no idea how to by-pass this problem. What should I do?


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



[PHP] Re: [PHP-WIN] can I use Apache v 2 with PHP?

2005-08-03 Thread Leo G. Divinagracia III

Taksam wrote:




Now, my question is: can I use Apache version 2 with PHP? And, even if I can 
use it in my development environment... is it safe to use Apache 2+PHP in a 
production environment?



running apache 2 with php 4, not 5...

--
Leo G. Divinagracia III
[EMAIL PROTECTED]

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



Re: [PHP] Message check then post

2005-08-03 Thread disguised.jedi
On 8/3/05, George B <[EMAIL PROTECTED]> wrote:
> I am coding a message board. I am about done. I have all the forms
> needed for the message. So it all works out. The user types in his name,
>   message title, and the message itself. Then clicks submit. The Submit
> button takes him to the message check. The message check shows all the
> stuff the user entered. Then it has "echo" which says 'Is this correct'?
> And then there is a button. "Yes" When the user clicks yes it goes to
> another PHP file which runs the SQL query to put in the entereddata into
> the database
> $query = "INSERT INTO forum (user,name,message) VALUES
> ('$username','$name','$message')";
> $result = mysql_query($query);
> 
> But see, the problem is that it is entering blanks into the DB. I think
> that is because the $username $name and $message are in the other file?
> I have no idea how to by-pass this problem. What should I do?
Use hidden form values.  You have displayed the data along with your
"is this OK?" message, so in that file, do this...






The "Is this OK?" stuff goes here.





[1] - The page with the database code goes here.
[2] - The previous page goes here.

This will stick the form values back inside a form which will be
posted to the next page.  The user can't see or edit them.  Hidden
form values are very useful, I'd recommend you take a closer look at
them!

Hope that helps!

-- 
PHP rocks!
"Knowledge is Power.  Power Corrupts.  Go to school, become evil"

Disclaimer: Any disclaimer attached to this message may be ignored. 
However, I must say that the ENTIRE contents of this message are
subject to other's criticism, corrections, and speculations.

This message is Certified Virus Free

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



[PHP] shell_exec("zip.. ?

2005-08-03 Thread Sam Smith

shell_exec("zip -r ddd ddd"); // don't work

safe_mode off, works from command line php. What could it be?

Details:

drwxr-xr-x  2 zamzmith  zamzmith  512 Aug  3 18:34 execTest/
-rw-r--r--  1 zamzmith  zamzmith  107 Aug  3 18:33 mkdir.php

mkdir.php:


execTest$ php mkdir.php

execTest$ ls -l
drwxr-xr-x  2 zamzmith  zamzmith  512 Aug  3 18:36 ddd
-rw-r--r--  1 zamzmith  zamzmith  109 Aug  3 18:36 mkdir.php

#OK works from command line php

Let's delete ddd and have the web server run it:
http://dom.com/execTest/mkdir.php

Nope, probably permissions:

execTest$ chmod 777 ../execTest

Try again:
http://dom.com/execTest/mkdir.php

Yup.

Now let's see if we can delete it.
rm.php:


http://dom.com/execTest/rm.php

Yup, makes sense, user httpd created it.

Now let's zip it.
zip.php:


http://dom.com/execTest/zip.php

NOPE can't zip, must be something I don't know.

drwxrwxrwx  3 zamzmith  zamzmith  512 Aug  3 18:49 execTest/
drwxr-xr-x  2 httpd zamzmith  512 Aug  3 18:49 ddd
-rw-r--r--  1 zamzmith  zamzmith  109 Aug  3 18:36 mkdir.php
-rw-r--r--  1 zamzmith  zamzmith  109 Aug  3 18:44 rm.php
-rw-r--r--  1 zamzmith  zamzmith  107 Aug  3 18:49 zip.php



Let's try it form the command line php:

Delete it first:
execTest$ curl http://ssmith.com/execTest/rm.php
execTest$ php zip.php

Yup:
drwxr-xr-x  2 zamzmith  zamzmith  512 Aug  3 19:10 ddd
-rw-r--r--  1 zamzmith  zamzmith  264 Aug  3 19:10 ddd.zip
-rw-r--r--  1 zamzmith  zamzmith  109 Aug  3 18:36 mkdir.php
-rw-r--r--  1 zamzmith  zamzmith  109 Aug  3 18:44 rm.php
-rw-r--r--  1 zamzmith  zamzmith  107 Aug  3 18:49 zip.php


Better check safe_mode anyway:

phpinfo.php:


execTest: php phpinfo.php | grep safe
safe_mode => Off => Off
safe_mode_exec_dir => no value => no value
safe_mode_gid => Off => Off
safe_mode_include_dir => no value => no value
sql.safe_mode => Off => Off
Supported ciphers => cast-128 gost rijndael-128 twofish arcfour cast-256
loki97 rijndael-192 saferplus wake blowfish-compat des rijndael-256 serpent
xtea blowfish enigma rc2 tripledes
safe_mode_allowed_env_vars => PHP_ => PHP_
safe_mode_protected_env_vars => LD_LIBRARY_PATH => LD_LIBRARY_PATH


Hours lost, any help,

Thanks

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



[PHP] a problem about calling nusoap with the same key

2005-08-03 Thread Shiqi Yang
Hi all:

 

Now I am playing nusoap to call some apis. In the api doc, the example gives
like this:



 







 

My code like:

Array('ArrayList' => array(

'input' => array('name' => 'a', 'value'=> 'b'))

);

But the key in the array should be different, so how can I construct it?

I also try :

Array('ArrayList' => ');

But after the serializing $param, there is nothing in the ArrayList.

 

Does anyone know about it?

Any reply would be appreciated.

Thanks.

 

 

 

Best regards,

Shiqi Yang

 



[PHP] Setting up a new box from scratch?

2005-08-03 Thread Brian Dunning

Hey all -

I have an unused Pentium box here, recent, well loaded with RAM and  
HD. I want to turn it into a LAMP box. Never done that before; is  
there a preferred one-stop-shop installer CD or anything (easy -  
knock on wood)? It would be nice to end up with some kind of decent  
web GUI for admin.


Thanks

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



Re: [PHP] Message check then post

2005-08-03 Thread George Babichev

[EMAIL PROTECTED] wrote:


On 8/3/05, George B <[EMAIL PROTECTED]> wrote:
 


I am coding a message board. I am about done. I have all the forms
needed for the message. So it all works out. The user types in his name,
 message title, and the message itself. Then clicks submit. The Submit
button takes him to the message check. The message check shows all the
stuff the user entered. Then it has "echo" which says 'Is this correct'?
And then there is a button. "Yes" When the user clicks yes it goes to
another PHP file which runs the SQL query to put in the entereddata into
the database
$query = "INSERT INTO forum (user,name,message) VALUES
('$username','$name','$message')";
$result = mysql_query($query);

But see, the problem is that it is entering blanks into the DB. I think
that is because the $username $name and $message are in the other file?
I have no idea how to by-pass this problem. What should I do?
   


Use hidden form values.  You have displayed the data along with your
"is this OK?" message, so in that file, do this...






The "Is this OK?" stuff goes here.





[1] - The page with the database code goes here.
[2] - The previous page goes here.

This will stick the form values back inside a form which will be
posted to the next page.  The user can't see or edit them.  Hidden
form values are very useful, I'd recommend you take a closer look at
them!

Hope that helps!

 


No, this does not work

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



Re: [PHP] Message check then post

2005-08-03 Thread Tom Ray [Lists]

George-

Without seeing your code it's hard to say what the problem is. There 
could be a typo, a missing quote or semi colon. The code snippet of the 
review page would be helpful.


Now when you say it's entering "blanks" into the database, I'm assuming 
you have a messageID field in the db that auto increments in some way, 
and that you're seeing a new messageID generated and the remaining 
fields are blank? If that's the case perhaps you're delcaring those 
variables without data some where in your script. I would need to see 
your code in order to tell you better.


Assuming everything is good, you need to pass your data from the check 
message page to your submit page by POST so hidden fields would be good. 
I'm also noticing that you're not escaping your data before you insert 
it into the database. This could be bad as quotations, apostrophes, and 
the such will cause your insert command to fail. Try this:


$username=mysql_escape_string($username);
$name=mysql_escape_string($name);
$message=mysql_escape_string($message);

mysql_query("INSERT INTO forum (user,name,message) VALUES ('$username', 
'$name', '$message')") or die("Insert Failed");


You should have some debuging built into your script so you can see 
where it errors out. Have you watched your mysql log file to see what 
happens during your query? Do you actaully the query happen in the log 
file? Or do you not have access to it?


Posting your code and any errors would help us figure out what the real 
problem is.


George B wrote:

I am coding a message board. I am about done. I have all the forms 
needed for the message. So it all works out. The user types in his 
name,  message title, and the message itself. Then clicks submit. The 
Submit button takes him to the message check. The message check shows 
all the stuff the user entered. Then it has "echo" which says 'Is this 
correct'? And then there is a button. "Yes" When the user clicks yes 
it goes to another PHP file which runs the SQL query to put in the 
entereddata into the database
$query = "INSERT INTO forum (user,name,message) VALUES 
('$username','$name','$message')";

$result = mysql_query($query);

But see, the problem is that it is entering blanks into the DB. I 
think that is because the $username $name and $message are in the 
other file? I have no idea how to by-pass this problem. What should I do?




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



[PHP] can't find the parser error

2005-08-03 Thread zedleon
I am having trouble finding the parser error in this small test script. Any
help would be appreciated
I am pulling in an array from this html form.


Event Name: 
Week Days
S
M
T
W
T
F
S




testarray.php


You want to add an event called
   {$_POST['name']} which takes place on: ";


if (is_array ($_POST['weekdays'])) {

   foreach ($_POST['weekdays'] as $day) {
   print "$day"

}

} else {

   print 'Please select at least one weekday for this event!';

}

print '';

?>

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



RE: [PHP] can't find the parser error

2005-08-03 Thread Dean Maunder
You missed a semi-colon...


You want to add an event called
   {$_POST['name']} which takes place on: ";


if (is_array ($_POST['weekdays'])) {

   foreach ($_POST['weekdays'] as $day) {
   print "$day";   // <---here

}
}
 
else {

   print 'Please select at least one weekday for this event!';

}

print '';

?> 



-Original Message-
From: Support [mailto:[EMAIL PROTECTED] 
Sent: Thursday, 4 August 2005 3:47 PM
To: Dean Maunder
Subject: Re: [PHP] can't find the parser error

Thanks Dean,

Here is the parse error...but when i attempt to correct it, the parse
error seems to jump down to the next command line.

Parse error: parse error, unexpected '}'
--snip

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



[PHP] code generation

2005-08-03 Thread Johan Grobler
is there a way to limit the time a website is available in php?, if you want to 
have a database driven website but you would only like it to be active for 6 
months for instance, i'm doing a project at univirsity and this is part of the 
specs, but i cant think of a good way how to do it...

Disclaimer
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is
intended for the attention and use only of the addressee.
Should you have received this e-mail in error, please delete
and destroy it and any attachments thereto immediately.
Under no circumstances will the Cape Peninsula University of
Technology or the sender of this e-mail be liable to any party for
any direct, indirect, special or other consequential damages for any
use of this e-mail.
For the detailed e-mail disclaimer please refer to
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

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



RE: [PHP] Regex help

2005-08-03 Thread Lizet Pena de Sola
Ok, it's not the regexp for detecting email addresses what I need,
that's widely published, thanks. I'm using ereg to match this regular
expression:

(On)[\s\w\d\W\S\D\n]*(wr[i|o]te[s]?:)

That will match phrases like
"On 8/3/05, Carol Swinehart <[EMAIL PROTECTED]> wrote:"
the type "On date, name  wrote or writes:"

The thing is I tried this regexp with Regex Coach and it matches fine,
but ereg returns no match

ereg($regexpstr, $str, $regs)

I know there are some comments at php.net about how ereg has some bugs,
any idea if this could be one?

Tia, 
Lizet
-Original Message-
From: Marcus Bointon [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 03, 2005 8:57 AM
To: PHP General
Subject: Re: [PHP] Regex help

On 2 Aug 2005, at 15:12, Robin Vickery wrote:

> I don't suppose this is the place for a rant about the futility of
> checking email addresses with a regexp?

Though I will agree with you to some extent, I've had quite a lot of  
success with this, which is pretty thorough:

^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\- 
\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.)){0,61} 
[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-Z0-9]?)| 
(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4] 
\d|25[0-5])\]))$

Which I got from here:

http://www.hexillion.com/samples/#Regex

Marcus
-- 
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk

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

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



Re: [PHP] code generation

2005-08-03 Thread Ligaya Turmelle
Maybe have a cron job that deletes/changes perms to make inaccessible 
the script after the given date.


Johan Grobler wrote:


is there a way to limit the time a website is available in php?, if you want to 
have a database driven website but you would only like it to be active for 6 
months for instance, i'm doing a project at univirsity and this is part of the 
specs, but i cant think of a good way how to do it...

Disclaimer 
This e-mail transmission contains confidential information,

which is the property of the sender.
The information in this e-mail or attachments thereto is 
intended for the attention and use only of the addressee. 
Should you have received this e-mail in error, please delete 
and destroy it and any attachments thereto immediately. 
Under no circumstances will the Cape Peninsula University of 
Technology or the sender of this e-mail be liable to any party for

any direct, indirect, special or other consequential damages for any
use of this e-mail.
For the detailed e-mail disclaimer please refer to 
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911




--
Respectfully,
Ligaya Turmelle

"Life is a game so have fun"

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

Re: [PHP] code generation

2005-08-03 Thread sub
Couldn't you use a date check with date()?

if(todays date < end date)
{
load the site
}
else
{
the site has expired
}

Andrew Darrow
Kronos1 Productions
www.pudlz.com


- Original Message - 
From: "Johan Grobler" <[EMAIL PROTECTED]>
To: 
Sent: Wednesday, August 03, 2005 11:04 PM
Subject: [PHP] code generation


is there a way to limit the time a website is available in php?, if you want
to have a database driven website but you would only like it to be active
for 6 months for instance, i'm doing a project at univirsity and this is
part of the specs, but i cant think of a good way how to do it...

Disclaimer
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is
intended for the attention and use only of the addressee.
Should you have received this e-mail in error, please delete
and destroy it and any attachments thereto immediately.
Under no circumstances will the Cape Peninsula University of
Technology or the sender of this e-mail be liable to any party for
any direct, indirect, special or other consequential damages for any
use of this e-mail.
For the detailed e-mail disclaimer please refer to
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

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





-- 
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.9.9/62 - Release Date: 8/2/2005

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