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

2005-07-20 Thread Nadim Attari
Hello,

I've changed the codes. Please run this one to view the results.
The notable change is:

$calculatedGross  = $originalNet * (1.000 + ($commissionPct * 0.010));

Regards,
Nadim Attari
Alienworkers.com

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

 flush();

 echo '';
 echo ' ';
 echo '   Index';
 echo '   Original Net';
 echo '   Commission %';
 echo '   Calculated Gross';
 echo '   Calculated Net';
 echo '   Result';
 echo '   Comparisson';
 echo ' ';

 $numberOfFailures = 0;
 $index = 0;

 for ($originalNet = 1.000; $originalNet <= 10005.000; $originalNet++)
 {
  for ($commissionPct = 1.000; $commissionPct <= 20.000; ($commissionPct +=
0.100))
  {
   $calculatedGross  = $originalNet * (1.000 + ($commissionPct * 0.010));
   $calculatedNet= $calculatedGross / (1.000 + ($commissionPct *
0.010));

   $comparisson = "if ($originalNet !== $calculatedNet) = " . (($originalNet
!== $calculatedNet) ? 'Condition true, it is not equal' : 'Condition false,
it is equal') . "\n";
   if ($originalNet !== $calculatedNet)
   {
$numberOfFailures++;
$result = 'NEQ';
   }
   else
   {
$result = 'EQ';
   }

   echo '';
   echo '  ' . ++$index  . '.';
   echo '  ' . round($originalNet, 2)  . '';
   echo '  ' . round($commissionPct, 2) . ' %';
   echo '  ' . round($calculatedGross, 2) . '';
   echo '  ' . round($calculatedNet, 2) . '';
   echo '  ' . $result  . '';
   echo '  ' . $comparisson. '';
   echo '';

   flush();
  }
 }

 echo '';

 echo "# of calculations failed to match the original net premium =
$numberOfFailures";

 echo '';
 echo '';
?>

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



[PHP] checking for internet connection

2005-07-20 Thread Steven Sher

Hi

I am looking for a simple way to check if the server is connected to the 
Internet, they use a dialup to get Internet connection, and I need to 
email reports out, but want to check to see if the user remembered to 
connect to the Internet first.  If anybody has a nice script, or just a 
suggestion on a php function I could use to test for an Internet connection.


Thanks
steve

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

[PHP] checking for internet connection

2005-07-20 Thread Steven

Hi

I am looking for a simple way to check if the server is connected to the
Internet, they use a dialup to get Internet connection, and I need to
email reports out, but want to check to see if the user remembered to
connect to the Internet first.  If anybody has a nice script, or just a
suggestion on a php function I could use to test for an Internet connection.

Thanks
steve

--
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-20 Thread kalinga
this seems pretty interesting, i'm tring to write a code in php to get
those two outputs, but bit confused in counting weeks. could somebody
clear me..

"what is the first *date* of the first week of year 2005?"

is it "saturday jan 1st 2005" (assuming first week starts from jan 1
of any year)
or
is it "sunday jan 3rd 2005" (assuming first day of a week is monday)
or
anything else.

thanks

vk.



On 7/19/05, Arno Coetzee <[EMAIL PROTECTED]> wrote:
> 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
> 
>

--
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-20 Thread Mark Rees
An alternative (and more user-friendly) approach is to have the form's
action as itself (i.e. the form on contact.php submits to contact.php). You
can then identify which fields are incomplete and highlight them in the
form. This will make it easier for users to see what they have done wrong
and make the necessary corrections.

This is what print does
http://uk2.php.net/manual/en/function.print.php

echo
http://uk2.php.net/echo

and the difference is discussed here, although it probably won't concern you
too much for the moment.
http://www.faqts.com/knowledge_base/view.phtml/aid/1/fid/40


"Bruce Gilbert" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
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] checking for internet connection

2005-07-20 Thread James
Assuming they connect to check their email every now and then, you do 
realize people will still receive your email regardless of whether their 
connection is up or not?


The emails reside on the email server until the user retrieves them.

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

To: "PHP General" 
Sent: Wednesday, July 20, 2005 3:49 AM
Subject: [PHP] checking for internet connection



Hi

I am looking for a simple way to check if the server is connected to the
Internet, they use a dialup to get Internet connection, and I need to
email reports out, but want to check to see if the user remembered to
connect to the Internet first.  If anybody has a nice script, or just a
suggestion on a php function I could use to test for an Internet 
connection.


Thanks
steve

--
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] problems with self referential sticky forms

2005-07-20 Thread Mark Rees

"eoghan" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On 20 Jul 2005, at 02:22, Linda H wrote:
>
> > fahreheit is here:
> >
> >  > $fahr = $_GET['fahrenheit'];
> > if (is_null($fahr)){ echo 'fahr is null';}
> > $>
> >
> > The error was on the line: $fahr = $_GET['fahrenheit'];
>
> try:
> 

Do as previously suggested and check that

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

(although since you are dealing with a string here, perhaps an empty string
''might be a better bet than null)
then your test is

if($fahr==''){echo 'fahr is empty');

note the semicolon at the end of each line, and your closing php tag should
be ?>, not $>

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



[PHP] Re: checking for internet connection

2005-07-20 Thread Mark Rees

"Steven" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi
>
> I am looking for a simple way to check if the server is connected to the
> Internet, they use a dialup to get Internet connection, and I need to
> email reports out, but want to check to see if the user remembered to
> connect to the Internet first.  If anybody has a nice script, or just a
> suggestion on a php function I could use to test for an Internet
connection.
>

You could try curl or fsockopen to see if there is a connection. But really,
is this necessary? You don't test to see if the computer's plugged in, do
you? So why test for this? Surely your user will have enough nous to connet
to the internet forst, and if they don't, then it just won't work.


> Thanks
> steve

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



[PHP] Garbage in odbc_connect error

2005-07-20 Thread Vandana Ponnuru
Hi all,

 I have PHP-4.3.10 and Apache-2.0 running on a Redhat 9
machine. I am connecting to DB2 using the odbc API. I have different
applications running connecting to different databases and the
applications were all running perfectly fine. But now, odbc_connect
fails with some garbage in the SQL error code (error code pasted
below), when connecting to one particular database. (Connections to
other databases are still working fine). Connecting to the database
directly (without using PHP, from the DB2 command prompt) does not
give any errors, though. Since the error messages are not readable, I
am not able to go further on this. Please advice as to how I should
proceed.

Warning: odbc_connect(): SQL error: |U', SQL state ýÿÿÿA in
SQLConnect in /var/www/html/fvt/functions.php on line 87


Thanks.

--
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-20 Thread kalinga
> > > 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 did a little coding, try this and give me any comments.. 

";
echo "Start Date: " . date("j-M-Y (l)",($suts));
echo "";
//518000 = 6 days in seconds
echo "Last Date: " . date("j-M-Y (l)",($suts+518400));
echo "";

?>


happy coding

vk.


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

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



[PHP] MYSQL translator

2005-07-20 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.

If you are interested in, please ask me to send you the related PHP code by
e-mail: [EMAIL PROTECTED]

I look forward to your feedbacks.

Alessandro Rosa

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



RE: [PHP] My Project

2005-07-20 Thread Jay Blanchard
[snip]
> >> 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.
[/snip]

Anyone else want to go for shorter? :)

The reason is George, as someone so aptly pointed out, it appears that
you have jumped in without any basic knowledge. And thus far we have all
been nice (because we usually get chided for our terseness). So let me
be the first to say RTFM, STFW and STFA and get a better book such as
PHP and MySQL Development (Welling and Thomson) or one of a dozen
others. Google for PHP tutorials. Read them, try them, learn them. Now
let me explain where you went wrong above

Your table needs two columns, one for money and one for characterName.
Make money decimal(8,2) and characterName char(64) then do the following
query

INSERT INTO `money` (`money`, `characterName`) VALUES ('100.00',
'Village_Id10t');

Now do a select from the table to see the values entered. See them?
Good!

Now perform the following query;

$sqlUpdate = "UPDATE `money` SET `money` =
(`money`-10) WHERE `characterName` = `Village_Id10t` ";
$doUpdate = mysql_query($sqlUpdate, $myConnection);

Now do a select again and look at the values, did it work? Excellent!
Run this query;

$sqlUpdate = "UPDATE `money` SET `money` =
(`money`-10) WHERE `characterName` = `Town_Drunk` ";
$doUpdate = mysql_query($sqlUpdate, $myConnection);

Now do a select from the table and note that the value of money did not
change. The reason is because there is no Town_Drunk in the money table.
Does that make sense? Wonderful!

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



Re: [PHP] My Project

2005-07-20 Thread Joseph

Jay Blanchard wrote:


[snip]
 


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.
   


[/snip]

Anyone else want to go for shorter? :)

The reason is George, as someone so aptly pointed out, it appears that
you have jumped in without any basic knowledge. And thus far we have all
been nice (because we usually get chided for our terseness). So let me
be the first to say RTFM, STFW and STFA and get a better book such as
PHP and MySQL Development (Welling and Thomson) or one of a dozen
others. Google for PHP tutorials. Read them, try them, learn them. Now
let me explain where you went wrong above

