Re: [PHP] "Only variable references should be returned by reference"

2005-07-19 Thread Rasmus Lerdorf
Robert Cummings wrote:
> On Tue, 2005-07-19 at 22:10, Jason Wong wrote:
> 
>>On Wednesday 20 July 2005 07:32, Marc G. Fournier wrote:
>>
>>
>>>Which is?  If its:
>>
>>Yep.
>>
>>
>>>; at function call time.  This method is deprecated and is likely to be
>>>; unsupported in future versions of PHP/Zend.  The encouraged method of
>>>; specifying which arguments should be passed by reference is in the
>>>function ; declaration.  You're encouraged to try and turn this option
>>>Off and make ; sure your scripts work properly with it in order to
>>>ensure they will work ; with future versions of the language (you will
>>>receive a warning each time ; you use this feature, and the argument
>>>will be passed by value instead of by ; reference).
>>>allow_call_time_pass_reference = On
>>
>>The pass by reference thing works regardless of the above setting. 
>>Enabling the setting disables the warnings and vice-versa.
>>
>>
>>>It already is ...
>>
>>Are you sure that:
>>
>>1) you're looking at the correct php.ini
>>2) the setting is not being changed elsewhere
>>
>>If the warning annoys you just tone down the error reporting level.
>>
>>
>>>Is there another one I should be looking at? :(
>>
>>Not that I'm aware of.
> 
> 
> This isn't related to allow_call_time_pass_reference. It's a new notice
> that came with PHP 4.4.0 to inform developers of possible incorrect
> code. For instance the following will generate it:
> 
> function &$foo()
> {
> return null;
> }
> 
> According to internals before 4.4.0 such methods caused the occasional
> (almost impossible to track down) memory corruption bugs. You're only
> relief is to tone down the error reporting level (Which will knock out
> other notices during development but will be great for a production
> server), or do as I did and install a custom error handler that filters
> this notice specifically (I have to work with some ezproject code for a
> client which is disgusting and is filled with all kinds of notices not
> to mention on one page almost a thousand of this particular breed).

It still needs some tuning, but eventually it will also catch problems like:

  function foo(&$arg) {
$arg = "foo";
  }
  function bar() {
 return "abc";
  }
  foo(bar());

PHP4.4 will still happily let you run this code.  PHP-5.1 throws a fatal
error now.

It is obviously incorrect code and needs to be fixed.

In the case of returning a reference to something bogus, it's not quite
obvious that it is incorrect, hence the notice, but it is still
something that needs to be looked at.  For legacy code, ignore notices
for now and poke the authors to fix their code.

-Rasmus

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



[PHP] Re: still some problems with contact form

2005-07-19 Thread Bruce Gilbert
thanks, makes some sense.

so now where I have echo, I should have print? or just leave as echo
and add the else and ||?

Could you provide some sample code based on the code I posted
previously by chance??

being new to PHP I am sure I will run into errors for a few days, as is...

that would help me out greatly.



thx,

On 7/19/05, James <[EMAIL PROTECTED]> wrote:
> This is what you have done
> 
> if(something happens) {
> print error;
> }
> 
> print thanks for sending the form!
> 
> So basically you are printing the error and then thanking them. You need to
> 
> include an ELSE bracket. Like so..
> 
> if(this error || that error || some other error) {
> print error;
> } else {
> //no errors, thank them!
>print THANKS!
> }
> 
> - Original Message - 
> From: "Bruce Gilbert" <[EMAIL PROTECTED]>
> To: 
> Sent: Tuesday, July 19, 2005 5:52 PM
> Subject: [PHP] still some problems with contact form
> 
> 
> Hello,
> 
> on my web site contact form:
> 
> http://www.inspired-evolution.com/Contact.php
> 
> I am still having a few problems with the return results after filling
> out the form. Basically I am wanted to return an error msg. when all
> of the required fields are not filled out (those with a red *), and an
> invalid email address will also return an error.
> 
> filling out all of the information correctly will result in a
> thank-you paragraph, we have received your submission etc.
> 
> Right now even if you don't fill out the required fields, you still
> get my thank-you message for filling out the form correctly (as well
> as getting the error msg.). If someone has a chance try out the form
> yourself and you will see what I mean.
> 
> What I would really like to have is a thank-you page when the form is
> completed sucussfully and an oops! page when there is an error. SO we
> are talking two different pages, based upon the results of the form
> information...
> 
> The PHP code I have for the return info. currenty is:
> 
>  
> $firstname = $_POST['firstname'];
> $lastname = $_POST['lastname'];
> $company = $_POST['company'];
> $phone = $_POST['phone'];
> $email = $_POST['email'];
> $email2 = $_POST['email2'];
> $URL = $_POST['URL'];
> $Contact_Preference = $_POST['Contact_Preference'];
> $Contact_Time = $_POST['Contact_Time'];
> $message = $_POST['Message'];
> 
> if ((!$firstname) || (!$Contact_Preference)) {
> 
> echo'Error! Fields marked 
> * are required to continue.';
> echo'Please go back to the Contact Me page and try it again!';
> }
> 
> if 
> (!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*"."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email))
> {
> 
> echo 'Invalid email address entered.';
> echo 'Please go back to the Contact Me page and try it again!';
> }
> if (($email) != ($email2)) {
> 
> echo 'Error! e-mail addresses dont match.';
> 
> 
> }
> 
> $email_address = "[EMAIL PROTECTED]";
> $subject = "There has been a disturbance in the force";
> 
> $message = "Request from: $firstname $lastname\n\n
> Company name: $company\n
> Phone Number:  $phone\n
> Email Address: $email\n
> URL: $URL\n
> Please Contact me via: $Contact_Preference\n
> The best time to reach me is: $Contact_Time\n
> I wish to request the following additional information: $Textarea";
> 
> mail($email_address, $subject, $message, "From: $email \nX-Mailer:
> PHP/" . phpversion());
> 
> echo "Hello, $firstname.
> We have received your request for additional information, and will
> respond shortly.
> Thanks for visiting inspired-evolution.com and have a wonderful day! />
> Regards,
> Inspired Evolution";
> 
> ?>
> 
> any assistance/guidance is greatly appreciated. Thanks list!
> 
> Bruce G.
> http://www.inspired-evolution.com
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php 
> 
> 


-- 
::Bruce::

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



Re: [PHP] "Only variable references should be returned by reference"

2005-07-19 Thread Robert Cummings
On Tue, 2005-07-19 at 22:10, Jason Wong wrote:
> On Wednesday 20 July 2005 07:32, Marc G. Fournier wrote:
> 
> > Which is?  If its:
> 
> Yep.
> 
> > ; at function call time.  This method is deprecated and is likely to be
> > ; unsupported in future versions of PHP/Zend.  The encouraged method of
> > ; specifying which arguments should be passed by reference is in the
> > function ; declaration.  You're encouraged to try and turn this option
> > Off and make ; sure your scripts work properly with it in order to
> > ensure they will work ; with future versions of the language (you will
> > receive a warning each time ; you use this feature, and the argument
> > will be passed by value instead of by ; reference).
> > allow_call_time_pass_reference = On
> 
> The pass by reference thing works regardless of the above setting. 
> Enabling the setting disables the warnings and vice-versa.
> 
> > It already is ...
> 
> Are you sure that:
> 
> 1) you're looking at the correct php.ini
> 2) the setting is not being changed elsewhere
> 
> If the warning annoys you just tone down the error reporting level.
> 
> > Is there another one I should be looking at? :(
> 
> Not that I'm aware of.

This isn't related to allow_call_time_pass_reference. It's a new notice
that came with PHP 4.4.0 to inform developers of possible incorrect
code. For instance the following will generate it:

function &$foo()
{
return null;
}

According to internals before 4.4.0 such methods caused the occasional
(almost impossible to track down) memory corruption bugs. You're only
relief is to tone down the error reporting level (Which will knock out
other notices during development but will be great for a production
server), or do as I did and install a custom error handler that filters
this notice specifically (I have to work with some ezproject code for a
client which is disgusting and is filled with all kinds of notices not
to mention on one page almost a thousand of this particular breed).

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] "Only variable references should be returned by reference"

2005-07-19 Thread Marc G. Fournier

On Wed, 20 Jul 2005, Jason Wong wrote:


On Wednesday 20 July 2005 07:32, Marc G. Fournier wrote:


Which is?  If its:


Yep.


; at function call time.  This method is deprecated and is likely to be
; unsupported in future versions of PHP/Zend.  The encouraged method of
; specifying which arguments should be passed by reference is in the
function ; declaration.  You're encouraged to try and turn this option
Off and make ; sure your scripts work properly with it in order to
ensure they will work ; with future versions of the language (you will
receive a warning each time ; you use this feature, and the argument
will be passed by value instead of by ; reference).
allow_call_time_pass_reference = On


The pass by reference thing works regardless of the above setting.
Enabling the setting disables the warnings and vice-versa.


It already is ...


Are you sure that:

1) you're looking at the correct php.ini
2) the setting is not being changed elsewhere


Yup ... actually checked the output of phpinfo() too, just to double check 
that :(



If the warning annoys you just tone down the error reporting level.


Ah, hadn't though tof that ... thanks ...


Marc G. Fournier   Hub.Org Networking Services (http://www.hub.org)
Email: [EMAIL PROTECTED]   Yahoo!: yscrappy  ICQ: 7615664

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



Re: [PHP] "Only variable references should be returned by reference"

2005-07-19 Thread Jason Wong
On Wednesday 20 July 2005 07:32, Marc G. Fournier wrote:

> Which is?  If its:

Yep.

> ; at function call time.  This method is deprecated and is likely to be
> ; unsupported in future versions of PHP/Zend.  The encouraged method of
> ; specifying which arguments should be passed by reference is in the
> function ; declaration.  You're encouraged to try and turn this option
> Off and make ; sure your scripts work properly with it in order to
> ensure they will work ; with future versions of the language (you will
> receive a warning each time ; you use this feature, and the argument
> will be passed by value instead of by ; reference).
> allow_call_time_pass_reference = On

The pass by reference thing works regardless of the above setting. 
Enabling the setting disables the warnings and vice-versa.

> It already is ...

Are you sure that:

1) you're looking at the correct php.ini
2) the setting is not being changed elsewhere