Your table needs two columns, one for money and one for characterName.
Make money decimal(8,2) and characterName char(64) then do the following
query

INSERT INTO `money` (`money`, `characterName`) VALUES ('100.00',
'Village_Id10t');

Now do a select from the table to see the values entered. See them?
Good!

Now perform the following query;

$sqlUpdate = "UPDATE `money` SET `money` =
(`money`-10) WHERE `characterName` = `Village_Id10t` ";
$doUpdate = mysql_query($sqlUpdate, $myConnection);

Now do a select again and look at the values, did it work? Excellent!
Run this query;

$sqlUpdate = "UPDATE `money` SET `money` =
(`money`-10) WHERE `characterName` = `Town_Drunk` ";
$doUpdate = mysql_query($sqlUpdate, $myConnection);

Now do a select from the table and note that the value of money did not
change. The reason is because there is no Town_Drunk in the money table.
Does that make sense? Wonderful!

 


lol, jay that was beautiful

Both the PHP and MySQL manuals are great tools and should be consulted 
first. Youe ambition is nice, but you will get nowhere if you do not 
learn how to do these things on your own.

--jzf

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



RE: [PHP] My Project

2005-07-20 Thread Jim Moseby
> 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());
> 

Still wasteful.  How about 

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

:) 

JM

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



Re: [PHP] My Project

2005-07-20 Thread John Nichel

Jay Blanchard wrote:


been nice (because we usually get chided for our terseness).



I noticed that Jason appears to be back...the kid gloves will be off now. ;)

--
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] "Only variable references should be returned by reference"

2005-07-20 Thread Robert Cummings
On Wed, 2005-07-20 at 02:42, Rasmus Lerdorf wrote:
> Robert Cummings wrote:
> [-- snippity --]
> > 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
> [-- snippity --]

Actually I forgot to mention one of the most obvious relief
mechanisms... fix the problem :)

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] My Project

2005-07-20 Thread Matt Darby

It *is* a great book (I cut my teeth with it as well):
PHP and MySQL Development (Welling and Thomson)
http://www.amazon.com/exec/obidos/tg/detail/-/0672326728/qid=1121869940/sr=8-1/ref=pd_bbs_1/002-5827183-4477639?v=glance&s=books&n=507846

Read it, learn it, live it.

Matt Darby

Jay Blanchard wrote:


[snip]
 


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.
   


[/snip]

Anyone else want to go for shorter? :)

The reason is George, as someone so aptly pointed out, it appears that
you have jumped in without any basic knowledge. And thus far we have all
been nice (because we usually get chided for our terseness). So let me
be the first to say RTFM, STFW and STFA and get a better book such as
PHP and MySQL Development (Welling and Thomson) or one of a dozen
others. Google for PHP tutorials. Read them, try them, learn them. Now
let me explain where you went wrong above

Your table needs two columns, one for money and one for characterName.
Make money decimal(8,2) and characterName char(64) then do the following
query

INSERT INTO `money` (`money`, `characterName`) VALUES ('100.00',
'Village_Id10t');

Now do a select from the table to see the values entered. See them?
Good!

Now perform the following query;

$sqlUpdate = "UPDATE `money` SET `money` =
(`money`-10) WHERE `characterName` = `Village_Id10t` ";
$doUpdate = mysql_query($sqlUpdate, $myConnection);

Now do a select again and look at the values, did it work? Excellent!
Run this query;

$sqlUpdate = "UPDATE `money` SET `money` =
(`money`-10) WHERE `characterName` = `Town_Drunk` ";
$doUpdate = mysql_query($sqlUpdate, $myConnection);

Now do a select from the table and note that the value of money did not
change. The reason is because there is no Town_Drunk in the money table.
Does that make sense? Wonderful!

 



Re: [PHP] My Project

2005-07-20 Thread Edward Vermillion

Matt Darby wrote:

It *is* a great book (I cut my teeth with it as well):
PHP and MySQL Development (Welling and Thomson)
http://www.amazon.com/exec/obidos/tg/detail/-/0672326728/qid=1121869940/sr=8-1/ref=pd_bbs_1/002-5827183-4477639?v=glance&s=books&n=507846 



Read it, learn it, live it.

Matt Darby

Jay Blanchard wrote:


[snip]
 


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.
  


[/snip]

Anyone else want to go for shorter? :)

The reason is George, as someone so aptly pointed out, it appears that
you have jumped in without any basic knowledge. And thus far we have all
been nice (because we usually get chided for our terseness). So let me
be the first to say RTFM, STFW and STFA and get a better book such as
PHP and MySQL Development (Welling and Thomson) or one of a dozen
others. Google for PHP tutorials. Read them, try them, learn them. Now
let me explain where you went wrong above

Your table needs two columns, one for money and one for characterName.
Make money decimal(8,2) and characterName char(64) then do the following
query

INSERT INTO `money` (`money`, `characterName`) VALUES ('100.00',
'Village_Id10t');

Now do a select from the table to see the values entered. See them?
Good!

Now perform the following query;

$sqlUpdate = "UPDATE `money` SET `money` =
(`money`-10) WHERE `characterName` = `Village_Id10t` ";
$doUpdate = mysql_query($sqlUpdate, $myConnection);

Now do a select again and look at the values, did it work? Excellent!
Run this query;

$sqlUpdate = "UPDATE `money` SET `money` =
(`money`-10) WHERE `characterName` = `Town_Drunk` ";
$doUpdate = mysql_query($sqlUpdate, $myConnection);

Now do a select from the table and note that the value of money did not
change. The reason is because there is no Town_Drunk in the money table.
Does that make sense? Wonderful!

 





Honestly, the best "book" I read when I was starting out, and one I've 
been using ever since, is the manual. I actually spent $ on a very good 
php book but I think I've only cracked the cover on it once or twice in 
two years.


Way to go manual guys! :D

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



RE: [PHP] My Project

2005-07-20 Thread Shaw, Chris - Accenture


Honestly, the best "book" I read when I was starting out, and one I've
been using ever since, is the manual. I actually spent $ on a very good
php book but I think I've only cracked the cover on it once or twice in
two years.

Way to go manual guys! :D


I totally agree, I have only used the .chm manual to learn php, but I have a
programming background, C/C++, VB, Java, OpenROAD, C#.
If you're new to this programming game, then probably a *decent* book will
give you a good start.

Thumbs up to the manual guys. :)

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



[PHP] Before I pull anymore hair out.. Is anyone Using..

2005-07-20 Thread Chuck Carson
Is anyone here using php 5.0.4 on Solaris 9 and compiled with Oracle
10g support and using apache 2.0.54? I have looked at every 10 times
over. I have built php with oracle support probably 100 times on 5
different platforms and never had as many issues as I have had so far
with this system.

After finally getting php to build with everything I needed, I am
getting seg faults when accessing a php page that connects to the
oracle database. (but it doesn't happen _every_ time, it is
inconsistent)

I'm at a loss and must move to tomcat/jsp/servlets if I can't get a
stable platform up this week. =(

Thx
CC

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



Re: [PHP] Re: Tracking a mobile phone

2005-07-20 Thread Marcus Bointon

On 18 Jul 2005, at 20:56, Sebastian wrote:


The phone would have to have GPS capabilities..


Not true. The network knows what cell the phone is in(and cells are  
pretty small in cities), and it knows where the cell is. This is the  
mechanism that's used for location dependent services (especially  
directions and local maps) that are currently being pushed in the UK.


Whether you can get access to that information is another matter,  
especially internationally.


Marcus

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



Re: [PHP] Before I pull anymore hair out.. Is anyone Using..

2005-07-20 Thread Mikey

Chuck Carson wrote:


Is anyone here using php 5.0.4 on Solaris 9 and compiled with Oracle
10g support and using apache 2.0.54? I have looked at every 10 times
over. I have built php with oracle support probably 100 times on 5
different platforms and never had as many issues as I have had so far
with this system.

After finally getting php to build with everything I needed, I am
getting seg faults when accessing a php page that connects to the
oracle database. (but it doesn't happen _every_ time, it is
inconsistent)