If the warning annoys you just tone down the error reporting level.

> Is there another one I should be looking at? :(

Not that I'm aware of.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP] My Project

2005-07-19 Thread Robert Cummings
On Tue, 2005-07-19 at 21:46, Jochem Maas wrote:
> Matt Darby wrote:
> > George B wrote:
> > 
> >> Jay Blanchard wrote:
> >>
> >>> [snip]
> >>> $money -= 10;
> >>>
> >>> saves some chars ;)
> >>> [/snip]
> >>>
> >>> This actually requires two trips to the database, once to get $money and
> >>> once to update $money. Do it in the query instead...once.
> >>>
> >>> $sqlUpdate = "UPDATE `myDatabase`.`myTable` SET `myMoney` =
> >>> (`myMoney`-10) WHERE `myCharacter` = `characterName` ";
> >>> $doUpdate = mysql_query($sqlUpdate, $myConnection);
> >>>
> >>> saves lots of characters ;)
> >>
> >>
> >> Hey, Look I made a new database just for this money testing stuff.
> >> This is the table:
> >>
> >> CREATE TABLE `money` (
> >>   `money` varchar(255) NOT NULL default ''
> >> ) TYPE=MyISAM;
> >>
> >> Now, I use this code
> >>
> >> $sqlUpdate = "UPDATE `myDatabase`.`myTable` SET `myMoney` =
> >> (`myMoney`-10) WHERE `myCharacter` = `characterName` ";
> >> $doUpdate = mysql_query($sqlUpdate, $myConnection);
> >>
> >> And it should work, And it gives no error but it is not writing 
> >> anything into the database.
> >>
> > 
> > Lots of extra characters in that one... try this:
> > 
> > $q=mysql_query("update myTable set myMoney=(myMoney-10) where 
> > myCharacter='characterName'");
> > if(!$q){echo mysql_error();}
> 
> so wasteful :-)
> 
> $q=mysql_query("update u set m=(m-10) where 
> c='$c'");if(!$q)die(mysql_error());

Ugh... ;)

if(!($q=mysql_query("update u set m=(m-10) where
c='$c'"))die(mysql_error());

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] still some problems with contact form

2005-07-19 Thread James

This is what you have done

if(something happens) {
print error;
}

print thanks for sending the form!

So basically you are printing the error and then thanking them. You need to 
include an ELSE bracket. Like so..


if(this error || that error || some other error) {
   print error;
} else {
   //no errors, thank them!
  print THANKS!
}

- Original Message - 
From: "Bruce Gilbert" <[EMAIL PROTECTED]>

To: 
Sent: Tuesday, July 19, 2005 5:52 PM
Subject: [PHP] still some problems with contact form


Hello,

on my web site contact form:

http://www.inspired-evolution.com/Contact.php

I am still having a few problems with the return results after filling
out the form. Basically I am wanted to return an error msg. when all
of the required fields are not filled out (those with a red *), and an
invalid email address will also return an error.

filling out all of the information correctly will result in a
thank-you paragraph, we have received your submission etc.

Right now even if you don't fill out the required fields, you still
get my thank-you message for filling out the form correctly (as well
as getting the error msg.). If someone has a chance try out the form
yourself and you will see what I mean.

What I would really like to have is a thank-you page when the form is
completed sucussfully and an oops! page when there is an error. SO we
are talking two different pages, based upon the results of the form
information...

The PHP code I have for the return info. currenty is:

Error! Fields marked 
* are required to continue.';
echo'Please go back to the Contact Me page and try it again!';
}

if 
(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*"."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email))

{

   echo 'Invalid email address entered.';
echo 'Please go back to the Contact Me page and try it again!';
}
if (($email) != ($email2)) {

   echo 'Error! e-mail addresses dont match.';


}

$email_address = "[EMAIL PROTECTED]";
$subject = "There has been a disturbance in the force";

$message = "Request from: $firstname $lastname\n\n
Company name: $company\n
Phone Number:  $phone\n
Email Address: $email\n
URL: $URL\n
Please Contact me via: $Contact_Preference\n
The best time to reach me is: $Contact_Time\n
I wish to request the following additional information: $Textarea";

mail($email_address, $subject, $message, "From: $email \nX-Mailer:
PHP/" . phpversion());

echo "Hello, $firstname.
We have received your request for additional information, and will
respond shortly.
Thanks for visiting inspired-evolution.com and have a wonderful day!/>

Regards,
Inspired Evolution";

?>

any assistance/guidance is greatly appreciated. Thanks list!

Bruce G.
http://www.inspired-evolution.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] My Project

2005-07-19 Thread Jochem Maas

Matt Darby wrote:

George B wrote:


Jay Blanchard wrote:


[snip]
$money -= 10;

saves some chars ;)
[/snip]

This actually requires two trips to the database, once to get $money and
once to update $money. Do it in the query instead...once.

$sqlUpdate = "UPDATE `myDatabase`.`myTable` SET `myMoney` =
(`myMoney`-10) WHERE `myCharacter` = `characterName` ";
$doUpdate = mysql_query($sqlUpdate, $myConnection);

saves lots of characters ;)



Hey, Look I made a new database just for this money testing stuff.
This is the table:

CREATE TABLE `money` (
  `money` varchar(255) NOT NULL default ''
) TYPE=MyISAM;

Now, I use this code

$sqlUpdate = "UPDATE `myDatabase`.`myTable` SET `myMoney` =
(`myMoney`-10) WHERE `myCharacter` = `characterName` ";
$doUpdate = mysql_query($sqlUpdate, $myConnection);

And it should work, And it gives no error but it is not writing 
anything into the database.




Lots of extra characters in that one... try this:

$q=mysql_query("update myTable set myMoney=(myMoney-10) where 
myCharacter='characterName'");

if(!$q){echo mysql_error();}


so wasteful :-)

$q=mysql_query("update u set m=(m-10) where c='$c'");if(!$q)die(mysql_error());





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



Re: [PHP] My Project

2005-07-19 Thread Matt Darby

George B wrote:


Jay Blanchard wrote:


[snip]
$money -= 10;

saves some chars ;)
[/snip]

This actually requires two trips to the database, once to get $money and
once to update $money. Do it in the query instead...once.

$sqlUpdate = "UPDATE `myDatabase`.`myTable` SET `myMoney` =
(`myMoney`-10) WHERE `myCharacter` = `characterName` ";
$doUpdate = mysql_query($sqlUpdate, $myConnection);

saves lots of characters ;)


Hey, Look I made a new database just for this money testing stuff.
This is the table:

CREATE TABLE `money` (
  `money` varchar(255) NOT NULL default ''
) TYPE=MyISAM;

Now, I use this code

$sqlUpdate = "UPDATE `myDatabase`.`myTable` SET `myMoney` =
(`myMoney`-10) WHERE `myCharacter` = `characterName` ";
$doUpdate = mysql_query($sqlUpdate, $myConnection);

And it should work, And it gives no error but it is not writing 
anything into the database.




Lots of extra characters in that one... try this:

$q=mysql_query("update myTable set myMoney=(myMoney-10) where 
myCharacter='characterName'");

if(!$q){echo mysql_error();}

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



Re: [PHP] ARG, call to undefined function, same problem I had on SuSE

2005-07-19 Thread Chris

You didn't send the questionto the list...

I have no idea.

Chris
Chuck Carson wrote:


Using ocilogon, I get this error:
Warning: ocilogon() [function.ocilogon]: _oci_open_server: Error while
trying to retrieve text for error ORA-12154 in
/usr/local/apache2/htdocs/oratest.php on line 2

Can anyone point me in the right direction?

Thx,
CC

On 7/19/05, Chris <[EMAIL PROTECTED]> wrote:
 


I've never used the Oracle functions before, but the ora_* functions are
different than the oci_* functions.

The ./configure  added the oci_*  not the ora_*.

Just looking in from the outside it seems that you need the oci_* , so
try it wiith those?

Chris

Chuck Carson wrote:

   


Okay, just built php 5.0.4 on solaris 9 and added mysql and oracle
support (using Oracle 10.2.0.1). phpinfo() shows that oracle support
is enabled, however, a simple call to ora_logon doesnt work:

Fatal error: Call to undefined function ora_logon() in
/usr/local/apache2/htdocs/oratest.php
on line 2

I configured php as follows:
./configure --prefix=/usr/local/php-5.0.4
--with-apxs2=/usr/local/apache2/bin/apxs --enable-cli --enable-cgi
--with-openss=/usr/local/ssl --with-zlib --with-bz2 --enable-dio
--with-gd --with-gettext --with-mysql=/usr/local/mysql
--with-mysql-sock=/tmp/mysql.sock --enable-sockets
--with-oci8=/u01/app/oracle/product/10.2

Anyone have any ideas???
Thx,
CC



 


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



[PHP] Mail Function

2005-07-19 Thread Cabbar Duzayak
Hi,

I have a web site that is going to have around total of 10-20 thousand
unique users, about 1000 unique hits per day on shared hosting.

I have been using PHP's internal mail mechanism with the local smtp
server on my hosting company, but it is more like a hit-and-miss kind
of thing. And, there are users complaining that they are not getting
any e-mail.

Can you guys please provide advise as to what the problem might be? I
don't think it is the local SMTP, because the way SMTP is configured
is pretty solid, and once you submit internally (not via port 25), it
should retry till it delivers it. So, I am thinking it might be
because of headers or something else.

So, should I use a more sophisticated mail library? Can you recommend any?

Thanks...

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



Re: [PHP] My Project

2005-07-19 Thread Mikey

George B wrote:


Jay Blanchard wrote:


[snip]
$money -= 10;

saves some chars ;)
[/snip]