I'm at a loss and must move to tomcat/jsp/servlets if I can't get a
stable platform up this week. =(

Thx
CC

 


I guess you have tried reading the walkthrough on Oracle?

http://www.oracle.com/technology/tech/php/index.html

HTH,

Mikey

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



Re: [PHP] Before I pull anymore hair out.. Is anyone Using..

2005-07-20 Thread André Medeiros
On Wed, 2005-07-20 at 10:21 -0500, Chuck Carson wrote:
> Is anyone here using php 5.0.4 on Solaris 9 and compiled with Oracle
> 10g support and using apache 2.0.54? I have looked at every 10 times
> over. I have built php with oracle support probably 100 times on 5
> different platforms and never had as many issues as I have had so far
> with this system.
> 
> After finally getting php to build with everything I needed, I am
> getting seg faults when accessing a php page that connects to the
> oracle database. (but it doesn't happen _every_ time, it is
> inconsistent)
> 
> I'm at a loss and must move to tomcat/jsp/servlets if I can't get a
> stable platform up this week. =(
> 
> Thx
> CC
> 

Do you have CLI compiled?

I had some issues developing a module myself, and found out that
enabling the module in CLI and calling a dummy file to test the
functions I just created helped me getting an insight about what was
wrong.

Install gdb, then do:

gdb php
(and inside gdb)
run -q file_with_oracle_functions.php

It will segfault. Do a backtrace. There you might have a good idea on
what's going wrong :)

Good luck!

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



[PHP] PHP Build Issues on Soalris 9

2005-07-20 Thread Chuck Carson
Okay, something I just noticed. (PHP builds fine, including make test)

I see this after running configure:
Generating files
updating cache ./config.cache
creating ./config.status
creating php5.spec
creating main/build-defs.h
creating scripts/phpize
creating scripts/php-config
creating sapi/cli/php.1
creating main/php_config.h
creating main/internal_functions.c
creating main/internal_functions_cli.c
++
|   *** ATTENTION ***|
||
| Something is likely to be messed up here, because the configure|
| script was not able to detect a simple feature on your platform.   |
| This is often caused by incorrect configuration parameters. Please |
| see the file debug.log for error messages. |


I am configuring with this:
adcinfops01:/usr/local/src/php-5.0.4 #./configure
--prefix=/usr/local/php-5.0.4 --with-apxs2=/usr/local/apache2/bin/apxs
--enable-cli --enable-cgi --with-openssl=/usr/local/ssl --with-zlib
--with-zlib-dir=/usr/local/lib --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 --enable-sigchild

LDFLAGS="-L/usr/local/mysql/lib/mysql
-L/u01/app/oracle/product/10.2/lib32 -L/usr/local/ssl/lib
-L/usr/local/lib"

How can I determine what it thinks is missing?
Thx,
CC

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



Re: [PHP] Before I pull anymore hair out.. Is anyone Using..

2005-07-20 Thread Chuck Carson
Yea, there is nothing talking about my eact configuration. (mainly on
Solaris) I can get this config working on SLES 9 and Red Hat w/o
problems and currently have it running on a dozen systems or so.

I need it on Solaris 9...

-CC

On 7/20/05, Mikey <[EMAIL PROTECTED]> wrote:
> Chuck Carson wrote:
> 
> >Is anyone here using php 5.0.4 on Solaris 9 and compiled with Oracle
> >10g support and using apache 2.0.54? I have looked at every 10 times
> >over. I have built php with oracle support probably 100 times on 5
> >different platforms and never had as many issues as I have had so far
> >with this system.
> >
> >After finally getting php to build with everything I needed, I am
> >getting seg faults when accessing a php page that connects to the
> >oracle database. (but it doesn't happen _every_ time, it is
> >inconsistent)
> >
> >I'm at a loss and must move to tomcat/jsp/servlets if I can't get a
> >stable platform up this week. =(
> >
> >Thx
> >CC
> >
> >
> >
> I guess you have tried reading the walkthrough on Oracle?
> 
> http://www.oracle.com/technology/tech/php/index.html
> 
> HTH,
> 
> Mikey
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
 "The day Microsoft makes something that doesn't suck is probably
 the day they start making vacuum cleaners." -Ernst Jan Plugge

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



[PHP] Installing OLE/Spreadsheet Excel Writer Query

2005-07-20 Thread kevin . o'brien

Hi,

I am working on Windows2003 Server. I tried unsuccessfully to install the
OLE/Spreadsheet package from the command line.

I went to www.pear.net and downloaded the packages. However, I was only
able to download as .tgz files. Where should these be located? Using PHP4.4

Please could you tell me how I can get these packages working on
Windows2003.

The error I receive from the command line:

"Connection to RPC server pear.php.net:80 failed..."

I get that when I type: "pear list-all", etc. and also when I type "pear
install OLE-0.5"

"pear list" works fine.

I would be very grateful for a quick reply.

Thank You.

Regards,

Kevin O'Brien.

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



Re: [PHP] PHP Build Issues on Soalris 9

2005-07-20 Thread Jochem Maas

Chuck Carson wrote:

Okay, something I just noticed. (PHP builds fine, including make test)

I see this after running configure:
Generating files
updating cache ./config.cache
creating ./config.status
creating php5.spec
creating main/build-defs.h
creating scripts/phpize
creating scripts/php-config
creating sapi/cli/php.1
creating main/php_config.h
creating main/internal_functions.c
creating main/internal_functions_cli.c
++
|   *** ATTENTION ***|
||
| Something is likely to be messed up here, because the configure|
| script was not able to detect a simple feature on your platform.   |
| This is often caused by incorrect configuration parameters. Please |
| see the file debug.log for error messages. |



I'm following your problem in the hope I can learn something but
I'm not able to help really



I am configuring with this:
adcinfops01:/usr/local/src/php-5.0.4 #./configure
--prefix=/usr/local/php-5.0.4 --with-apxs2=/usr/local/apache2/bin/apxs
--enable-cli --enable-cgi --with-openssl=/usr/local/ssl --with-zlib
--with-zlib-dir=/usr/local/lib --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 --enable-sigchild

LDFLAGS="-L/usr/local/mysql/lib/mysql
-L/u01/app/oracle/product/10.2/lib32 -L/usr/local/ssl/lib
-L/usr/local/lib"

How can I determine what it thinks is missing?


I take it you have looked in debug.log (whereever it lives)
for error messages? most probably you have, but it may have been
5am ;-)


Thx,
CC



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



Re: [PHP] Installing OLE/Spreadsheet Excel Writer Query

2005-07-20 Thread Jochem Maas

kevin.o'[EMAIL PROTECTED] wrote:

Hi,

I am working on Windows2003 Server. I tried unsuccessfully to install the
OLE/Spreadsheet package from the command line.

I went to www.pear.net and downloaded the packages. However, I was only
able to download as .tgz files. Where should these be located? Using PHP4.4

Please could you tell me how I can get these packages working on
Windows2003.

The error I receive from the command line:

"Connection to RPC server pear.php.net:80 failed..."


can you telnet to pear.php.net:80 ?
maybe its a firewall issue.



I get that when I type: "pear list-all", etc. and also when I type "pear
install OLE-0.5"

"pear list" works fine.

I would be very grateful for a quick reply.

Thank You.

Regards,

Kevin O'Brien.



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



Re: [PHP] PHP Build Issues on Soalris 9

2005-07-20 Thread John Nichel

Chuck Carson wrote:

Okay, something I just noticed. (PHP builds fine, including make test)

I see this after running configure:
Generating files
updating cache ./config.cache
creating ./config.status
creating php5.spec
creating main/build-defs.h
creating scripts/phpize
creating scripts/php-config
creating sapi/cli/php.1
creating main/php_config.h
creating main/internal_functions.c
creating main/internal_functions_cli.c
++
|   *** ATTENTION ***|
||
| Something is likely to be messed up here, because the configure|
| script was not able to detect a simple feature on your platform.   |
| This is often caused by incorrect configuration parameters. Please |
| see the file debug.log for error messages. |


I am configuring with this:
adcinfops01:/usr/local/src/php-5.0.4 #./configure
--prefix=/usr/local/php-5.0.4 --with-apxs2=/usr/local/apache2/bin/apxs
--enable-cli --enable-cgi --with-openssl=/usr/local/ssl --with-zlib
--with-zlib-dir=/usr/local/lib --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 --enable-sigchild

LDFLAGS="-L/usr/local/mysql/lib/mysql
-L/u01/app/oracle/product/10.2/lib32 -L/usr/local/ssl/lib
-L/usr/local/lib"

How can I determine what it thinks is missing?
Thx,
CC



What does debug.log say?

--
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] PHP Build Issues on Soalris 9

2005-07-20 Thread Jochem Maas

Chuck Carson wrote:

On 7/20/05, Jochem Maas <[EMAIL PROTECTED]> wrote:


Chuck Carson wrote:


Okay, something I just noticed. (PHP builds fine, including make test)

I see this after running configure:
Generating files
updating cache ./config.cache
creating ./config.status
creating php5.spec
creating main/build-defs.h
creating scripts/phpize
creating scripts/php-config
creating sapi/cli/php.1
creating main/php_config.h
creating main/internal_functions.c
creating main/internal_functions_cli.c
++
|   *** ATTENTION ***|
||
| Something is likely to be messed up here, because the configure|
| script was not able to detect a simple feature on your platform.   |
| This is often caused by incorrect configuration parameters. Please |
| see the file debug.log for error messages. |



I'm following your problem in the hope I can learn something but
I'm not able to help really



I am configuring with this:
adcinfops01:/usr/local/src/php-5.0.4 #./configure
--prefix=/usr/local/php-5.0.4 --with-apxs2=/usr/local/apache2/bin/apxs
--enable-cli --enable-cgi --with-openssl=/usr/local/ssl --with-zlib
--with-zlib-dir=/usr/local/lib --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 --enable-sigchild

LDFLAGS="-L/usr/local/mysql/lib/mysql
-L/u01/app/oracle/product/10.2/lib32 -L/usr/local/ssl/lib
-L/usr/local/lib"

How can I determine what it thinks is missing?


I take it you have looked in debug.log (whereever it lives)
for error messages? most probably you have, but it may have been
5am ;-)