This actually requires two trips to the database, once to get $money and
once to update $money. Do it in the query instead...once.

$sqlUpdate = "UPDATE `myDatabase`.`myTable` SET `myMoney` =
(`myMoney`-10) WHERE `myCharacter` = `characterName` ";
$doUpdate = mysql_query($sqlUpdate, $myConnection);

saves lots of characters ;)


Hey, Look I made a new database just for this money testing stuff.
This is the table:

CREATE TABLE `money` (
  `money` varchar(255) NOT NULL default ''
) TYPE=MyISAM;

Now, I use this code

$sqlUpdate = "UPDATE `myDatabase`.`myTable` SET `myMoney` =
(`myMoney`-10) WHERE `myCharacter` = `characterName` ";
$doUpdate = mysql_query($sqlUpdate, $myConnection);

And it should work, And it gives no error but it is not writing 
anything into the database.


Maybe that is because your data type is wrong?  Numbers (whole ones) 
should be stored as the integer datatype, otherwise math operators will 
not work.  Also, is "characterName" a valid row in your database, or did 
you mean to do some kind of variable substitution here?


I am not being funny here George, but don't you think maybe you need to 
read some kind of programming tutorial or something?  Your questions 
seem to indicate that you have just decided to charge headlong into a 
project with very little knowledge of what it is you are undertaking.


So far you have encountered so very mild responses to your posts, but I 
am sure it is only a matter of time before more and more people will 
redirect your posts to /dev/null - and really, when you get to the 
extremely gnarly parts of your RPG game you will find that there is very 
little repsonse or no response to your questions.


Anyway, dont want to sound like I am having a go, but this list really 
is for technical problems with PHP, not a replacement for the manual.


regards,

Mikey

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



Re: [PHP] "Only variable references should be returned by reference"

2005-07-19 Thread Marc G. Fournier

yOn Wed, 20 Jul 2005, Jason Wong wrote:


On Tuesday 19 July 2005 23:17, Marc G. Fournier wrote:

Just upgraded to 4.4.0 ... several "legacy applications" that we have
installed now break with the above error message ... specifically,
older installs of Horde, but I've seen reports of other apps ...

Without reverting back to 4.3.11, is there a way I can temporarily fix
this while working on the application issues themselves? :(


Change the relevant setting in php.ini.


Which is?  If its:

; at function call time.  This method is deprecated and is likely to be
; unsupported in future versions of PHP/Zend.  The encouraged method of
; specifying which arguments should be passed by reference is in the function
; declaration.  You're encouraged to try and turn this option Off and make
; sure your scripts work properly with it in order to ensure they will work
; with future versions of the language (you will receive a warning each time
; you use this feature, and the argument will be passed by value instead of by
; reference).
allow_call_time_pass_reference = On

It already is ...

Is there another one I should be looking at? :(


Marc G. Fournier   Hub.Org Networking Services (http://www.hub.org)
Email: [EMAIL PROTECTED]   Yahoo!: yscrappy  ICQ: 7615664

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



Re: [PHP] My Project

2005-07-19 Thread George B

Jay Blanchard wrote:

[snip]
$money -= 10;

saves some chars ;)
[/snip]

This actually requires two trips to the database, once to get $money and
once to update $money. Do it in the query instead...once.

$sqlUpdate = "UPDATE `myDatabase`.`myTable` SET `myMoney` =
(`myMoney`-10) WHERE `myCharacter` = `characterName` ";
$doUpdate = mysql_query($sqlUpdate, $myConnection);

saves lots of characters ;)

Hey, Look I made a new database just for this money testing stuff.
This is the table:

CREATE TABLE `money` (
  `money` varchar(255) NOT NULL default ''
) TYPE=MyISAM;

Now, I use this code

$sqlUpdate = "UPDATE `myDatabase`.`myTable` SET `myMoney` =
(`myMoney`-10) WHERE `myCharacter` = `characterName` ";
$doUpdate = mysql_query($sqlUpdate, $myConnection);

And it should work, And it gives no error but it is not writing anything 
into the database.


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



[PHP] PHP is occasionally seg faulting

2005-07-19 Thread Chuck Carson
Im running php 5.0.4 with oracle 10g on Solaris 9 and apache 2.0.54.
(I built with --with-oci8 so I am using the OCI stuff)

I have a simple test page that does "select username from dba_users"
and merely prints each username to the browser. It will work 1 time or
sometimes 2 but then subsequent calls produce errors (in the browser)
and the apache log gets this:

[Tue Jul 19 16:01:10 2005] [notice] child pid 7105 exit signal
Segmentation fault (11)
[Tue Jul 19 16:02:18 2005] [notice] child pid 7107 exit signal
Segmentation fault (11)
[Tue Jul 19 16:02:19 2005] [notice] child pid 7110 exit signal
Segmentation fault (11)

Anyone have any ideas?
Thx,
CC

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



Re: [PHP] problems with self referential sticky forms

2005-07-19 Thread eoghan

On 20 Jul 2005, at 02:22, Linda H wrote:


fahreheit is here:



The error was on the line: $fahr = $_GET['fahrenheit'];


try:


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



Re: [PHP] problems with self referential sticky forms

2005-07-19 Thread Mikey

Linda H wrote:




Where is fahrenheit? change the input name...



fahreheit is here:



The error was on the line: $fahr = $_GET['fahrenheit'];

Linda


Have you checked that the name is spelt correctly in your HTML form?

I (and this is jus a preference) do:

$var = (isset ($_GET['var'])) ? $_GET['var'] : null;

HTH,

Mikey

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



Re: [PHP] problems with self referential sticky forms

2005-07-19 Thread Linda H



Where is fahrenheit? change the input name...


fahreheit is here:



The error was on the line: $fahr = $_GET['fahrenheit'];

Linda

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



Re: [PHP] problems with self referential sticky forms

2005-07-19 Thread Linda H



Where is fahrenheit? change the input name...


fahreheit is here:



The error was on the line: $fahr = $_GET['fahrenheit'];

Linda

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



Re: [PHP] problems with self referential sticky forms

2005-07-19 Thread eoghan

On 20 Jul 2005, at 02:01, Linda H wrote:

But when execute the code above I get an error: Notice: Undefined  
index: fahrenheit in C:\Program Files\Apache Group\Apache2\htdocs 
\.



Where is fahrenheit? change the input name...
Eoghan

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



[PHP] problems with self referential sticky forms

2005-07-19 Thread Linda H

Hi,

I'm trying to code a form that will call itself. The first time it is 
called (by a link), it should display the empty form. If it was called by a 
submit to itself, it will validate and then process or re-display the form 
if it didn't pass validation.


In Programing PHP I found a technique (example 7-4.):



The text says "we copy the form parameter value into $fahr. If we aren't 
given that parameter, $fahr contains NULL.


I thought this could be used to create a value that would then be displayed 
in the form field. If the parameter wasn't passed, the form field would be 
empty. If the paramenter was passed, the value would be displayed. Like so:




But when execute the code above I get an error: Notice: Undefined index: 
fahrenheit in C:\Program Files\Apache Group\Apache2\htdocs\.


Yet, the line 'fahr is null does print', so $fahr was successfully created. 
Because I'm in debug mode, my error reporting is set to E_ALL. Are these 
sorts of errors ones that will disappear when the error reporting threshold 
is set lower. Should they be accepted in a development environment.  Or is 
there a better way of accomplishing what I want to do.


Thanks,
Linda  


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



[PHP] still some problems with contact form

2005-07-19 Thread Bruce Gilbert
Hello,

on my web site contact form:

http://www.inspired-evolution.com/Contact.php

I am still having a few problems with the return results after filling
out the form. Basically I am wanted to return an error msg. when all
of the required fields are not filled out (those with a red *), and an
invalid email address will also return an error.

filling out all of the information correctly will result in a
thank-you paragraph, we have received your submission etc.

Right now even if you don't fill out the required fields, you still
get my thank-you message for filling out the form correctly (as well
as getting the error msg.). If someone has a chance try out the form
yourself and you will see what I mean.

What I would really like to have is a thank-you page when the form is
completed sucussfully and an oops! page when there is an error. SO we
are talking two different pages, based upon the results of the form
information...

The PHP code I have for the return info. currenty is:

Error! Fields marked 
* are required to continue.';
echo'Please go back to the Contact Me page and try it again!';
} 

if 
(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*"."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email))
{
 
echo 'Invalid email address entered.';
echo 'Please go back to the Contact Me page and try it again!';
}
if (($email) != ($email2)) {
 
echo 'Error! e-mail addresses dont match.';

 
}
 
$email_address = "[EMAIL PROTECTED]";
$subject = "There has been a disturbance in the force";
 
$message = "Request from: $firstname $lastname\n\n
Company name: $company\n
Phone Number:  $phone\n
Email Address: $email\n
URL: $URL\n
Please Contact me via: $Contact_Preference\n
The best time to reach me is: $Contact_Time\n
I wish to request the following additional information: $Textarea";
 
mail($email_address, $subject, $message, "From: $email \nX-Mailer:
PHP/" . phpversion());
 
echo "Hello, $firstname.
We have received your request for additional information, and will
respond shortly.
Thanks for visiting inspired-evolution.com and have a wonderful day!
Regards,
Inspired Evolution";

?>

any assistance/guidance is greatly appreciated. Thanks list!

Bruce G.
http://www.inspired-evolution.com

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



Re: [PHP] My Project

2005-07-19 Thread Marek Kilimajer

Paul Waring wrote:

On Tue, Jul 19, 2005 at 09:50:06AM -0700, George B wrote:

My money is being stored in a database. And I want everythign to be in 
PHP, no java script. And the BUY!! Button is a input button from a form. :)



Well in that case you probably want something like this (after you've
checked to see whether the user is logged in etc):

$sql = "UPDATE users SET money = money - 10 WHERE id = " .
$_SESSION['user_id'];


this does not check if the user has enough money. This query does:

UPDATE users SET money = money - 10 WHERE id = $_SESSION['user_id'] and 
money >= 10