Thx,
CC






Yea, it is complaining about the wrong ELF type for the oracle libs. I
have to manually tweak the Makefile, chaging product/10.2/lib to
product/10.2/lib32 to get it to compile correctly. (even though
LDFLAGS has the lib32 directory it still doesnt pick it up correctly)


but after the tweak it builds without errors but still gives segfault?

which worker module are you using with apache2? you have to use the prefork
module due to some non-threadsafe extensions in php (_IIRC_ Rasmus said that
its practically speaking impossible to know exactly what,where,why) ...
but you probably know that also :-/


maybe try building with php 5.0.2 or 5.0.3 to see
if the problem 'goes away' (for now)?


also have you tried running apache thru gdb and see what it spits out
when the segfault occurs? (regarding gdb, I can just about find the executable,
using it is another matter!)



-CC


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



[PHP] Combining recordsets

2005-07-20 Thread Mike Smith
I'm wondering if someone has a better solution then I've come up with.
I've got a few reports that pull from various tables. Some times I'm
not able to put all the tables into a single query/view. So I end up
with a master query and 1 (or more) supporting queries. I'm using
MSSQL 2000/IIS/PHP4/ADODB. This may be my own weakness in designing a
query, I'm willing to learn if it is. So I've ended up doing things
like:

function formula($part,$array){
//imagine a formula to calculate weeks in pipe for a part
foreach($array AS $val){
if($val[0]==$part){
$qty = $val[1];
}
}
return $qty;
}


$q1 = "SELECT part, fcast FROM parts";
$rs1 = $conn->Execute($s);
$rs1_arr = $rs1->GetArray();


$q2 = "SELECT part, qty FROM pos";
$rs2 = $conn->Execute($s);
$rs2_arr = $rs2->GetArray();

foreach($rs1_arr AS $data){
echo "Part: ".$data[0];
echo "Forecast: ".$data[1];
echo "POs: ".formula($data[0],$rs2_arr);
}

This is not a wonderful example, because I could LEFT JOIN pos to
parts. But I have more complex queries that have several INNER/LEFT
joins that once I bring in that last table to complete my query it
(the last table) skews my sums. Really I'm just wondering if others
have come across

--
Mike

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



RE: [PHP] Combining recordsets

2005-07-20 Thread Shaw, Chris - Accenture

Mike,

I recommend redesigning your query, the database can pull back the records
you want far quicker than any frontend combining/processing, since that's
what T-SQL and relational database were designed for.

I might be able to help you with the SQL, but I am a little rusty, not really
used it in 8 months. Maybe a MS-SQL/T-SQL forum will be able to help you with
optimising your query to get what you need, they are usually very helpful.

hth

C.



-Original Message-
From: Mike Smith [mailto:[EMAIL PROTECTED]
Sent: 20 July 2005 17:39
To: php-general@lists.php.net
Subject: [PHP] Combining recordsets


*

This e-mail has been received by the Revenue Internet e-mail service.

*

I'm wondering if someone has a better solution then I've come up with.
I've got a few reports that pull from various tables. Some times I'm
not able to put all the tables into a single query/view. So I end up
with a master query and 1 (or more) supporting queries. I'm using
MSSQL 2000/IIS/PHP4/ADODB. This may be my own weakness in designing a
query, I'm willing to learn if it is. So I've ended up doing things
like:

function formula($part,$array){
//imagine a formula to calculate weeks in pipe for a part
foreach($array AS $val){
if($val[0]==$part){
$qty = $val[1];
}
}
return $qty;
}


$q1 = "SELECT part, fcast FROM parts";
$rs1 = $conn->Execute($s);
$rs1_arr = $rs1->GetArray();


$q2 = "SELECT part, qty FROM pos";
$rs2 = $conn->Execute($s);
$rs2_arr = $rs2->GetArray();

foreach($rs1_arr AS $data){
echo "Part: ".$data[0];
echo "Forecast: ".$data[1];
echo "POs: ".formula($data[0],$rs2_arr);
}

This is not a wonderful example, because I could LEFT JOIN pos to
parts. But I have more complex queries that have several INNER/LEFT
joins that once I bring in that last table to complete my query it
(the last table) skews my sums. Really I'm just wondering if others
have come across

--
Mike

--

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



[PHP] Cannot modify header information error........usage of header method.

2005-07-20 Thread babu
Hi all,
 
I am using header method to redirect to a certain page.my first question is 
1."Is there any other alternative to this method."
2.I am getting the error by using this method. the error is "Cannot modify 
header information - headers already sent by".
i have seen the php documentation for header method. where there is one user 
comment about this.
i have followed his steps like removing blank lines, using exit method. But the 
3rd point that is "HTML goes before any PHP code ", i could not follow it , can 
some one please explain it.
 
Thanks
babu


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

Re: [PHP] Before I pull anymore hair out.. Is anyone Using..

2005-07-20 Thread Cafer Simsek
Hi,

You may try to run your codes with CLI, this provides to you that the
see the some errors if have. And also you have posibility strace
usage.

Best Regards.

-Cafer

Chuck Carson <[EMAIL PROTECTED]> writes:

> Is anyone here using php 5.0.4 on Solaris 9 and compiled with Oracle
> 10g support and using apache 2.0.54? I have looked at every 10 times
> over. I have built php with oracle support probably 100 times on 5
> different platforms and never had as many issues as I have had so far
> with this system.
>
> After finally getting php to build with everything I needed, I am
> getting seg faults when accessing a php page that connects to the
> oracle database. (but it doesn't happen _every_ time, it is
> inconsistent)
>
> I'm at a loss and must move to tomcat/jsp/servlets if I can't get a
> stable platform up this week. =(
>
> 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



RE: [PHP] Cannot modify header information error........usage of header method.

2005-07-20 Thread Chris W. Parker
babu 
on Wednesday, July 20, 2005 10:15 AM said:

> 1."Is there any other alternative to this method."

Javascript or an html redirect.

> 2.I am getting the error by using this method. the error is "Cannot
> modify header information - headers already sent by". i have seen the
> php documentation for header method. where there is one user comment
> about this. i have followed his steps like removing blank lines,
> using exit method.

You have not removed everything. Output is still being sent to the
browser. The error message tells you which file and line is causing the
problem. I suggest you go back to it and look closely.

> But the 3rd point that is "HTML goes before any
> PHP code ", i could not follow it , can some one please explain it.   

I don't follow it either.


Seinfeld anyone?

Chris.

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



RE: [PHP] Cannot modify header information error........usage of header method.

2005-07-20 Thread babu
Hi parker, 
can you please tell me how to use java script or html redirect, i mean a sample.
 
thanks

"Chris W. Parker" <[EMAIL PROTECTED]> wrote:
babu 
on Wednesday, July 20, 2005 10:15 AM said:

> 1."Is there any other alternative to this method."

Javascript or an html redirect.

> 2.I am getting the error by using this method. the error is "Cannot
> modify header information - headers already sent by". i have seen the
> php documentation for header method. where there is one user comment
> about this. i have followed his steps like removing blank lines,
> using exit method.

You have not removed everything. Output is still being sent to the
browser. The error message tells you which file and line is causing the
problem. I suggest you go back to it and look closely.

> But the 3rd point that is "HTML goes before any
> PHP code ", i could not follow it , can some one please explain it. 

I don't follow it either.


Seinfeld anyone?

Chris.

--
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] Cannot modify header information error........usage of header method.

2005-07-20 Thread Mikey

babu wrote:

Hi parker, 
can you please tell me how to use java script or html redirect, i mean a sample.


thanks

"Chris W. Parker" <[EMAIL PROTECTED]> wrote:
babu 
on Wednesday, July 20, 2005 10:15 AM said:


 


1."Is there any other alternative to this method."
   



Javascript or an html redirect.

 


2.I am getting the error by using this method. the error is "Cannot
modify header information - headers already sent by". i have seen the
php documentation for header method. where there is one user comment
about this. i have followed his steps like removing blank lines,
using exit method.
   



You have not removed everything. Output is still being sent to the
browser. The error message tells you which file and line is causing the
problem. I suggest you go back to it and look closely.

 


But the 3rd point that is "HTML goes before any
PHP code ", i could not follow it , can some one please explain it. 
   



I don't follow it either.


Seinfeld anyone?

Chris.

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


Javascript:

document.location = "new_url.html";

HTML:

http://site.com/new_page.html";>

HTH,

Mikey

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



RE: [PHP] Cannot modify header information error........usage of header method.

2005-07-20 Thread Chris W. Parker
babu 
on Wednesday, July 20, 2005 10:33 AM said:

> Hi parker,
> can you please tell me how to use java script or html redirect, i
> mean a sample. 

I must be in a good mood today. :)

html redirect (more accurately called meta refresh):

http://www.pageresource.com/html/metref.htm

Javascript:

http://www.pageresource.com/html/metref.htm



Chris.

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



[PHP] Content Header

2005-07-20 Thread Christopher J. Umina

Hello!

I currently have a script which streams data out of a MySQL database, 
and prints the content headers correctly, however, when I use the 
following line:


header("Content-Disposition: attachment; filename=\"". $filename ."\"");

it prompts the user to download the file each time they go to the site. 
 The problem is, I want the filename to be in the header, incase 
somebody right clicks and saves the file, but I don't want the user to 
be prompted to download the file when they're just trying to look at 
it.  Does anybody know a way I can achieve this result?


Thank you!
Christopher J. Umina

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



[PHP] Re: Content Header

2005-07-20 Thread Matthew Weier O'Phinney
* "Christopher J. Umina" <[EMAIL PROTECTED]>:
> Hello!
>
> I currently have a script which streams data out of a MySQL database, 
> and prints the content headers correctly, however, when I use the 
> following line:
>
> header("Content-Disposition: attachment; filename=\"". $filename ."\"");
>
> it prompts the user to download the file each time they go to the site. 
>   The problem is, I want the filename to be in the header, incase 
> somebody right clicks and saves the file, but I don't want the user to 
> be prompted to download the file when they're just trying to look at 
> it.  Does anybody know a way I can achieve this result?

As long as the "Content-Disposition: attachment" header is present, the
browser will believe a file is being sent.

One solution is to have two different links, with an optional download
flag in the query string. Then, in your script, generate the
Content-Disposition header for 'download' requests, don't otherwise.

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



Re: [PHP] Content Header

2005-07-20 Thread Cafer Simsek
Hi,

You may try that;

header("Content-Disposition: attachment; filename=\"". $filename ."\"");

Best Regards

-Cafer

On 7/20/05, Christopher J. Umina <[EMAIL PROTECTED]> wrote:
> Hello!
> 
> I currently have a script which streams data out of a MySQL database,
> and prints the content headers correctly, however, when I use the
> following line:
> 
> header("Content-Disposition: attachment; filename=\"". $filename ."\"");
> 
> it prompts the user to download the file each time they go to the site.
>   The problem is, I want the filename to be in the header, incase
> somebody right clicks and saves the file, but I don't want the user to
> be prompted to download the file when they're just trying to look at
> it.  Does anybody know a way I can achieve this result?
> 
> Thank you!
> Christopher J. Umina
> 
> --
> 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] Content Header

2005-07-20 Thread Cafer Simsek
Sorry
it was
header("Content-Disposition: inline; filename=\"". $filename ."\"");


-Cafer

On 7/20/05, Cafer Simsek <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> You may try that;
> 
> header("Content-Disposition: attachment; filename=\"". $filename ."\"");
> 
> Best Regards
> 
> -Cafer
> 
> On 7/20/05, Christopher J. Umina <[EMAIL PROTECTED]> wrote:
> > Hello!
> >
> > I currently have a script which streams data out of a MySQL database,
> > and prints the content headers correctly, however, when I use the
> > following line:
> >
> > header("Content-Disposition: attachment; filename=\"". $filename ."\"");
> >
> > it prompts the user to download the file each time they go to the site.
> >   The problem is, I want the filename to be in the header, incase
> > somebody right clicks and saves the file, but I don't want the user to
> > be prompted to download the file when they're just trying to look at
> > it.  Does anybody know a way I can achieve this result?
> >
> > Thank you!
> > Christopher J. Umina
> >
> > --
> > 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] Cannot modify header information error........usage of header method.

2005-07-20 Thread babu
Thanks for the help mike and parker,
 
I have used ob_start and ob_end_flush methods, and its working fine.
 
i got good idea of redirecting now.

Mikey <[EMAIL PROTECTED]> wrote:
babu wrote:

>Hi parker, 
>can you please tell me how to use java script or html redirect, i mean a 
>sample.
> 
>thanks
>
>"Chris W. Parker" wrote:
>babu 
>on Wednesday, July 20, 2005 10:15 AM said:
>
> 
>
>>1."Is there any other alternative to this method."
>> 
>>
>
>Javascript or an html redirect.
>
> 
>
>>2.I am getting the error by using this method. the error is "Cannot
>>modify header information - headers already sent by". i have seen the
>>php documentation for header method. where there is one user comment
>>about this. i have followed his steps like removing blank lines,
>>using exit method.
>> 
>>
>
>You have not removed everything. Output is still being sent to the
>browser. The error message tells you which file and line is causing the
>problem. I suggest you go back to it and look closely.
>
> 
>
>>But the 3rd point that is "HTML goes before any
>>PHP code ", i could not follow it , can some one please explain it. 
>> 
>>
>
>I don't follow it either.
>
>
>Seinfeld anyone?
>
>Chris.
>
>--
>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
> 
>
Javascript:

document.location = "new_url.html";

HTML:



HTH,

Mikey

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

[PHP] redirecting some values from one page to other in php

2005-07-20 Thread babu


I am using header method for redirecting to another php file.I also want to 
pass some variables to the redirected file.

for example:

file1.html where i have a dropdown menu. the user selects the options... 
this form  has a action to file2.php
file2.php--- i get the values of the form by using $_POST. In this file i will 
do some processing  on data and redirect to file3.php
file3.php here i need the user select menu items.

i think i can use require_once(file2.php) in file3.php and get the values.But i 
want to get the values selected by user from html form.

Thanks for the help.
babu


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

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

2005-07-20 Thread Ethilien
That last line always causes me problems, I think it is probably a 
difference in versions of mysql. Just change the last line to:


);

without any of the text in their. It doesn't really do much anyway.

Ross wrote:

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



[PHP] Re: preg_match_all question

2005-07-20 Thread Ethilien
I don't see anything in this regex that would prevent https from being 
matched, since you don't specify the pattern of the actual url at all.


What is an example of a link that it will match?

Chris Bruce wrote:

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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] redirecting some values from one page to other in php

2005-07-20 Thread Mikey

babu wrote:


I am using header method for redirecting to another php file.I also want to 
pass some variables to the redirected file.

for example:

file1.html where i have a dropdown menu. the user selects the options... 
this form  has a action to file2.php
file2.php--- i get the values of the form by using $_POST. In this file i will 
do some processing  on data and redirect to file3.php
file3.php here i need the user select menu items.

i think i can use require_once(file2.php) in file3.php and get the values.But i 
want to get the values selected by user from html form.

Thanks for the help.
babu


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

You could put them in session vars - 
http://uk.php.net/manual/en/ref.session.php


Mikey

--
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-20 Thread Mikey

Ross wrote:


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. 

 

If you have phpMyAdmin installed, create the table there and then export 
the table structure - I have found this to be very reliable in the past.


Mikey

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



Re: [PHP] redirecting some values from one page to other in php

2005-07-20 Thread babu
It will become a big mess up for me if i combine all the files as they are 
large files.

Matt Darby <[EMAIL PROTECTED]> wrote:

babu wrote:

>I am using header method for redirecting to another php file.I also want to 
>pass some variables to the redirected file.
>
>for example:
>
>file1.html where i have a dropdown menu. the user selects the options... 
>this form has a action to file2.php
>file2.php--- i get the values of the form by using $_POST. In this file i will 
>do some processing on data and redirect to file3.php
>file3.php here i need the user select menu items.
>
>i think i can use require_once(file2.php) in file3.php and get the values.But 
>i want to get the values selected by user from html form.
>
>Thanks for the help.
>babu
>
> 
>-
> 
>

Why not just combine all three files into one? So long as you place the 
form processing code over the actual HTML & PHP code that generates your 
webpage, all will be fine..

To do this all you need to do is set your form action=""

Matt Darby

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



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

Re: [PHP] redirecting some values from one page to other in php

2005-07-20 Thread Matt Darby



babu wrote:


It will become a big mess up for me if i combine all the files as they are 
large files.

Matt Darby <[EMAIL PROTECTED]> wrote:

babu wrote:

 


I am using header method for redirecting to another php file.I also want to 
pass some variables to the redirected file.

for example:

file1.html where i have a dropdown menu. the user selects the options... 
this form has a action to file2.php
file2.php--- i get the values of the form by using $_POST. In this file i will 
do some processing on data and redirect to file3.php
file3.php here i need the user select menu items.

i think i can use require_once(file2.php) in file3.php and get the values.But i 
want to get the values selected by user from html form.

Thanks for the help.
babu


-


   



Why not just combine all three files into one? So long as you place the 
form processing code over the actual HTML & PHP code that generates your 
webpage, all will be fine..


To do this all you need to do is set your form action=""

Matt Darby

 


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


   





-
Yahoo! Messen



Sorry -- Hit "Reply" instead of "Reply to All" :)


ger NEW - crystal clear PC to PCcalling worldwide with voicemail
 