Then check affected rows to see if the money was actually subtructed 
from the account.


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



[PHP] Re: What is this?

2005-07-19 Thread George B

George B wrote:

How is this possibly not working?

$money = $_GET ['money'];
$money = $money -3
echo $money;

oops nvm i forgot the ; on like 2 :D

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



[PHP] What is this?

2005-07-19 Thread George B

How is this possibly not working?

$money = $_GET ['money'];
$money = $money -3
echo $money;

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



Re: [PHP] MySQL password file

2005-07-19 Thread Jason Wong
On Monday 18 July 2005 18:53, Lawrence Kennon wrote:
> In my current hosting situation I don't have the ability to store my
> file that contains MySQL userids/passwords in a subdirectory that is
> not under the server root. In order to protect it from being included
> from a foreign host I thought up this scheme of using the php_uname
> function to check that it is running on the correct host. Does this
> look reasonably secure? I am not hosting any kind of store, or terribly
> sensitive data - it will only be a bulletin board.

If by "foreign host" you mean a remote (ie over the network) host then 
there is nothing for you to worry about (if your webserver is configured 
correctly -- see below). When using include() on a remote file you are 
only including the output of that file AFTER it has been processed by 
php. Thus in the case of the example below where you're only defining a 
bunch of constants there is no output and thus nothing to "include". 

> define ('DB_USER', 'username');
> define ('DB_PASSWORD', 'password');
> define ('DB_HOST', 'localhost');
> define ('DB_NAME', 'dbname');

**Beware** if you're using a non-standard filename extension for your 
include files, eg .inc, and have not configured your webserver to process 
these using php then then it *is* possible to include and use these 
remotely. You can easily check this by entering the URL of the include 
file into a browser and then "view source", what you see is what will be 
included by a "foreign host".

What you should be more concerned about if you're on a shared host is that 
there is a good possibility that your co-hosts are able to access your 
files anyway.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP] "Only variable references should be returned by reference"

2005-07-19 Thread Jason Wong
On Tuesday 19 July 2005 23:17, Marc G. Fournier wrote:
> Just upgraded to 4.4.0 ... several "legacy applications" that we have
> installed now break with the above error message ... specifically,
> older installs of Horde, but I've seen reports of other apps ...
>
> Without reverting back to 4.3.11, is there a way I can temporarily fix
> this while working on the application issues themselves? :(

Change the relevant setting in php.ini.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP] Ok, why is this happening...

2005-07-19 Thread Andy Pieters
Hi 

I admit not gone trough all of your code, but mostly this happens when mixing 
the string concatenation operator (.) with the addition (+) or substraction 
(-) operator.

HTH

With kind regards

Andy

On Tuesday 19 July 2005 19:26, John Nichel wrote:
> Chris Boget wrote:
> >>Chris Boget wrote:
> >>
> >>
> >>>echo "if( $originalNet != $calculatedNet ) = " . ( (int)$originalNet !==
> >>>(int)$calculatedNet ) . "\n";
> >>
> >>
> >>Change this to echo out what you're comparing...
> >>echo "if( ". (int)$originalNet ." != ". (int)$calculatedNet ." ) = " . (
> >>(int)$originalNet !== (int)$calculatedNet ) . "\n";
> >>That'll show what numbers is actually trying to match.
> >
> > Ok, then that begs the following questions:
> >
> > If I don't cast any of the values, why do they display as being
> > identicle? Additionally, why does every IF check fail in that case?
>
> There's some freaky math going on there or something.  I added a couple
> of other echos in to see and for some reason it seems to be losing
> single digit value (subtracting, rounding down, I don't know).
>
> $calculatedGross  = $originalNet + ( $originalNet * $commissionPct * 0.01
> );
>
> echo ( "Gross : " . (int)$calculatedGross ." = ". $originalNet ." + ( ".
> $originalNet ." * ". $commissionPct ." *.01 )\n" );
>
> $calculatedNet= $calculatedGross / ( 1 + ( $commissionPct * 0.01 ));
>
> echo ( "Net : " . (int)$calculatedNet." = " . (int)$calculatedGross . "
> / ( 1 + ( " . $commissionPct . " * .01 ) )\n" );
>
> --
> John C. Nichel
> ÜberGeek
> KegWorks.com
> 716.856.9675
> [EMAIL PROTECTED]

-- 
Registered Linux User Number 379093
   Cockroaches and socialites are the only things that can 
   stay up all night and eat anything.
Herb Caen
--
-- --BEGIN GEEK CODE BLOCK-
Version: 3.1
GAT/O/>E$ d-(---)>+ s:(+)>: a--(-)>? C$(+++) UL>$ P-(+)>++
L+++>$ E---(-)@ W+++>+++$ !N@ o? !K? W--(---) !O !M- V-- PS++(+++)
PE--(-) Y+ PGP++(+++) t+(++) 5-- X++ R*(+)@ !tv b-() DI(+) D+(+++) G(+)
e>$@ h++(*) r-->++ y--()>
-- ---END GEEK CODE BLOCK--
--
Check out these few php utilities that I released
 under the GPL2 and that are meant for use with a 
 php cli binary:
 
 http://www.vlaamse-kern.com/sas/
--

--


pgptzLlv5o2r7.pgp
Description: PGP signature


[PHP] submission PHP code : MYSQL command lines translation

2005-07-19 Thread Alessandro Rosa
Dear All subscribers,
 
my intention, through this e-mail, is to submit to your attentions one PHP class
devoted to translate input native language commands for database into MYSQL
commands lines.

The goal of this class is to provide a comfortable code interface to let 
programmers
implement forms within their programs so that customers/users can input
self-defined command lines and reach their own queries.

Programmers can freely implement as they want. For example, one suggested way
is evidently prompt-like, so that customers can use the program to get their 
queries.

Purposes of this class and everything related is contained in the file 
readme.html

I do not know lots of forums, but if you like this code you might also post it
to other national PHP forums.

I hope the forums I sent provide attachments sending too, otherwise feel free
to ask me to send you the related PHP code.

I look forward to your feedbacks.

Alessandro Rosa


[PHP] Translating english into amglish

2005-07-19 Thread Murray @ PlanetThoughtful
Hi All,

 

I'm based in Australia but my blog is predominantly read by Americans. I'm
wondering if anyone knows of a class that will translate Australian / UK /
Canadian / Whathaveyou English spellings into their American English
equivalents?

 

In other words, a class that will take a string with spellings such as "The
colour of my neighbour's car, I recently realised, isn't grey after all" and
will return "The color of my neighbor's car, I recently realized, isn't gray
after all", and so on.

 

Given time I'm sure I could work out many of the transformation rules
myself, and implement them via regular expressions, but why reinvent the
wheel if someone has already done so?

 

Much warmth,

 

Murray

---

http://www.planetthoughtful.org

"Building a thoughtful planet,

one quirky comment at a time."

 



Re: [PHP] ARG, call to undefined function, same problem I had on SuSE

2005-07-19 Thread Chris
I've never used the Oracle functions before, but the ora_* functions are 
different than the oci_* functions.


The ./configure  added the oci_*  not the ora_*.

Just looking in from the outside it seems that you need the oci_* , so 
try it wiith those?


Chris

Chuck Carson wrote:


Okay, just built php 5.0.4 on solaris 9 and added mysql and oracle
support (using Oracle 10.2.0.1). phpinfo() shows that oracle support
is enabled, however, a simple call to ora_logon doesnt work:

Fatal error: Call to undefined function ora_logon() in
/usr/local/apache2/htdocs/oratest.php
on line 2

I configured php as follows:
./configure --prefix=/usr/local/php-5.0.4
--with-apxs2=/usr/local/apache2/bin/apxs --enable-cli --enable-cgi
--with-openss=/usr/local/ssl --with-zlib --with-bz2 --enable-dio
--with-gd --with-gettext --with-mysql=/usr/local/mysql
--with-mysql-sock=/tmp/mysql.sock --enable-sockets
--with-oci8=/u01/app/oracle/product/10.2

Anyone have any ideas???
Thx,
CC

 



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



Re: [PHP] getting file size before upload

2005-07-19 Thread Matthew Weier O'Phinney
* "Jay Blanchard" <[EMAIL PROTECTED]>:
> [snip]
> I know it is a often asked question, but after googling for about
> 2hours and trying out some wired examples I am still not any closer to
> a solution.  So I was hoping to find expert advice here.
>
> I want to save the user the hastle of uploading a 2MB file and waiting
> for a long time for an error message that the file is to big.
>
> Is there any usefull workaround in warning the user that he is about
> to upload a 2MB file and only smaller files are supported? I tried
> around with megaupload:
> http://sourceforge.net/projects/megaupload
> to get a progress bar and to get the file size prior to upload, but
> that somehow does not work the way I want it to.
>
> Is there an easier solution without perl,just with PHP or/and JS?
> [/snip]
>
> http://www.php.net/stat

The OP wants a solution that is client-side -- stat() would be
server-side.

And, to answer the OP's question, no, there is not a reliable way to do
this. You can provide some hints via the HTML form -- set hidden keys
for MAX_UPLOAD_SIZE, for instance -- but many browsers ignore these.

My understanding is that it's possible to use javascript in some cases
to determine the file size on the upload element's population, but that
is going to be unreliable as well, due to differences in client OS and
browser javascript implementations.

The easiest "solution" is to simply provide some warning text indicating
that the file size should not exceed a certain threshold -- and give
back a nice, big error message when it does so they know why the upload
failed.

-- 
Matthew Weier O'Phinney
Zend Certified Engineer
http://weierophinney.net/matthew/

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



[PHP] submission PHP code : MYSQL command lines translation

2005-07-19 Thread Alessandro Rosa
Dear All subscribers,
 
my intention, through this e-mail, is to submit to your attentions one PHP class
devoted to translate input native language commands for database into MYSQL
commands lines.

Download the code from:
http://freeweb.supereva.com/malilla/Mirror/Download/Code/Php/php_mysql_translator.zip

or ask it to me.

The goal of this class is to provide a comfortable code interface to let 
programmers
implement forms within their programs so that customers/users can input
self-defined command lines and reach their own queries.

Programmers can freely implement as they want. For example, one suggested way
is evidently prompt-like, so that customers can use the program to get their 
queries.

Purposes of this class and everything related is contained in the file 
readme.html

I do not know lots of forums, but if you like this code you might also post it
to other national PHP forums.

I hope the forums I sent provide attachments sending too, otherwise feel free
to ask me to send you the related PHP code.

I look forward to your feedbacks.

Alessandro Rosa


[PHP] ARG, call to undefined function, same problem I had on SuSE

2005-07-19 Thread Chuck Carson
Okay, just built php 5.0.4 on solaris 9 and added mysql and oracle
support (using Oracle 10.2.0.1). phpinfo() shows that oracle support
is enabled, however, a simple call to ora_logon doesnt work:

Fatal error: Call to undefined function ora_logon() in
/usr/local/apache2/htdocs/oratest.php
on line 2

I configured php as follows:
./configure --prefix=/usr/local/php-5.0.4
--with-apxs2=/usr/local/apache2/bin/apxs --enable-cli --enable-cgi
--with-openss=/usr/local/ssl --with-zlib --with-bz2 --enable-dio
--with-gd --with-gettext --with-mysql=/usr/local/mysql
--with-mysql-sock=/tmp/mysql.sock --enable-sockets
--with-oci8=/u01/app/oracle/product/10.2

Anyone have any ideas???
Thx,
CC

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



Re: [PHP] My Project

2005-07-19 Thread Greg Donald
On 7/19/05, Mikey <[EMAIL PROTECTED]> wrote:
> $money = $money - 10;

Make sure you protect it against multiple browser sessions.

-- 
Greg Donald
Zend Certified Engineer
MySQL Core Certification
http://destiney.com/

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



Re: [PHP] My Project

2005-07-19 Thread George B

Paul Waring wrote:

On Tue, Jul 19, 2005 at 09:50:06AM -0700, George B wrote:

My money is being stored in a database. And I want everythign to be in 
PHP, no java script. And the BUY!! Button is a input button from a form. :)



Well in that case you probably want something like this (after you've
checked to see whether the user is logged in etc):

$sql = "UPDATE users SET money = money - 10 WHERE id = " .
$_SESSION['user_id'];

assuming of course that you have a table called users where the money
for each one is stored and you're keeping the user_id in the $_SESSION
superglobal.

It's a bit difficult to help further without a bit more information. :)

Paul

well what kind more information do you want to know? I can provide you 
with all the info.

By the way. Here is my table.

CREATE TABLE `b_users` (
  `userID` bigint(21) NOT NULL auto_increment,
  `username` varchar(60) NOT NULL default '',
  `password` varchar(255) NOT NULL default '',
  `status` int(20) NOT NULL default '0',
  `posts` bigint(20) NOT NULL default '0',
  `email` varchar(255) NOT NULL default '',
  `validated` int(11) NOT NULL default '0',
  `keynode` bigint(21) NOT NULL default '0',
  `sig` tinytext NOT NULL,
  `banned` varchar(255) NOT NULL default 'no',
  `rank` varchar(255) NOT NULL default '0',
  `usepm` int(11) NOT NULL default '1',
  `AIM` varchar(50) NOT NULL default '',
  `ICQ` varchar(50) NOT NULL default '',
  `location` varchar(255) NOT NULL default '',
  `showprofile` smallint(6) NOT NULL default '1',
  `lastposttime` bigint(20) NOT NULL default '0',
  `tsgone` bigint(20) NOT NULL default '0',
  `oldtime` bigint(20) NOT NULL default '0',
  `avatar` varchar(255) NOT NULL default '',
  `photo` varchar(255) NOT NULL default '',
  `rating` bigint(255) NOT NULL default '0',
  `totalvotes` bigint(20) NOT NULL default '0',
  `votedfor` longtext NOT NULL,
  `rps` int(11) NOT NULL default '1',
  `rpsscore` bigint(20) NOT NULL default '0',
  `lasttime` bigint(20) NOT NULL default '0',
  PRIMARY KEY  (`userID`)
) TYPE=MyISAM AUTO_INCREMENT=6 ;

:)

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