Re: [PHP] redirecting some values from one page to other in php

2005-07-20 Thread babu
does session.auto_start should be set to 1 for sessions to work.

Mikey <[EMAIL PROTECTED]> wrote:babu wrote:

>I am using header method for redirecting to another php file.I also want to 
>pass some variables to the redirected file.
>
>for example:
>
>file1.html where i have a dropdown menu. the user selects the options... 
>this form has a action to file2.php
>file2.php--- i get the values of the form by using $_POST. In this file i will 
>do some processing on data and redirect to file3.php
>file3.php here i need the user select menu items.
>
>i think i can use require_once(file2.php) in file3.php and get the values.But 
>i want to get the values selected by user from html form.
>
>Thanks for the help.
>babu
>
> 
>-
>Yahoo! Messenger NEW - crystal clear PC to PCcalling worldwide with voicemail
> 
>
You could put them in session vars - 
http://uk.php.net/manual/en/ref.session.php

Mikey

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




-
How much free photo storage do you get? Store your holiday snaps for FREE with 
Yahoo! Photos. Get Yahoo! Photos

Re: [PHP] redirecting some values from one page to other in php

2005-07-20 Thread Matt Darby



babu wrote:


does session.auto_start should be set to 1 for sessions to work.

Mikey <[EMAIL PROTECTED]> wrote:babu wrote:

 


I am using header method for redirecting to another php file.I also want to 
pass some variables to the redirected file.

for example:

file1.html where i have a dropdown menu. the user selects the options... 
this form has a action to file2.php
file2.php--- i get the values of the form by using $_POST. In this file i will 
do some processing on data and redirect to file3.php
file3.php here i need the user select menu items.

i think i can use require_once(file2.php) in file3.php and get the values.But i 
want to get the values selected by user from html form.

Thanks for the help.
babu


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


   

You could put them in session vars - 
http://uk.php.net/manual/en/ref.session.php


Mikey

 



So long as  you call session_start(); at the very top of your scripts, 
sessions will work.

session.auto_start is fine if your entire site will be using sessions.

Matt Darby


[PHP] Delay in a mail item.

2005-07-20 Thread SMTP retry
One of your mail items is currently undeliverable at this site, and is
on a queue for retransmission. A retransmission attempt will occur
periodically for the next 4 days.

The usual reason is that the host that we tried to send your mail to
is inaccessible via the internet (presumably temporarily).
If we cannot make contact in the next 4 days your mail will
be returned.

The exact reason for the return should be outlined in the session
transcript below. If you have any questions please contact your
local postmaster.

The smtp log of the transaction was:
***
dns_lookup: Trying a lookup on "1.8.78.129.in-addr.arpa"
dns_lookup: Found staff.cs.usyd.edu.au.
Mail connection from php-general@lists.php.net to [EMAIL PROTECTED]
mx_lookup: Trying a lookup on "gh.cs.su.oz.au"
staff.cs.usyd.edu.au.:()InetT_A 21600 0 129.78.8.1
crux.cs.usyd.edu.au.:() InetT_A 21600 0 129.78.8.2
ns.psrg.cs.usyd.edu.au.:()  InetT_A 259200 0 129.78.97.1
mail.psrg.cs.usyd.edu.au.:()InetT_A 259200 0 129.78.97.1
metro.ucc.usyd.edu.au.:()   InetT_A 1455 0 129.78.64.2
mail.cs.usyd.edu.au.:() InetT_A 21600 0 129.78.8.1
gh.cs.su.oz.au.:(staff.cs.usyd.edu.au.) InetT_NS 259200 0 0.0.0.0
gh.cs.su.oz.au.:(crux.cs.usyd.edu.au.)  InetT_NS 259200 0 0.0.0.0
gh.cs.su.oz.au.:(ns.psrg.cs.usyd.edu.au.)   InetT_NS 259200 0 0.0.0.0
gh.cs.su.oz.au.:(mail.psrg.cs.usyd.edu.au.) InetT_MX 259200 5 0.0.0.0
gh.cs.su.oz.au.:(metro.ucc.usyd.edu.au.)InetT_MX 259200 100 0.0.0.0
gh.cs.su.oz.au.:(mail.cs.usyd.edu.au.)  InetT_MX 259200 10 104.111.110.115
About to print records
mail.psrg.cs.usyd.edu.au. (mail.psrg.cs.usyd.edu.au.), 5: 129.78.97.1
mail.cs.usyd.edu.au. (mail.cs.usyd.edu.au.), 10: 129.78.8.1
metro.ucc.usyd.edu.au. (metro.ucc.usyd.edu.au.), 100: 129.78.64.2
Trying to connect to mail.psrg.cs.usyd.edu.au. (mail.psrg.cs.usyd.edu.au.) 
[129.78.97.1]
Cannot connect to the remote host: Connection refused
An MX loop occured trying to connect to mail.cs.usyd.edu.au. 
(mail.cs.usyd.edu.au.)

We managed to only progress partially in sending your mail item.
Your mail will be retried later.

***
The beginning of the unsent mail item was:
***
Received: from dhaka.ucc.usyd.edu.au. [129.78.64.52] by staff.cs.usyd.edu.au.; 
Wed, 20 Jul 2005 22:20:25 +1000
Received: from dhaka.ucc.usyd.edu.au (localhost.ucc.usyd.edu.au [127.0.0.1])
by dhaka-postfilter.ucc.usyd.edu.au (Postfix) with ESMTP id 0C3567AB7F0
for <[EMAIL PROTECTED]>; Wed, 20 Jul 2005 22:11:39 +1000 (EST)
Received: from toronto.ucc.usyd.edu.au (metro.ucc.usyd.edu.au [129.78.64.2])
by dhaka.ucc.usyd.edu.au (Postfix) with ESMTP id C6B147AAEAC
for <[EMAIL PROTECTED]>; Wed, 20 Jul 2005 22:11:39 +1000 (EST)
Received: from gh.cs.usyd.edu.au (nat001.promax.media.pl [193.151.96.21])
by toronto.ucc.usyd.edu.au (Postfix) with ESMTP id BE2E23FE1D
for <[EMAIL PROTECTED]>; Wed, 20 Jul 2005 22:11:34 +1000 (EST)
From: php-general@lists.php.net
To: [EMAIL PROTECTED]
Subject: Re: screensaver
Date: Wed, 20 Jul 2005 14:10:56 +0200
MIME-Version: 1.0
Content-Type: multipart/mixed; 
boundary="=_NextPart_000_0016_127F.1F55"
X-Priority: 3
X-MSMail-Priority: Normal
Message-Id: <[EMAIL PROTECTED]>
X-usyd-cess: $Revision: 168 $; cleaned=1 defanged=0
#screensaver.zip#:check_infected=infected

This is a multi-part message in MIME format...

--=_NextPart_000_0016_127F.1F55
Content-Type: text/plain; name="warning.txt"
Content-Disposition: inline; filename="warning.txt"
MIME-Version: 1.0
X-Mailer: MIME-tools 5.417 (Entity 5.417)
Content-Transfer-Encoding: quoted-printable

# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
# This email was modified by the University of Sydney email virus=20
# scanning system in accordance with the policy available at
# http://policy.rms.usyd.edu.au/0bs.pdf
#
# Please read the following information before taking any further=20
# action.
# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
#
#
# The file 'screensaver.zip' was infected with: Worm.Mydoom.Gen-1. The
# attachment has been discarded - visit
# http://itassist.usyd.edu.au/staff/support/setup/email/virus.shtml
# for more details
#
#
# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
# If you do not kno

[PHP] From float to hour and minutes

2005-07-20 Thread Miguel Guirao


Hi!!

I'm calculating the amount of time that an electric plant can operate with a
certain amount of gas, let's say:

A plant can work an hour with 10 galons, How long does it will work with 300
galons?

hrs = (300 galons / 10 galons) = 30 (I could also have a float here!!!)

Then, I have the time the plant was refilled, let's say 16:42, so I need to
calculate the next hour the plant needs to be refilled. Like 16:42 hrs + 30
hrs

How can I sum these two values?
How can I convert the integer or float value 30 to a hour format?

Any ideas?

---
Miguel Guirao Aguilera
Logistica R8 TELCEL
Tel. (999) 960.7994
Cel. 9931 600.


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

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

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



[PHP] adding ftp functionality into php

2005-07-20 Thread Tom Cruickshank
Hello,
My apologizes in advance if this is the wrong mailing list.

I have a php module in apache which is missing ftp functionality 
(--enable-ftp was not used as an argument on compile time). However, 
recompiling php at this time does not give me other options I am looking 
for. 

I would like to add php_ftp (or whatever the extension is called) as an 
extension in the /usr/local/etc/php/extensions.ini file 

problem is, i can't seem to find it anywhere. would anyone know? 

Thanks for any assistance!

Tom


Re: [PHP] From float to hour and minutes

2005-07-20 Thread Philip Hallstrom

I'm calculating the amount of time that an electric plant can operate with a
certain amount of gas, let's say:

A plant can work an hour with 10 galons, How long does it will work with 300
galons?

hrs = (300 galons / 10 galons) = 30 (I could also have a float here!!!)

Then, I have the time the plant was refilled, let's say 16:42, so I need to
calculate the next hour the plant needs to be refilled. Like 16:42 hrs + 30
hrs

How can I sum these two values?
How can I convert the integer or float value 30 to a hour format?


With absolutely no testing and horrible variable names

$x = "16:42";
$y = 30;

list($h, $m) = explode(":", $x);
$x1 = $h + $m/60;

$total = $x1 + $y;

$h = floor($total);
$m = floor(($total - $h) * 60);
$newtime = "$h:$m";

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



[PHP] gloabl & reference behavior question?

2005-07-20 Thread Surendra Singhi
Hello,

(1)
When I try this code:

I get the output:

stuff

where as I was expecting junk value or null.


My question is that, because the array is created locally and we
pass it by reference (without copying) so on the exit of function, its value
is lost, but how does the global variable gets back its old value?

Is it something which is not defined by the PHP language reference and is
implementation specific? And in this case instead of giving the global
variable some junk value or null value, the implementation decides to store
the old values?

Thanks.
-- 
Surendra Singhi

http://www.spikesource.com

http://www.public.asu.edu/~sksinghi/

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



[PHP] PHP and MySQL and resouce limits

2005-07-20 Thread John Hinton
I don't get it... I have been upping my memory limit for PHP. 32megs 
now... and am making calls to a database on a different server. I see 
the loads run up on the other server as it cruches the numbers.. and PHP 
is in the process of creating a single little page with about 40 numbers 
on it, from these returns. Now, I do know I'm crunching a LOT of data in 
this instance, but it seems like MySQL is doing the work and that PHP 
shouldn't be hitting 32 my 32meg wall. Running the same query on a 
smaller dataset doesn't hit this limit, so I know it's not a function of 
the PHP code itself.


So, I must be missing something, why is PHP somehow tied to the work 
MySQL is doing? As in memory usage seems that MySQL should be simply 
sending PHP the returns on its commands... hm


Thanks,
John Hinton

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



Re: [PHP] PHP Build Issues on Soalris 9

2005-07-20 Thread Jochem Maas

++
|   *** ATTENTION Chuck Carson *** |
||



I'm not able to help really


I am configuring with this:
adcinfops01:/usr/local/src/php-5.0.4 #./configure
--prefix=/usr/local/php-5.0.4 --with-apxs2=/usr/local/apache2/bin/apxs


a SuSE orientated tutorial gives --with-apxs2 as:

--with-apxs2=/usr/sbin/apxs2-prefork

should this be this for you?:

--with-apxs2=/usr/local/apache2/bin/apxs2-prefork

if so, tada :-) heh you never know. otherwise read on.


--enable-cli --enable-cgi --with-openssl=/usr/local/ssl --with-zlib
--with-zlib-dir=/usr/local/lib --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 --enable-sigchild

LDFLAGS="-L/usr/local/mysql/lib/mysql
-L/u01/app/oracle/product/10.2/lib32 -L/usr/local/ssl/lib
-L/usr/local/lib"

How can I determine what it thinks is missing?


I take it you have looked in debug.log (whereever it lives)
for error messages? most probably you have, but it may have been
5am ;-)




Thx,
CC





Yea, it is complaining about the wrong ELF type for the oracle libs. I
have to manually tweak the Makefile, chaging product/10.2/lib to
product/10.2/lib32 to get it to compile correctly. (even though
LDFLAGS has the lib32 directory it still doesnt pick it up correctly)


but after the tweak it builds without errors but still gives segfault?

which worker module are you using with apache2? you have to use the prefork
module due to some non-threadsafe extensions in php (_IIRC_ Rasmus said that
its practically speaking impossible to know exactly what,where,why) ...
but you probably know that also :-/


maybe try building with php 5.0.2 or 5.0.3 to see
if the problem 'goes away' (for now)?


also have you tried running apache thru gdb and see what it spits out
when the segfault occurs? (regarding gdb, I can just about find the executable,
using it is another matter!)



-CC




Yea, my apache server is built with prefork. (I am using the package
from sunfreeware.com, which is trustworthy)


but it maybe be built with numerous worker modules. is prefork
selected?

maybe its worth building a clean setup with an apache
src tree direct from apache?




I guess I need to start trying down revs of php...

-CC




When doing a make test, I get these results. (Are these typical and
safe to ignore?)


I guess that depends on what you parts of php you are using ...



=
FAILED TEST SUMMARY
-
Bug #31672 (one-line comment with ) [tests/basic/bug31672.phpt]
Test for buffering in core functions with implicit flush off
[tests/func/008.phpt]


ignore (I guess)


Convert warnings to exceptions [tests/lang/038.phpt]


er?


Bug #29944 (function defined in switch crashes PHP) [tests/lang/bug29944.phpt]


sounds like a crap idea anyhow :-) are you doing this?


Bug #22836 (returning references to NULL) [Zend/tests/bug22836.phpt]
Test 3: Exception Test [ext/dom/tests/dom003.phpt]


er?