RE: [PHP] My Project

2005-07-19 Thread Jay Blanchard
[snip]
$money -= 10;

saves some chars ;)
[/snip]

This actually requires two trips to the database, once to get $money and
once to update $money. Do it in the query instead...once.

$sqlUpdate = "UPDATE `myDatabase`.`myTable` SET `myMoney` =
(`myMoney`-10) WHERE `myCharacter` = `characterName` ";
$doUpdate = mysql_query($sqlUpdate, $myConnection);

saves lots of characters ;)

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



Re: [PHP] Ok, why is this happening...

2005-07-19 Thread John Nichel

Chris Boget wrote:

Chris Boget wrote:



echo "if( $originalNet != $calculatedNet ) = " . ( (int)$originalNet !==
(int)$calculatedNet ) . "\n";



Change this to echo out what you're comparing...
echo "if( ". (int)$originalNet ." != ". (int)$calculatedNet ." ) = " . (
(int)$originalNet !== (int)$calculatedNet ) . "\n";
That'll show what numbers is actually trying to match.



Ok, then that begs the following questions:

If I don't cast any of the values, why do they display as being identicle?
Additionally, why does every IF check fail in that case?


There's some freaky math going on there or something.  I added a couple 
of other echos in to see and for some reason it seems to be losing 
single digit value (subtracting, rounding down, I don't know).


$calculatedGross  = $originalNet + ( $originalNet * $commissionPct * 0.01 );

echo ( "Gross : " . (int)$calculatedGross ." = ". $originalNet ." + ( ".
$originalNet ." * ". $commissionPct ." *.01 )\n" );

$calculatedNet= $calculatedGross / ( 1 + ( $commissionPct * 0.01 ));

echo ( "Net : " . (int)$calculatedNet." = " . (int)$calculatedGross . " 
/ ( 1 + ( " . $commissionPct . " * .01 ) )\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] getting file size before upload

2005-07-19 Thread Jay Blanchard
[snip]
I know it is a often asked question, but after googling for about 2hours
and 
trying out some wired examples I am still not any closer to a solution.
So I was 
hoping to find expert advice here.

I want to save the user the hastle of uploading a 2MB file and waiting
for a 
long time for an error message that the file is to big.

Is there any usefull workaround in warning the user that he is about to
upload a 
2MB file and only smaller files are supported? I tried around with
megaupload:
http://sourceforge.net/projects/megaupload
to get a progress bar and to get the file size prior to upload, but that
somehow 
does not work the way I want it to.

Is there an easier solution without perl,just with PHP or/and JS?
[/snip]

http://www.php.net/stat

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



[PHP] getting file size before upload

2005-07-19 Thread Merlin

Hi there,

I know it is a often asked question, but after googling for about 2hours and 
trying out some wired examples I am still not any closer to a solution. So I was 
hoping to find expert advice here.


I want to save the user the hastle of uploading a 2MB file and waiting for a 
long time for an error message that the file is to big.


Is there any usefull workaround in warning the user that he is about to upload a 
2MB file and only smaller files are supported? I tried around with megaupload:

http://sourceforge.net/projects/megaupload
to get a progress bar and to get the file size prior to upload, but that somehow 
does not work the way I want it to.


Is there an easier solution without perl,just with PHP or/and JS?

Thank you for any hint on this,

Merlin

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



Re: [PHP] My Project

2005-07-19 Thread André Medeiros
On Tue, 2005-07-19 at 17:57 +0100, Mikey wrote:
> George B wrote:
> 
> > Paul Waring wrote:
> >
> >> On Tue, Jul 19, 2005 at 09:39:21AM -0700, George B wrote:
> >>
> >>> And I have 100 points. How would I make it so when I click BUY!! My 
> >>> money automaticaly subtracts from 100 to 90. How do I do that?
> >>
> >>
> >>
> >> Where is your money being stored? In a database? A text file? A cookie?
> >> Do you want the "buy" link to work on the client side using Javascript
> >> or AJAX or have it submit to a PHP script?
> >>
> >> Paul
> >>
> > My money is being stored in a database. And I want everythign to be in 
> > PHP, no java script. And the BUY!! Button is a input button from a 
> > form. :)
> >
> $money = $money - 10;
> 

$money -= 10;

saves some chars ;)

> I wish you the best of luck with your project :^)
> 
> Mikey
> 

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



Re: [PHP] My Project

2005-07-19 Thread Paul Waring
On Tue, Jul 19, 2005 at 09:50:06AM -0700, George B wrote:
> My money is being stored in a database. And I want everythign to be in 
> PHP, no java script. And the BUY!! Button is a input button from a form. :)

Well in that case you probably want something like this (after you've
checked to see whether the user is logged in etc):

$sql = "UPDATE users SET money = money - 10 WHERE id = " .
$_SESSION['user_id'];

assuming of course that you have a table called users where the money
for each one is stored and you're keeping the user_id in the $_SESSION
superglobal.

It's a bit difficult to help further without a bit more information. :)

Paul

-- 
Rogue Tory
http://www.roguetory.org.uk

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



RE: [PHP] My Project

2005-07-19 Thread André Medeiros
On Tue, 2005-07-19 at 17:46 +0100, Shaw, Chris - Accenture wrote:
> Taxi for one..
> 
> -Original Message-
> From: George B [mailto:[EMAIL PROTECTED]
> Sent: 19 July 2005 17:39
> To: php-general@lists.php.net
> Subject: [PHP] My Project
> 
> 
> Hey guys! This is gona be one of my last questions (hopefully) But here
> I will include all the info about my new project.
> It is going to be like a RPG Game written in PHP. There is going to be a
> store where you could buy weapons etc... The thing I want to ask you
> guys is this. Lets say There is a knife i want to buy. It costs 10
> points. And I have 100 points. How would I make it so when I click BUY!!
> My money automaticaly subtracts from 100 to 90. How do I do that?
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 
> 
> 
> 
> 
> This message has been delivered to the Internet by the Revenue Internet 
> e-mail service
> 
> *
> 

You could read up on AJAX.

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



Re: [PHP] My Project

2005-07-19 Thread Mikey

George B wrote:


Paul Waring wrote:


On Tue, Jul 19, 2005 at 09:39:21AM -0700, George B wrote:

And I have 100 points. How would I make it so when I click BUY!! My 
money automaticaly subtracts from 100 to 90. How do I do that?




Where is your money being stored? In a database? A text file? A cookie?
Do you want the "buy" link to work on the client side using Javascript
or AJAX or have it submit to a PHP script?

Paul

My money is being stored in a database. And I want everythign to be in 
PHP, no java script. And the BUY!! Button is a input button from a 
form. :)



$money = $money - 10;

I wish you the best of luck with your project :^)

Mikey

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



Re: [PHP] My Project

2005-07-19 Thread George B

Paul Waring wrote:

On Tue, Jul 19, 2005 at 09:39:21AM -0700, George B wrote:

And I have 100 points. How would I make it so when I click BUY!! 
My money automaticaly subtracts from 100 to 90. How do I do that?



Where is your money being stored? In a database? A text file? A cookie?
Do you want the "buy" link to work on the client side using Javascript
or AJAX or have it submit to a PHP script?

Paul

My money is being stored in a database. And I want everythign to be in 
PHP, no java script. And the BUY!! Button is a input button from a form. :)


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



RE: [PHP] String with front slashes.....O T

2005-07-19 Thread Jay Blanchard
[snip]
> BTW, my daughter got her learner's permit today!

Damn, you're old.  ;)
[/snip]

You sure you want to say that today? I started late too, most of my high
school friends had their children starting in their 20's ...I was into
my 30's. She is my only child though.

[snip]
I only have a 5yoso that must mean I'm still in my 20's, right?
Right?
[/snip]

Keep believing whatever you need to there, Skippy.

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



Re: [PHP] Ok, why is this happening...

2005-07-19 Thread Chris Boget
> Chris Boget wrote:
> 
> > echo "if( $originalNet != $calculatedNet ) = " . ( (int)$originalNet !==
> > (int)$calculatedNet ) . "\n";
> 
> Change this to echo out what you're comparing...
> echo "if( ". (int)$originalNet ." != ". (int)$calculatedNet ." ) = " . (
> (int)$originalNet !== (int)$calculatedNet ) . "\n";
> That'll show what numbers is actually trying to match.

Ok, then that begs the following questions:

If I don't cast any of the values, why do they display as being identicle?
Additionally, why does every IF check fail in that case?

thnx,
Chris

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



Re: [PHP] My Project

2005-07-19 Thread George B

Shaw, Chris - Accenture wrote:

Taxi for one..

-Original Message-
From: George B [mailto:[EMAIL PROTECTED]
Sent: 19 July 2005 17:39
To: php-general@lists.php.net
Subject: [PHP] My Project


Hey guys! This is gona be one of my last questions (hopefully) But here

I will include all the info about my new project.
It is going to be like a RPG Game written in PHP. There is going to be a

store where you could buy weapons etc... The thing I want to ask you

guys is this. Lets say There is a knife i want to buy. It costs 10

points. And I have 100 points. How would I make it so when I click BUY!!

My money automaticaly subtracts from 100 to 90. How do I do that?

--

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







This message has been delivered to the Internet by the Revenue Internet e-mail 
service

*

taxi? Whats that mean?

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



Re: [PHP] My Project

2005-07-19 Thread Paul Waring
On Tue, Jul 19, 2005 at 09:39:21AM -0700, George B wrote:
> And I have 100 points. How would I make it so when I click BUY!! 
> My money automaticaly subtracts from 100 to 90. How do I do that?

Where is your money being stored? In a database? A text file? A cookie?
Do you want the "buy" link to work on the client side using Javascript
or AJAX or have it submit to a PHP script?

Paul

-- 
Rogue Tory
http://www.roguetory.org.uk

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



RE: [PHP] My Project

2005-07-19 Thread Jay Blanchard
[snip]
Hey guys! This is gona be one of my last questions (hopefully) But here 
I will include all the info about my new project.
It is going to be like a RPG Game written in PHP. There is going to be a

store where you could buy weapons etc... The thing I want to ask you 
guys is this. Lets say There is a knife i want to buy. It costs 10 
points. And I have 100 points. How would I make it so when I click BUY!!

My money automaticaly subtracts from 100 to 90. How do I do that?
[/snip]


You use math.
















Now, actually what you do is keep a database where each player's stats
are tracked. One of the stats is points. When the purchase occurs you
update the data in the player's record. 

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



RE: [PHP] My Project

2005-07-19 Thread Shaw, Chris - Accenture

Taxi for one..

-Original Message-
From: George B [mailto:[EMAIL PROTECTED]
Sent: 19 July 2005 17:39
To: php-general@lists.php.net
Subject: [PHP] My Project


Hey guys! This is gona be one of my last questions (hopefully) But here
I will include all the info about my new project.
It is going to be like a RPG Game written in PHP. There is going to be a
store where you could buy weapons etc... The thing I want to ask you
guys is this. Lets say There is a knife i want to buy. It costs 10
points. And I have 100 points. How would I make it so when I click BUY!!
My money automaticaly subtracts from 100 to 90. How do I do that?

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







This message has been delivered to the Internet by the Revenue Internet e-mail 
service

*

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



Re: [PHP] String with front slashes.....

2005-07-19 Thread John Nichel

Jay Blanchard wrote:


BTW, my daughter got her learner's permit today!


Damn, you're old.  ;)

I only have a 5yoso that must mean I'm still in my 20's, right?  Right?

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



[PHP] My Project

2005-07-19 Thread George B
Hey guys! This is gona be one of my last questions (hopefully) But here 
I will include all the info about my new project.
It is going to be like a RPG Game written in PHP. There is going to be a 
store where you could buy weapons etc... The thing I want to ask you 
guys is this. Lets say There is a knife i want to buy. It costs 10 
points. And I have 100 points. How would I make it so when I click BUY!! 
My money automaticaly subtracts from 100 to 90. How do I do that?


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



Re: [PHP] Ok, why is this happening...

2005-07-19 Thread John Nichel

Chris Boget wrote:


echo "if( $originalNet != $calculatedNet ) = " . ( (int)$originalNet !==
(int)$calculatedNet ) . "\n";



Change this to echo out what you're comparing...

echo "if( ". (int)$originalNet ." != ". (int)$calculatedNet ." ) = " . ( 
(int)$originalNet !== (int)$calculatedNet ) . "\n";


That'll show what numbers is actually trying to match.

--
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] String with front slashes.....

2005-07-19 Thread Jay Blanchard
[snip]
I'd say it would be best to keep that slash out of the filename.  Do a 
regex on the string before doing anything else

preg_replace ( "/\//", "-", $string );
[/snip]

That is what I ultimately told them, "Don't do that." Of course they
looked at me like I was a space alien (which I am today, but that's not
important now). I asked if they wanted to know the technical bits to
which they all vigorously shook their heads. But I will check the
strings and *ahem* 'fix' them just in case.

BTW, my daughter got her learner's permit today!

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



Re: [PHP] String with front slashes.....

2005-07-19 Thread John Nichel

Jay Blanchard wrote:

I have the potential for strings where the string will contain a front
slash;

index_Foo_Communications_c/o_Bar_Enterprises_20050718

I want to use the string to name a text file

index_Foo_Communications_c/o_Bar_Enterprises_20050718.txt

but it always fails to open the file because of the front slash. I have
completely brain farted on how to escape this (perhaps only 2 hours of
sleep last night) and I cannot find what I am looking for in the manual.
addslashes? mysql_real_escape_string? nope...nope...ack. Coffee...where
is the coffee? What do you mean, "I didn't make any more?" Are you new
here?


I'd say it would be best to keep that slash out of the filename.  Do a 
regex on the string before doing anything else


preg_replace ( "/\//", "-", $string );

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



[PHP] String with front slashes.....

2005-07-19 Thread Jay Blanchard
I have the potential for strings where the string will contain a front
slash;

index_Foo_Communications_c/o_Bar_Enterprises_20050718

I want to use the string to name a text file

index_Foo_Communications_c/o_Bar_Enterprises_20050718.txt

but it always fails to open the file because of the front slash. I have
completely brain farted on how to escape this (perhaps only 2 hours of
sleep last night) and I cannot find what I am looking for in the manual.
addslashes? mysql_real_escape_string? nope...nope...ack. Coffee...where
is the coffee? What do you mean, "I didn't make any more?" Are you new
here?

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



[PHP] Ok, why is this happening...

2005-07-19 Thread Chris Boget
Consider the following test script:



  set_time_limit( 0 );

  echo '';
  echo 'Test Rounding Net Premium';
  echo '';

  echo 'Running test...
'; flush(); echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; $numberOfFailures = 0; for( $originalNet = 1; $originalNet <= 10005; $originalNet++ ) { for( $commissionPct = 1; $commissionPct <= 20; ( $commissionPct += .1 )) { $calculatedGross = $originalNet + ( $originalNet * $commissionPct * .01 ); $calculatedNet= $calculatedGross / ( 1 + ( $commissionPct * .01 )); echo "if( $originalNet != $calculatedNet ) = " . ( (int)$originalNet !== (int)$calculatedNet ) . "
\n"; if( (int)$originalNet !== (int)$calculatedNet ) { $numberOfFailures++; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; flush(); } } } echo '
Original NetCommission %Calculated GrossCalculated Net
' . $originalNet . '' . $commissionPct . '%' . $calculatedGross . '' . $calculatedNet . '
'; if( 0 < $numberOfFailures ) { echo number_format( $numberOfFailures ) . ' calculations failed to match the original net premium.
'; } echo ''; echo ''; Why is the if( (int)$originalNet !== (int)$calculatedNet ) failing some times even though they are the exact same value? I've tried using just the != comparison operator, I've tried casting the values (as seen above) I've tried testing to see if the values are either less than or greater than one another (as a test for inequality). I just can't figure out why in the world the IF is showing the values are inequal when you can view the output and see they are exactly equal. What's going on? thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] Can PHP Talk directly to Oracle w/o Using Listener