Bug #24155 (gdImageRotate270 rotation problem). [ext/gd/tests/bug24155.phpt]
gdimagefill() function (Bug #19366 (fixed in bundled libgd))
[ext/gd/tests/bug27582_1.phpt]


are you using gd? fill/rotate?


EUC-JP to ISO-2022-JP [ext/iconv/tests/eucjp2iso2022jp.phpt]
EUC-JP to SJIS [ext/iconv/tests/eucjp2sjis.phpt]
iconv_mime_encode() sanity cheeck. [ext/iconv/tests/iconv004.phpt]
iconv_mime_decode() [ext/iconv/tests/iconv_mime_decode.phpt]
iconv_mime_decode_headers() [ext/iconv/tests/iconv_mime_decode_headers.phpt]
iconv_mime_encode() [ext/iconv/tests/iconv_mime_encode.phpt]
iconv stream filter [ext/iconv/tests/iconv_stream_filter.phpt]
iconv_strlen() [ext/iconv/tests/iconv_strlen.phpt]
iconv_strpos() [ext/iconv/tests/iconv_strpos.phpt]
iconv_strrpos() [ext/iconv/tests/iconv_strrpos.phpt]
iconv_substr() [ext/iconv/tests/iconv_substr.phpt]
ob_iconv_handler() [ext/iconv/tests/ob_iconv_handler.phpt]


are you using iconv?


Bug #29992 (foreach by reference corrupts the array)
[ext/standard/tests/array/bug29992.phpt]



Bug #31213 (Sideeffects caused by bug #29493)
[ext/standard/tests/array/bug31213.phpt]


er?


Bug #22414 (passthru() does not read data correctly)
[ext/standard/tests/file/bug22414.phpt]


do you use passthru()


date_sunrise() and date_sunset() functions
[ext/standard/tests/general_functions/sunfuncts.phpt]


do you use date_sun*()


Bug #25665 (var_dump () hangs on Nan and INF)
[ext/standard/tests/math/bug25665.phpt]


are you var_dump()ing? math stuff?


Bug #31402 (unserialize() generates references when it should not)
[ext/standard/tests/serialize/bug31402.phpt]


are you (un)serializing stuff [in the session]? objects per chance?


Bug #20382 (strtotime ("Monday", $date) produce

Re: [PHP] PHP and MySQL and resouce limits

2005-07-20 Thread Matt Darby



John Hinton wrote:

I don't get it... I have been upping my memory limit for PHP. 32megs 
now... and am making calls to a database on a different server. I see 
the loads run up on the other server as it cruches the numbers.. and 
PHP is in the process of creating a single little page with about 40 
numbers on it, from these returns. Now, I do know I'm crunching a LOT 
of data in this instance, but it seems like MySQL is doing the work 
and that PHP shouldn't be hitting 32 my 32meg wall. Running the same 
query on a smaller dataset doesn't hit this limit, so I know it's not 
a function of the PHP code itself.


So, I must be missing something, why is PHP somehow tied to the work 
MySQL is doing? As in memory usage seems that MySQL should be 
simply sending PHP the returns on its commands... hm


Thanks,
John Hinton



Are you sure your query is correct? This happens to me sometimes if the 
query is rather crazy...


Matt Darby

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



[PHP] Attaching a pdf in email (no body text displays)

2005-07-20 Thread Ade Smith
I am attaching a PDF document to an email, this part works great, however to
get this to work it prevents the text in the body of the message to be
displayed, what am I doing wrong?  Here is the code

 

$filename = " confirmation.pdf"; 

if(!($fp = fopen($filename, "r"))):

$error = "Can't open file";

echo $error;

exit;

endif;

 

$boundary = "b" . md5(uniqid(time()));

$boundary='"'.$boundary.'"';

 

$attach = fread($fp, filesize($filename));

$attach = chunk_split(base64_encode($attach));

 

$mime = "from: [EMAIL PROTECTED]";

$mime .= "Content-type: multipart/mixed; boundary=$boundary";

 

$mime .= "--$boundary\r\n";

$mime .= "Content-type:  application/pdf; name=\"confirmation.pdf\"\r\n";

$mime .= "Content-Transfer-Encoding: base64\r\n\r\n";

$mime .= "Content-Disposition: attachment;\r\n";

$mime .= "\r\n\r\n$attach\n";

 

$mime .= "--$boundary\r\n";

$mime .= "Content-Type: text/HTML; charset=iso-8859-1\r\n";

$mime .= "Content-Transfer-Encoding: 7bit\r\n\r\n";

$mime .= "test test test";

$mime .= "--$boundary\r\n";

 

mail("[EMAIL PROTECTED]","Your Confirmation: $confirmation_number","test test
test test test",$mime);

 

 

 

 

 



[PHP] pspell.so causes server to crash ...

2005-07-20 Thread Marc G. Fournier


Was having this problem with 4.3.11, figured I'd upgrade to 4.4.0 first, 
to make sure it wasn't fixed already ... but, if I have the pspell.so 
extension enabled, and do a SIGHUP of the server, the apache process 
(apache 1) crashes ...


I've currently got the following aspell installed from FreeBSD ports:

drwxr-xr-x  2 root  wheel  512 Jul 15 14:32 aspell-0.60.3

and a backtrace of the apache process shows:

(gdb) bt
#0  0x280ec610 in kill () from /usr/lib/libc_r.so.4
#1  0x805c1d8 in sig_coredump ()
#2  0x280fe79b in _thread_sig_handler () from /usr/lib/libc_r.so.4
#3  0x280fe606 in _thread_sig_handler () from /usr/lib/libc_r.so.4
#4  0x7fbfffac in ?? ()
#5  0x288ccec0 in acommon::GlobalCacheBase::~GlobalCacheBase () from 
/usr/local/lib/libaspell.so.16
#6  0x28906ce9 in __static_initialization_and_destruction_0 () from 
/usr/local/lib/libaspell.so.16
#7  0x28906db2 in global destructors keyed to acommon::ToUniLookup::reset () 
from /usr/local/lib/libaspell.so.16
#8  0x288ccaae in __do_global_dtors_aux () from /usr/local/lib/libaspell.so.16
#9  0x289cb6f5 in _fini () from /usr/local/lib/libaspell.so.16
#10 0x280932ae in dlclose () from /usr/libexec/ld-elf.so.1
#11 0x28474ee1 in object.11 () from /usr/local/libexec/apache/libphp4.so
#12 0x28476945 in object.11 () from /usr/local/libexec/apache/libphp4.so
#13 0x28476a8e in object.11 () from /usr/local/libexec/apache/libphp4.so
#14 0x2847250c in object.11 () from /usr/local/libexec/apache/libphp4.so
#15 0x2844d292 in object.11 () from /usr/local/libexec/apache/libphp4.so
#16 0x2844d26b in object.11 () from /usr/local/libexec/apache/libphp4.so
#17 0x2848c004 in object.11 () from /usr/local/libexec/apache/libphp4.so
#18 0x80517cb in run_cleanups ()
#19 0x8050610 in ap_clear_pool ()
#20 0x805df12 in standalone_main ()
#21 0x805e747 in main ()
#22 0x804fd32 in _start (arguments=0x7fbffcf8 "/usr/local/sbin/httpd") at 
/usr/src/lib/csu/i386-elf/crt1.c:119

As soon as I disable pspell.so, the problem goes away ...

is this a problem with the pspell extension, or just the aspell library 
itself?


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



[PHP] objects destroyed in same order as created?

2005-07-20 Thread Jasper Bryant-Greene

Hi all

I am currently working on a PHP 5 application. For the sake of 
simplicity, I'll only describe 3 classes here, as that is all that is 
required for you to see my problem.


I have a DB class that interacts with the database, a Session class that 
controls the session with the user, and a User class that stores the 
information about the logged-in user.


I create instances of these classes in the order [DB, Session, User] at 
request startup. They have to be in this order as the Session and User 
classes need the database, and the User class needs the session.


The User and Session destructors both need the database to write any 
changed information back to the database, but it seems that the 
destructors are called in the order that the objects are created, so the 
database is taken down first.


Wouldn't it make more sense for just about all applications to destroy 
objects in the reverse order that they were created? Is there any way to 
work around this?


Jasper

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



Re: [PHP] Attaching a pdf in email (no body text displays)

2005-07-20 Thread Chris

I've attached some comments inline.

Ade Smith wrote:


I am attaching a PDF document to an email, this part works great, however to
get this to work it prevents the text in the body of the message to be
displayed, what am I doing wrong?  Here is the code



$filename = " confirmation.pdf"; 


if(!($fp = fopen($filename, "r"))):

   $error = "Can't open file";

   echo $error;

   exit;

endif;



$boundary = "b" . md5(uniqid(time()));

$boundary='"'.$boundary.'"';



$attach = fread($fp, filesize($filename));

$attach = chunk_split(base64_encode($attach));



$mime = "from: [EMAIL PROTECTED]";

$mime .= "Content-type: multipart/mixed; boundary=$boundary";



$mime .= "--$boundary\r\n";

$mime .= "Content-type:  application/pdf; name=\"confirmation.pdf\"\r\n";

$mime .= "Content-Transfer-Encoding: base64\r\n\r\n";

$mime .= "Content-Disposition: attachment;\r\n";

$mime .= "\r\n\r\n$attach\n";


 


It's been while, but shouldn't this line read:

$mime .= "\r\n$attach\r\n";

Just to ensure that no extra characters get included witht he file? I 
don't think it matters much with PDFs, but it would definitely break 
other files.



$mime .= "--$boundary\r\n";

$mime .= "Content-Type: text/HTML; charset=iso-8859-1\r\n";

$mime .= "Content-Transfer-Encoding: 7bit\r\n\r\n";

$mime .= "test test test";

$mime .= "--$boundary\r\n";


 


You forgot the trailing -- here, so this line should read:

$mime .= "--$boundary--\r\n";

Otherwise the mail clients assume there is another part to the MIME 
message (which defaults to empty). And the last part is always the one 
that is intended to be viewed. , So it displays the empty one.



mail("[EMAIL PROTECTED]","Your Confirmation: $confirmation_number","test test
test test test",$mime);
 



Once again, it's been awhile, but I believe the best way to do this is 
to put only the main body headers into the header variable ($mime in 
this case), and put the parts in the body So the body itself is split 
into the parts.


This is probably contributing to the problem as well.

Chris

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



[PHP] AJAX & PHP

2005-07-20 Thread balwant singh
Have anybody tried PHP & AJAX, may please share your experience.  also 
pls. suggest good link of tutorial on this.


With Best Wishes

Balwant Singh

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



[PHP] Rate to charge

2005-07-20 Thread timothy johnson
I have been asked to look in toprogramming a PHP system for someone, and
while I have been programming for a while this will be the first time
it will be for someone other then a friend. Just wanted to get some
ideas on how much you charge for program PHP/Mysql. Any ideas on how
to charge would be great. Thanks

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



[PHP] Re: Rate to charge

2005-07-20 Thread Jasper Bryant-Greene

timothy johnson wrote:

I have been asked to look in toprogramming a PHP system for someone, and
while I have been programming for a while this will be the first time
it will be for someone other then a friend. Just wanted to get some
ideas on how much you charge for program PHP/Mysql. Any ideas on how
to charge would be great. Thanks


I'm in New Zealand and charge NZ$50/hour as a base rate for PHP web 
development. I don't know what that is in your currency, try 
www.xe.com/ucc to find out.


It's really up to you, though, and how much you value your time. Also 
take into account your expertise in PHP and MySQL, and in the problem 
domain. If you do not have a lot of expertise in either of those areas 
then you may not want to charge as highly.


Jasper

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



Re: [PHP] Re: Rate to charge

2005-07-20 Thread Evert | Rooftop

Jasper Bryant-Greene wrote:


timothy johnson wrote:


I have been asked to look in toprogramming a PHP system for someone, and
while I have been programming for a while this will be the first time
it will be for someone other then a friend. Just wanted to get some
ideas on how much you charge for program PHP/Mysql. Any ideas on how
to charge would be great. Thanks



I'm in New Zealand and charge NZ$50/hour as a base rate for PHP web 
development. I don't know what that is in your currency, try 
www.xe.com/ucc to find out.



That's almost probably as cheap as india.

It's really up to you, though, and how much you value your time. Also 
take into account your expertise in PHP and MySQL, and in the problem 
domain. If you do not have a lot of expertise in either of those areas 
then you may not want to charge as highly.


Jasper

I agree, it really depends on your (proffessional) experience, and 
expertise and even the client. I think I started at 25 euro and for my 
last clients I charged somewhere between 75 and 100 euro. I usually 
charge more for bigger corporations, because they tend to whine a lot 
more, and you'll always end up spending twice as much time as expected.


One thing I learned. It's better to charge 100 dollars per hour and say 
you need 50 hours, instead of charging 50 hours and say it will take 100.


Evert

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