2005-07-19 Thread Jay Blanchard
[snip]
Does PHP have the ability to talk directly to a local oracle database
w/o the need for a listener?
[/snip]

Yes. http://us2.php.net/oracle

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



[PHP] Solaris 9/Oracle 10g Compile Time Problems

2005-07-19 Thread Chuck Carson
How do you build php 5.0.4 with support for oracle 10.2 on Solaris 9?
I am getting the following compile time error?


z -liconv -lm -lsocket -lnsl -lxml2 -lz -liconv -lm -lsocket -lnsl
-lnsl -lsocket -lgen -ldl -lclntsh -lxml2 -lz -liconv -lm -lsocket
-lnsl -lxml2 -lz -liconv -lm -lsocket -lnsl  -o libphp5.la
ld: fatal: file /u01/app/oracle/product/10.2/lib/libclntsh.so: wrong
ELF class: ELFCLASS64
ld: fatal: File processing errors. No output written to .libs/libphp5.so
*** Error code 1
make: Fatal error: Command failed for target `libphp5.la'

Thanks,
CC

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



[PHP] Can PHP Talk directly to Oracle w/o Using Listener

2005-07-19 Thread Chuck Carson
Does PHP have the ability to talk directly to a local oracle database
w/o the need for a listener?

Thx,
CC

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



[PHP] preg_match_all question

2005-07-19 Thread Chris Bruce

Hello,

I am using the following to do link replacing:

preg_match_all("/<\s*a\s+[^>]*href\s*=\s*[\"']?([^\"' >]+)[\"' 
>]/isU",$file[$x],$matches);


It works great for all but 'https' links. I am not that versed in 
regular expressions. Would anyone know what I need to put in there so 
that it will match on https links?


Thanks,

Chris


[PHP] "Only variable references should be returned by reference"

2005-07-19 Thread Marc G. Fournier


Just upgraded to 4.4.0 ... several "legacy applications" that we have 
installed now break with the above error message ... specifically, older 
installs of Horde, but I've seen reports of other apps ...


Without reverting back to 4.3.11, is there a way I can temporarily fix 
this while working on the application issues themselves? :(


Thanks ...


Marc G. Fournier   Hub.Org Networking Services (http://www.hub.org)
Email: [EMAIL PROTECTED]   Yahoo!: yscrappy  ICQ: 7615664

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



Re: [PHP] show a field in php file

2005-07-19 Thread John Nichel

Jochem Maas wrote:


**Non-Researched Basic Stuff - from John Nichel, eventually I'll be able to
leave off the footnote :-P


Cool, I've left my mark on history.  An Internet acronym to my credit; 
my life is complete. ;)


--
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] show a field in php file

2005-07-19 Thread Jochem Maas

George B wrote:

Jochem Maas wrote:


John Nichel wrote:


George B wrote:


http://us2.php.net/manual/en/index.php



:-) anyone care for a php mysql extension:

mysql_do_xml_http_request_bound_richdatagrid([string] query);

george if you want to keep asking questions on NRBS**
then you'll need to change email addrs + name :-)

** from Johns 'non-researched basic stuff' I like the way
the BS comes out ... :-P


what is it wrong to ask questions on a php general mailing list where I 
know there are a bunch of people that can help? I do have a php book But 


it's just that what you ask and how (coupled with the frequency)
determines the response you get, if any.

your general attitude, the number of posts you answer, etc, etc all
play a part. e.g. as is regularly mentioned you don't argue with Rasmus,
why? because he wrote the original php, still actively develops it, runs
yahoo, and _still_ has time answer posts on this list... basically
he know more than you and has enough 'credits' in phpland to buy the
bank (so to speak) -

...you blew most of your startup 'credits' already, so now you are 'forced'
do a lot of increaseKnowledge() where:

function increaseKnowledge()
{
while (kowledgeSucks()) {
readTheManual();
SearchTheWeb();
writeSomeCode();
}   
}

then come back to the list when you are _really_ stuck and you can
explain the problem and what you have tried so far in _detail_...
if you do that then you'll almost garantee yourself and answer

there are no hard and fast rules regarding this but the consensus
is 'try harder please George' ... basically NRBS** doesn't entice people
to spend time working on _your_ problem.


it dosent show. Why can other people ask questions but I cant?


which book? show what? be specific, do research - google is your friend
(that's beginning to sound like something bigbrother would say).

regarding "Why can other people ask questions but I cant?" ... er?
that is a question, you asked it, ergo the question moot is moot...
what you should be asking is why other people get better answers ...
hopefully you get that now, anyway good to see you reading other people
threads.

rgds,
Jochem

**Non-Researched Basic Stuff - from John Nichel, eventually I'll be able to
leave off the footnote :-P





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



Re: [PHP] show a field in php file

2005-07-19 Thread John Nichel

George B wrote:

Jochem Maas wrote:


John Nichel wrote:


George B wrote:


http://us2.php.net/manual/en/index.php



:-) anyone care for a php mysql extension:

mysql_do_xml_http_request_bound_richdatagrid([string] query);

george if you want to keep asking questions on NRBS**
then you'll need to change email addrs + name :-)

** from Johns 'non-researched basic stuff' I like the way
the BS comes out ... :-P


what is it wrong to ask questions on a php general mailing list where I 
know there are a bunch of people that can help? I do have a php book But 
it dosent show. Why can other people ask questions but I cant?




It's not that you can't ask questions, it's that it's bad form to ask 
numerous questions to which the answers are well documented.  The people 
on this list aren't here to hold someone's hand or write the code for 
that person; we're here to help solve problems (or ask for help with 
problems of our own).  The questions you have been asking are really 
basic, and if your book doesn't cover the answers, you need to look into 
getting a new book.  The online PHP manual is an excellent place to find 
answers to the questions you've been asking, as is the mailing list 
archives.  This list shouldn't be your first stop when you encounter a 
road block.  Check the manual, the archives, and Google first.  9 times 
out of 10, you'll find your answer there quicker.


--
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] mysql problem- I know it isn't strictly php

2005-07-19 Thread Jay Blanchard
[snip]
1064 - You have an error in your SQL syntax.  Check the manual that 
corresponds to your MySQL server version for the right syntax to use
near 
'DEFAULT CHARSET=latin1 AUTO_INCREMENT=303' at line 18

and this is what the manual  says (not very helpful)

a.. Error: 1064 SQLSTATE: 42000 (ER_PARSE_ERROR)

Message: %s near '%s' at line %d

Any help will be appreciated.
[/snip]

There is nothing PHP here, but you knew that when you pressed send.

Really there are a lot of MySQL gurus on this list. There are a lot more
on mysql@lists.mysql.com

You're problem is likely related to the version of MySQL that you are
running, perhaps it doesn't support CHARSET definitions.

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



RE: [PHP] Question about apache-php concurrent process control

2005-07-19 Thread Liang ZHONG

Can somebody here help me to delete my message?
People who read this must be laughing at me.
:)



It seems Rasmus is famous, and I should have shown my respect.


PHP succeeds an older product, named PHP/FI. PHP/FI was created by Rasmus
Lerdorf in 1995, initially as a simple set of Perl scripts for tracking
accesses to his online resume. He named this set of scripts 'Personal Home
Page Tools'. As more functionality was required, Rasmus wrote a much larger 
C

implementation, which was able to communicate with databases, and enabled
users to develop simple dynamic Web applications. Rasmus chose to release 
the

source code for PHP/FI for everybody to see, so that anybody can use it, as
well as fix bugs in it and improve the code. 




This message has been delivered to the Internet by the Revenue Internet 
e-mail service


*


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



[PHP] mysql problem- I know it isn't strictly php

2005-07-19 Thread Ross
Hi all,

I am trying to create a table on the remote server but it never seems to 
work

CREATE TABLE `sheet1` (
  `id` int(10) NOT NULL auto_increment,
  `title` varchar(255) NOT NULL default '',
  `fname` varchar(255) NOT NULL default '',
  `sname` varchar(255) default NULL,
  `job_title` varchar(255) default NULL,
  `organisation` varchar(255) default NULL,
  `email` varchar(255) default NULL,
  `street` varchar(255) default NULL,
  `city` varchar(255) default NULL,
  `postcode` varchar(255) default NULL,
  `office_tel` varchar(255) default NULL,
  `mobile` varchar(255) default NULL,
  `fax` varchar(255) default NULL,
  `web` varchar(255) default NULL,
  `add_info` varchar(255) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=303 ;


There seems to be a problem with the last line (this is exported from my 
local server). I am just learning about mySql as I go so have no real clue 
about CHARSET and ENGINE (which I believe may be the problem)

This is the error

1064 - You have an error in your SQL syntax.  Check the manual that 
corresponds to your MySQL server version for the right syntax to use near 
'DEFAULT CHARSET=latin1 AUTO_INCREMENT=303' at line 18

and this is what the manual  says (not very helpful)

a.. Error: 1064 SQLSTATE: 42000 (ER_PARSE_ERROR)

Message: %s near '%s' at line %d


Any help will be appreciated.

R. 

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



Re: [PHP] Question about apache-php concurrent process control

2005-07-19 Thread Liang ZHONG

Hi André,

It sounds interesting. But since I am pretty new to PHP, I have some 
questions, naive maybe, about what you wrote.


"#!/bin/sh\n/path/to/script/Send.php 12 &\n"

What does the Send.php look like? I do not have idea how a shell interprets 
an php script and what the parameter 12 means here. If you do not mind, 
could you please also let me look at your Send.php?


Thank you very much.


I did something like that for a newsletter sending script. Basiclly, I
had two scripts:

a) AddEdit.php that would list the newsletter's items and allow it to send
b) Send.php that was a script I ran on the background

When pressed "Send" on AddEdit, it would do something like

$tempName = tempnam( '/tmp', 'newsletter' );
$fp = fopen( $tempName, 'w+' );
fputs( $fp, "#!/bin/sh\n/path/to/script/Send.php 12 &\n" );
fclose( $fp );
chmod( $tempName, 0755 );
system( $tempName . ' &' );

That way, it would launch the second script into the background,
checking if the script altered the newsletter's state for "Sent"
everytime a user saw the newsletter's details.

Hope it helped.



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



RE: [PHP] Question about apache-php concurrent process control

2005-07-19 Thread Shaw, Chris - Accenture

It seems Rasmus is famous, and I should have shown my respect.


PHP succeeds an older product, named PHP/FI. PHP/FI was created by Rasmus
Lerdorf in 1995, initially as a simple set of Perl scripts for tracking
accesses to his online resume. He named this set of scripts 'Personal Home
Page Tools'. As more functionality was required, Rasmus wrote a much larger C
implementation, which was able to communicate with databases, and enabled
users to develop simple dynamic Web applications. Rasmus chose to release the
source code for PHP/FI for everybody to see, so that anybody can use it, as
well as fix bugs in it and improve the code. 




This message has been delivered to the Internet by the Revenue Internet e-mail 
service

*

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



Re: [PHP] Question about apache-php concurrent process control

2005-07-19 Thread Liang ZHONG


Thank you Rouvas,

I never used the tools you mentioned. But I will definitely give them a try. 
I wrote a perl script using LWP as an http user agent. and the timing 
function you suggested. It works well.


I am new to this forum, and new to PHP. It seems Rasmus is famous, and I 
should have shown my respect.


Thanks again all of you for your kindly help.



Hi Liang,

trying to get conclusive results with browsers is futile. Use a 
command-line
tool (like curl) to invoke the web pages and get the results. Or you can 
use

PHP's own function to query the web server and do your own timing with
microtime() function or another suitable for your purposes.

In order for flush() results to reach you (in a browser) they have to pass
from multiple caches like PHP's, Apache's, the occasional proxies and 
finally
the browser's own cache. So you cannot get dependaple results measuring 
times

or responses from your browser. Try the methods above.

And a final tip... When Rasmus speaks, you don't question him:-) Period.

Have a nice day,
-Stathis



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



[PHP] PHP CERT. Question

2005-07-19 Thread Joseph
Is there a list which deals with basic certification questions and 
anxieties? I got the 'official' Zend study guide and now believe I know 
nothing. And the practice book has quests whose subjects are not 
mentioned in the relevant chapters. If someone else has completed the 
exam, which text did you use to prepare? I know O'reilly has Programming 
PHP, but I fear trying to parse out what I need to know might be a 
little difficult form that book...any ideas?


Thanks for any help or redirection,
jozef

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



Re: [PHP] show a field in php file

2005-07-19 Thread Raz
Hey George...

On 19/07/05, Jay Blanchard <[EMAIL PROTECTED]> wrote:

> It is not that you cannot ask questions, it is that your questions show
> a basic lack of research. The answers to the questions you have asked
> are easily gotten from the manual, tutorials, and good books on PHP
> development. 

For instance, take a look at:
http://www.php.net/manual/en/ref.mysql.php - this is the first page in
the reference manual about mysql. 'bout a third down the page
is...'Example 1. MySQL extension overview example' copy, paste, amend
as required and run. Doesn't work? PHP manual -> google ->
bookand...

...if then you don't understand, come back and ask - least it shows an
ounce of initiative which is what most on this list would like to see
;)

Raz

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



RE: [PHP] show a field in php file

2005-07-19 Thread Jay Blanchard
[snip]
what is it wrong to ask questions on a php general mailing list where I 
know there are a bunch of people that can help? I do have a php book 
But it dosent show. Why can other people ask questions but I cant?
[/snip]

It is not that you cannot ask questions, it is that your questions show
a basic lack of research. The answers to the questions you have asked
are easily gotten from the manual, tutorials, and good books on PHP
development. Which book do you have?

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



Re: [PHP] sytax errors

2005-07-19 Thread Raz
> Its giving the line number. But actually i want to know the correct syntax 
> for concatenation. I think all there is some mistake in all the three 
> concatination statements.
> 
No - there is no problem with any of the statements per se, but there
may be when executed with $adduser, $addpass etc. Why not take the
advice of Mark Rees and echo the $sqlstmt etc and show us the output?

Raz

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



Re: [PHP] sytax errors

2005-07-19 Thread babu
Hi,
 
Its giving the line number. But actually i want to know the correct syntax for 
concatenation. I think all there is some mistake in all the three concatination 
statements.
 
so could some one check and give some idea.
thanks


John Nichel <[EMAIL PROTECTED]> wrote:
babu wrote:
> Hi,
> 
> could someone please check where the sytax error is in these statements.
> 
> $sqlstmt= "EXEC sp_addlogin ".$adduser." , ".$addpass;
> $sqlstmt1= "EXEC sp_adduser @loginame= ".$adduser." , @name_in_db= ".$adduser;
> $sqlstmt2= "GRANT CREATE TABLE TO ".$adduser;
> $sql=mssql_query($sqlstmt);
> $sql1=mssql_query($sqlstmt1);
> $sql2=mssql_query($sqlstmt2);

Didn't php give you a line number?

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



-
Yahoo! Messenger NEW - crystal clear PC to PCcalling worldwide with voicemail

Re: [PHP] sytax errors

2005-07-19 Thread Mark Rees
"John Nichel" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> babu wrote:
> > Hi,
> >
> > could someone please check where the sytax error is in these statements.
> >
> > $sqlstmt= "EXEC sp_addlogin ".$adduser." , ".$addpass;
> > $sqlstmt1= "EXEC sp_adduser  @loginame= ".$adduser." , @name_in_db=
".$adduser;
> > $sqlstmt2= "GRANT CREATE TABLE TO ".$adduser;
> > $sql=mssql_query($sqlstmt);
> > $sql1=mssql_query($sqlstmt1);
> > $sql2=mssql_query($sqlstmt2);
>
> Didn't php give you a line number?

Is it a php or mysql syntax error? If the latter, please echo $sqlstmt etc
and show us the output
>
> --
> 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] Date function and MySQL

2005-07-19 Thread Arno Coetzee

Philip Thompson wrote:


Hi all.

I have the week number (for example, this is the 29th week of the  
year and it begins on 7/17/05). Does anyone know how to obtain the  
first (and maybe the last) date of the week if you only know the week  
number of the year? Would it be better for me to obtain this in PHP  
or MySQL? or both?


I have researched the archives on a few lists and I know that others  
have asked this same questions, but I have not found a good solution.  
I have also looked on MySQL's "date and time functions" page, but had  
little luck.


Any thoughts would be appreciated.
~Philip


Hi Philip

give this a go... i played around with the date functions of mysql

select date_sub(curdate() , interval (date_format(curdate() , '%w')-1) 
day) as firstday , date_add(curdate() , interval (7 - 
date_format(curdate() , '%w')) day) as lastday


it will give you the date of the monday and the sunday of the current week

hope this solves your problem.

Arno

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



Re: [PHP] Tracking a mobile phone

2005-07-19 Thread Tom Rogers
Hi,

Tuesday, July 19, 2005, 5:15:10 AM, you wrote:
T> Hi there,

 

T> I was wondering if anybody has attempted to track a mobile phone through a
T> country. I know that this is usually more a case for the FBI . a friend of
T> mine is going on a 4 month bike tour and I would like to 'track' him for
T> locations. I thought of an sms receiving system, but if could do any other
T> way would be great.

 

T> Any ideas?

 

T> Thomas


This may be of interest :)

http://www.aspicore.com/en/tuotteet_tracker.asp?tab=2&sub=4

Funny enough it looks a php solution.

-- 
regards,
Tom

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



Re: [PHP] Is there a way to get a variable name as a string?

2005-07-19 Thread Burhan Khalid

Rasmus Lerdorf wrote:

Daevid Vincent wrote:


Is there a way to get the name of a variable as a string? For example...



Nope, not possible.


Well

ob_start();
echo '$var';
$contents = ob_get_contents();
ob_end_clean();

echo 'Variable Name is : '.substr($contents,strpos($contents,'$')+1);

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



Re: [PHP] Tracking a mobile phone

2005-07-19 Thread Burhan Khalid
Please add OT to the subject if the topic has nothing to do with PHP. OT 
= Off Topic.


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



Re: [PHP] PHP from CLI with SAPI

2005-07-19 Thread Burhan Khalid

Fredrik Tolf wrote:

Hi!

I've begun to be more and more displeased with Apache lately, so I've
been thinking of writing my own HTTP server instead. I still want PHP
support, but writing a new SAPI for PHP seems like overkill.


What's so bad about Apache?



Therefore, is it possible to use PHP from the command line, but still
enable some HTTP-server-only stuff, like GET and POST variables,
cookies, session management, file uploads, and so on? I haven't been
able to find any docs on doing that, but I'm thinking that it should be
possible.


No, not really.  $_GET and $_POST are populated by PHP from information 
from the HTTP request (which, obviously, isn't available in CLI mode).


In CLI, there is no concept of cookies, sessions (as there are in web 
world), file uploads, etc.  What you get is what you would recieve with 
any CLI app, command line parameters, and access to the system calls 
that you can execute using exec() and friends.


I'm not really sure why you want to write your own HTTP server, as this 
has been done many times over the years.  What exactly are your issues 
with Apache?



So, can someone either point me to some docs in this, or, lacking such,
give me a short intro to it?


For a decent CLI script, you will need to access the command line 
arguments, for which there is a great PHP class over at PEAR.  There you 
will also find classes for color output on the console and other classes 
that you will find useful.


FWIW,
Burhan

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