Re: [PHP] Stupid question

2013-02-28 Thread Daniel Brown
On Wed, Feb 27, 2013 at 9:14 PM, Curtis Maurand cur...@maurand.com wrote:

 Well that means the docs on the PEAR MDB2 website are incorrect and should
 be fixed.  Thanks for the lesson.

If there's an issue with the docs, you're right, they should
definitely be fixed.  We'd appreciate it very much if you could take a
moment and submit it as a bug report at https://bugs.php.net/.

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/

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



Re: [PHP] Stupid question

2013-02-27 Thread Sebastian Krebs
2013/2/27 tamouse mailing lists tamouse.li...@gmail.com

 On Tue, Feb 26, 2013 at 4:41 PM, Jim Lucas li...@cmsws.com wrote:
  On 02/26/2013 01:27 PM, Curtis Maurand wrote:
 
  I have the following:
 
  $dsn = mysqli://$username:$password@$hostname2/$database;
  $options = array(
  'debug' = 3,
  'result_buffering' = false,
  );
  $dbh = MDB2::factory($dsn, $options);
  if (PEAR::isError($mdb2))
  {
  die($mdb2-getMessage());
  }
 
 
 
 
  function tallyCart($_u_id,$dbh){
  while($row = $result-fetchrow(MDB2_FETCHMODE_ASSOC)) {
 
 
  Talking in code.  The above two lines tell me...
 
  $dbh != $result
 
  isset($result) === false
 
 
 
  $_showCheckOut=1;
  $_pdetail=new ProductDetail($row{'product_ID'},
  $row{'product_Quantity'}, $_u_id);
  $_getSubTotal += $_pdetail-_subTotal;
  $_counter++;
  }
  }
 
  I'm getting: Call to undefined method MDB2_Error::fetchrow()
 
  anyone have any ideas? Can I not pass a database handle to a function?
 
  Thanks,
  Curtis
 
 
 
 
  --
  Jim Lucas
 
  http://www.cmsws.com/
  http://www.cmsws.com/examples/
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 

 Well, *I* have a stupid question: is $lhv = expr the same as $lhv = expr
 ??


Yes :) Because an operator = doesn't exists, thus the lexer will split
them into the tokens = , or = WHITESPACE  respectively. The parser
again ignores whitespaces.



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




-- 
github.com/KingCrunch


Re: [PHP] Stupid question

2013-02-27 Thread tamouse mailing lists
On Wed, Feb 27, 2013 at 2:42 AM, Sebastian Krebs krebs@gmail.com wrote:
 2013/2/27 tamouse mailing lists tamouse.li...@gmail.com
 Well, *I* have a stupid question: is $lhv = expr the same as $lhv = expr
 ??

 Yes :) Because an operator = doesn't exists, thus the lexer will split
 them into the tokens = , or = WHITESPACE  respectively. The parser
 again ignores whitespaces.


Thanks; thought I was seeing something new, and/or going nuts --
apologies for the thread hijack

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



Re: [PHP] Stupid question

2013-02-27 Thread Curtis Maurand

On 2/27/2013 6:32 PM, tamouse mailing lists wrote:

On Wed, Feb 27, 2013 at 2:42 AM, Sebastian Krebs krebs@gmail.com wrote:

2013/2/27 tamouse mailing lists tamouse.li...@gmail.com

Well, *I* have a stupid question: is $lhv = expr the same as $lhv = expr
??

Yes :) Because an operator = doesn't exists, thus the lexer will split
them into the tokens = , or = WHITESPACE  respectively. The parser
again ignores whitespaces.


Thanks; thought I was seeing something new, and/or going nuts --
apologies for the thread hijack


Well that means the docs on the PEAR MDB2 website are incorrect and 
should be fixed.  Thanks for the lesson.


--Curtis


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



Re: [PHP] Stupid question

2013-02-26 Thread Daniel Brown
On Tue, Feb 26, 2013 at 4:27 PM, Curtis Maurand cur...@maurand.com wrote:
 I have the following:

 $dsn = mysqli://$username:$password@$hostname2/$database;
 $options = array(
 'debug' = 3,
 'result_buffering' = false,
   );
   $dbh = MDB2::factory($dsn, $options);
 if (PEAR::isError($mdb2))
 {
 die($mdb2-getMessage());
 }




 function tallyCart($_u_id,$dbh){
while($row = $result-fetchrow(MDB2_FETCHMODE_ASSOC)) {
 $_showCheckOut=1;
 $_pdetail=new ProductDetail($row{'product_ID'},
 $row{'product_Quantity'}, $_u_id);
  $_getSubTotal += $_pdetail-_subTotal;
  $_counter++;
 }
 }

 I'm getting:  Call to undefined method MDB2_Error::fetchrow()

 anyone have any ideas?  Can I not pass a database handle to a function?

 Thanks,
 Curtis

Hate to answer a question with a question, but:

1.) Do you have the PEAR package MDB2 installed?
2.) Where is $result defined?  I don't see it in your code snippet here.

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/

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



Re: [PHP] Stupid question

2013-02-26 Thread Ashley Sheridan


Daniel Brown danbr...@php.net wrote:

On Tue, Feb 26, 2013 at 4:27 PM, Curtis Maurand cur...@maurand.com
wrote:
 I have the following:

 $dsn = mysqli://$username:$password@$hostname2/$database;
 $options = array(
 'debug' = 3,
 'result_buffering' = false,
   );
   $dbh = MDB2::factory($dsn, $options);
 if (PEAR::isError($mdb2))
 {
 die($mdb2-getMessage());
 }




 function tallyCart($_u_id,$dbh){
while($row = $result-fetchrow(MDB2_FETCHMODE_ASSOC)) {
 $_showCheckOut=1;
 $_pdetail=new ProductDetail($row{'product_ID'},
 $row{'product_Quantity'}, $_u_id);
  $_getSubTotal += $_pdetail-_subTotal;
  $_counter++;
 }
 }

 I'm getting:  Call to undefined method MDB2_Error::fetchrow()

 anyone have any ideas?  Can I not pass a database handle to a
function?

 Thanks,
 Curtis

Hate to answer a question with a question, but:

1.) Do you have the PEAR package MDB2 installed?
2.) Where is $result defined?  I don't see it in your code snippet
here.

Also, there is no such thing as a stupid question, only a stupid answer...

Thanks,
Ash
http://www.ashleysheridan.co.uk

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



Re: [PHP] Stupid question

2013-02-26 Thread Curtis Maurand

On 2/26/2013 4:33 PM, Daniel Brown wrote:

On Tue, Feb 26, 2013 at 4:27 PM, Curtis Maurand cur...@maurand.com wrote:

I have the following:

$dsn = mysqli://$username:$password@$hostname2/$database;
$options = array(
 'debug' = 3,
 'result_buffering' = false,
   );
   $dbh = MDB2::factory($dsn, $options);
 if (PEAR::isError($mdb2))
 {
 die($mdb2-getMessage());
 }




function tallyCart($_u_id,$dbh){
while($row = $result-fetchrow(MDB2_FETCHMODE_ASSOC)) {
 $_showCheckOut=1;
 $_pdetail=new ProductDetail($row{'product_ID'},
$row{'product_Quantity'}, $_u_id);
  $_getSubTotal += $_pdetail-_subTotal;
  $_counter++;
 }
}

I'm getting:  Call to undefined method MDB2_Error::fetchrow()

anyone have any ideas?  Can I not pass a database handle to a function?

Thanks,
Curtis

 Hate to answer a question with a question, but:

 1.) Do you have the PEAR package MDB2 installed?
 2.) Where is $result defined?  I don't see it in your code snippet 
here.


Sorry,

$myquery  = SELECT * from tbl_Cart where u_ID='$_u_id';
echo $myquery;
$result = $dbh-query($myquery);

I then tried setting the buffering to true and did a 
if($result-numrows() 0) and wrapped it around the entire fetchrow loop 
and I still get the same thing.


I just took a look and the libraries are installed if not a bit 
outdated, but they are there.



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



Re: [PHP] Stupid question

2013-02-26 Thread Serge Fonville
Hi,

I'm getting:  Call to undefined method MDB2_Error::fetchrow()

Have your checked if $dbh-query() throws an error?
It seems $result is a different type than expected.

HTH

Kind regards/met vriendelijke groet,

Serge Fonville

http://www.sergefonville.nl

Convince Microsoft!
They need to add TRUNCATE PARTITION in SQL Server
https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table


2013/2/26 Curtis Maurand cur...@maurand.com

 On 2/26/2013 4:33 PM, Daniel Brown wrote:

 On Tue, Feb 26, 2013 at 4:27 PM, Curtis Maurand cur...@maurand.com
 wrote:

 I have the following:

 $dsn = mysqli://$username:$password@**$hostname2/$database;
 $options = array(
  'debug' = 3,
  'result_buffering' = false,
);
$dbh = MDB2::factory($dsn, $options);
  if (PEAR::isError($mdb2))
  {
  die($mdb2-getMessage());
  }




 function tallyCart($_u_id,$dbh){
 while($row = $result-fetchrow(MDB2_**FETCHMODE_ASSOC)) {
  $_showCheckOut=1;
  $_pdetail=new ProductDetail($row{'product_**ID'},
 $row{'product_Quantity'}, $_u_id);
   $_getSubTotal += $_pdetail-_subTotal;
   $_counter++;
  }
 }

 I'm getting:  Call to undefined method MDB2_Error::fetchrow()

 anyone have any ideas?  Can I not pass a database handle to a function?

 Thanks,
 Curtis

  Hate to answer a question with a question, but:

  1.) Do you have the PEAR package MDB2 installed?
  2.) Where is $result defined?  I don't see it in your code
 snippet here.

  Sorry,

 $myquery  = SELECT * from tbl_Cart where u_ID='$_u_id';
 echo $myquery;
 $result = $dbh-query($myquery);

 I then tried setting the buffering to true and did a if($result-numrows()
 0) and wrapped it around the entire fetchrow loop and I still get the same
 thing.

 I just took a look and the libraries are installed if not a bit outdated,
 but they are there.



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




Re: [PHP] Stupid question

2013-02-26 Thread Jim Lucas

On 02/26/2013 01:27 PM, Curtis Maurand wrote:

I have the following:

$dsn = mysqli://$username:$password@$hostname2/$database;
$options = array(
'debug' = 3,
'result_buffering' = false,
);
$dbh = MDB2::factory($dsn, $options);
if (PEAR::isError($mdb2))
{
die($mdb2-getMessage());
}




function tallyCart($_u_id,$dbh){
while($row = $result-fetchrow(MDB2_FETCHMODE_ASSOC)) {


Talking in code.  The above two lines tell me...

$dbh != $result

isset($result) === false



$_showCheckOut=1;
$_pdetail=new ProductDetail($row{'product_ID'},
$row{'product_Quantity'}, $_u_id);
$_getSubTotal += $_pdetail-_subTotal;
$_counter++;
}
}

I'm getting: Call to undefined method MDB2_Error::fetchrow()

anyone have any ideas? Can I not pass a database handle to a function?

Thanks,
Curtis





--
Jim Lucas

http://www.cmsws.com/
http://www.cmsws.com/examples/

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



Re: [PHP] Stupid question

2013-02-26 Thread tamouse mailing lists
On Tue, Feb 26, 2013 at 4:41 PM, Jim Lucas li...@cmsws.com wrote:
 On 02/26/2013 01:27 PM, Curtis Maurand wrote:

 I have the following:

 $dsn = mysqli://$username:$password@$hostname2/$database;
 $options = array(
 'debug' = 3,
 'result_buffering' = false,
 );
 $dbh = MDB2::factory($dsn, $options);
 if (PEAR::isError($mdb2))
 {
 die($mdb2-getMessage());
 }




 function tallyCart($_u_id,$dbh){
 while($row = $result-fetchrow(MDB2_FETCHMODE_ASSOC)) {


 Talking in code.  The above two lines tell me...

 $dbh != $result

 isset($result) === false



 $_showCheckOut=1;
 $_pdetail=new ProductDetail($row{'product_ID'},
 $row{'product_Quantity'}, $_u_id);
 $_getSubTotal += $_pdetail-_subTotal;
 $_counter++;
 }
 }

 I'm getting: Call to undefined method MDB2_Error::fetchrow()

 anyone have any ideas? Can I not pass a database handle to a function?

 Thanks,
 Curtis




 --
 Jim Lucas

 http://www.cmsws.com/
 http://www.cmsws.com/examples/


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


Well, *I* have a stupid question: is $lhv = expr the same as $lhv = expr ??

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



Re: [PHP] Stupid question of the day (Editing text file in $HOME via web)

2006-11-01 Thread Richard Lynch
On Tue, October 31, 2006 9:42 pm, Google Kreme wrote:
 My first guess would be to check out the various panel solutions
 for
 having a web interface that webhosts provide to edit what is
 essentially a simple text file, which configures the web server,
 mail
 server, ftp server, etc.  These all have all the exact same issues
 you
 will face, so there might be one that fits your needs.

 Any specific recommendations?  The only one of these I am familiar
 with is the absurdly expensive cpanel.

Sorry.

My cpanel is called vi :-)

Google is your friend on this one.  There are only a few thousand
OpenSource panels out there, I'll bet...

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Stupid question of the day (Editing text file in $HOME via web)

2006-10-31 Thread Ed Lazor


On Oct 30, 2006, at 11:34 PM, Google Kreme wrote:
So, do I whack up something where I just load the file into a HTML  
Textarea and then write it back (simple enough, though possibly  
rather dangerous), or is there something straightforward I should  
go ahead and use that might find use elsewhere on the server?


Playing Devils Advocate here, but why not store the text in a database?

The text file should be somewhat secure if you're manually reading  
and writing to it in PHP, making sure that you're the one controlling  
the file name, the file extension (file type), the file permissions,  
and the file size.


-Ed

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



Re: [PHP] Stupid question of the day (Editing text file in $HOME via web)

2006-10-31 Thread Richard Lynch
On Tue, October 31, 2006 1:34 am, Google Kreme wrote:
 So, do I whack up something where I just load the file into a HTML
 Textarea and then write it back (simple enough, though possibly
 rather dangerous), or is there something straightforward I should go
 ahead and use that might find use elsewhere on the server?

The unanswered question is:

How many people might try to edit it at once, and what will you do to
resolve race conditions?

Whipping up a TEXTAREA for a single admin person who is in charge of
this file, and the only one to edit it under normal circumstances,
would work fine.

Doing that for a team of 100 people who have access to this file will
end up with somebody very cranky when their 1000-entry addition got
over-written by another user fixing a small typo.

Other solutions to consider:
1. Put the file in a database as individual (AAA) XXX- records,
and the file can be generated from the DB every time it changes with
a trigger, or every day or something reasonable.  Having individual
records for each line reduces the damage of the race condition to a
single entry needing to be re-done.  You can also more easily find
code to handle the race condition for the DB in a web environment.

2. Put the file into subversion or CVS, if all editors are developers.

3. Forget the web interface, because the file won't really change that
often anyway, and just use 'vi' to make the rare change. :-)

There likely *IS* a web tool out there just like you want...

My first guess would be to check out the various panel solutions for
having a web interface that webhosts provide to edit what is
essentially a simple text file, which configures the web server, mail
server, ftp server, etc.  These all have all the exact same issues you
will face, so there might be one that fits your needs.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Stupid question of the day (Editing text file in $HOME via web)

2006-10-31 Thread Google Kreme

On 31 Oct 2006, at 09:20 , Ed Lazor wrote:

On Oct 30, 2006, at 11:34 PM, Google Kreme wrote:
So, do I whack up something where I just load the file into a HTML  
Textarea and then write it back (simple enough, though possibly  
rather dangerous), or is there something straightforward I should  
go ahead and use that might find use elsewhere on the server?


Playing Devils Advocate here, but why not store the text in a  
database?


Because the text file is used by egrep/procmail.

The text file should be somewhat secure if you're manually reading  
and writing to it in PHP, making sure that you're the one  
controlling the file name, the file extension (file type), the file  
permissions, and the file size.


Yeah, so just dump it into a textarea and go?

On 31 Oct 2006, at 10:32 , Richard Lynch wrote:

On Tue, October 31, 2006 1:34 am, Google Kreme wrote:

So, do I whack up something where I just load the file into a HTML
Textarea and then write it back (simple enough, though possibly
rather dangerous), or is there something straightforward I should go
ahead and use that might find use elsewhere on the server?


The unanswered question is:

How many people might try to edit it at once, and what will you do to
resolve race conditions?


There will be only one person able to access the file, but I will  
need to somehow 'time-out' a edit if it doesn't get committed.



1. Put the file in a database as individual (AAA) XXX- records,
and the file can be generated from the DB every time it changes with
a trigger, or every day or something reasonable.  Having individual
records for each line reduces the damage of the race condition to a
single entry needing to be re-done.  You can also more easily find
code to handle the race condition for the DB in a web environment.


That's not a bad idea.  It might be worth the effort to setup the  
database and then simply have a php scriptlette generate the actual  
plaintext.  Hmm.  Worth considering, at least.  Some way of  
generating the plain text only when the file changes would be needed  
though,a s I don't expect it to change all that often.




2. Put the file into subversion or CVS, if all editors are developers.


Nope, it needs to be luser friendly.


3. Forget the web interface, because the file won't really change that
often anyway, and just use 'vi' to make the rare change. :-)


See above.


There likely *IS* a web tool out there just like you want...


Yeah, that's what I was thinking.


My first guess would be to check out the various panel solutions for
having a web interface that webhosts provide to edit what is
essentially a simple text file, which configures the web server, mail
server, ftp server, etc.  These all have all the exact same issues you
will face, so there might be one that fits your needs.


Any specific recommendations?  The only one of these I am familiar  
with is the absurdly expensive cpanel.


--
You can think and you can fight, but the world's always movin', and  
if you wanna stay ahead you gotta dance.


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



Re: [PHP] stupid question...compiling php

2006-08-07 Thread Jochem Maas
blackwater dev wrote:
 Ok,
 
 I am using a hosted server and php is installed from the linux distro.  I
 usually have all the stuff in a php file somewhere so I can just go back
 ./configure, etc.  I can't seem to find the configure for php on this
 box so
 I can recompile but I know it is there as I can use php and see the
 version,
 how can I find the configure to use?

php -l | grep configure

or

? phpinfo();

 
 Thanks!
 

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



Re: [PHP] stupid question...compiling php

2006-08-07 Thread blackwater dev

Ok, doing that now and it's taking a while.  I can do phpinfo but that tells
me the config line and where the ini files are, not necessarily where the
configure stuff is to recompile...correct?

On 8/7/06, Jochem Maas [EMAIL PROTECTED] wrote:


blackwater dev wrote:
 Ok,

 I am using a hosted server and php is installed from the linux
distro.  I
 usually have all the stuff in a php file somewhere so I can just go back
 ./configure, etc.  I can't seem to find the configure for php on this
 box so
 I can recompile but I know it is there as I can use php and see the
 version,
 how can I find the configure to use?

php -l | grep configure

or

? phpinfo();


 Thanks!





Re: [PHP] stupid question...compiling php

2006-08-07 Thread Jochem Maas
blackwater dev wrote:
 Ok, doing that now and it's taking a while.  

it might take forever. I made a thinko, it should have been:

php -i | grep configure

(it should be pretty much instantaneous)

I can do phpinfo but that
 tells
 me the config line and where the ini files are, not necessarily where the
 configure stuff is to recompile...correct?

correct, other than the system libs (which you refer to for some configure 
options)
- I doubt those would have change.

which pretty much leaves the php sources - and this you can download from
lots of places (you don't need to recompile from the same directory), if php
was installed as a package you will not have the source locally (probably) and
the chances are you'll be missing a stack of libs and/or development header 
files
which you would then need to install (again this depends on what configure flag
you're going to use)

 
 On 8/7/06, Jochem Maas [EMAIL PROTECTED] wrote:

 blackwater dev wrote:
  Ok,
 
  I am using a hosted server and php is installed from the linux
 distro.  I
  usually have all the stuff in a php file somewhere so I can just go
 back
  ./configure, etc.  I can't seem to find the configure for php on this
  box so
  I can recompile but I know it is there as I can use php and see the
  version,
  how can I find the configure to use?

 php -l | grep configure

 or

 ? phpinfo();

 
  Thanks!
 


 

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



Re: [PHP] stupid question...compiling php

2006-08-07 Thread Andrew Kreps

I'll bet your hosting environment has not installed the php sources.
If the server is shared with other clients, you'll probably need to
download the source and compile php in your user space and run it as a
CGI (if your host allows this configuration).  Hopefully they have
some allowances for this, you may want to check with them.

On 8/7/06, Jochem Maas [EMAIL PROTECTED] wrote:

blackwater dev wrote:
I can do phpinfo but that
 tells
 me the config line and where the ini files are, not necessarily where the
 configure stuff is to recompile...correct?



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



RE: [PHP] stupid question about a class

2004-12-08 Thread Stefan

In your class function you should move your query to a variable e.g. $query

Then:

return $query;


And in your main program:

$whatever = $q-getQuery();

__
Stefan


 -Ursprüngliche Nachricht-
 Von: Richard Kurth [mailto:[EMAIL PROTECTED]
 Gesendet: Mittwoch, 8. Dezember 2004 19:21
 An: PHP General
 Betreff: [PHP] stupid question about a class
 
 
 I have a stupid question but I can not figure it out
 I am using a class that creates the select statement for mysql.
 I am ale to add all the data with out any problem. But when I run the
 class to get the results. I can only see the results by running echo in
 front of the call to the class .
 echo $q-getQuery();
 Output SELECT * FROM listing WHERE state='wa'
 if I
 $q-getQuery();
 echo $g;
 Output Object id #1
 How do I use the results in my mysql query If I can not move it to a
 variable
 
 
 
 
 --
 Best regards,
  Richard  mailto:[EMAIL PROTECTED]
 
 --
 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] stupid question about a class

2004-12-08 Thread Richard Lynch
Richard Kurth wrote:

 I have a stupid question but I can not figure it out
 I am using a class that creates the select statement for mysql.
 I am ale to add all the data with out any problem. But when I run the
 class to get the results. I can only see the results by running echo in
 front of the call to the class .
 echo $q-getQuery();
 Output SELECT * FROM listing WHERE state='wa'
 if I
 $q-getQuery();
 echo $g;
 Output Object id #1
 How do I use the results in my mysql query If I can not move it to a
 variable

You are confusing the object itself ($g) with one of its member functions
($g-getQuery())

If you echo $g, you will see only the object itself.
If you echo $g-getQuery() you will see the query you built.

If you want that query in a variable, you could do:
$query = $g-getQuery();
mysql_query($query);

You could even do:
mysql_query($g-getQuery());

But you wouldn't be able to do:
mysql_query($g);
because $g isn't a string, it's an object.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Stupid question

2004-12-04 Thread Raditha Dissanayake
Phpu wrote:
Hi,
If i have a php and mysql website...how many connections support mysql at one time ?
 

Sorry people in this list do not know how to configure mysql
Thanks
 


--
Raditha Dissanayake.
--
http://www.radinks.com/print/card-designer/ | Card Designer Applet
http://www.radinks.com/upload/  | Drag and Drop Upload 

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


Re: [PHP] Stupid question

2004-12-04 Thread Greg Donald
On Sun, 5 Dec 2004 02:48:09 +0200, Phpu [EMAIL PROTECTED] wrote:
 If i have a php and mysql website...how many connections support mysql at one 
 time ?

The number of connections allowed is controlled by the max_connections
system variable. Its default value is 100. If you need to support more
connections, you should restart mysqld with a larger value for this
variable.

You can increase this value in the MySQL server config file (mine is
in /etc/mysql/my.cnf) using this syntax:

[mysqld]
set-variable = max_connections=200


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] Stupid question

2004-03-17 Thread Robert Cummings
On Wed, 2004-03-17 at 15:55, Jeff McKeon wrote:
 I've been using PHP for about 6 months and I'm ok with it but I'm now
 starting to get into more advanced stuff and inheriting project that
 other people have coded.  One of the major stumpers I have is any line
 of code that contains:
 
 $this-
 
 What does this do?  I know it has something to do with classes but can't
 quite get my head around it.
 
 Thanks,
 
 Jeff

It refers to the object upon which the class method was called. So
outside of the class you might have:

$foo = new FooClass();
$foo-doSomething();

then inside the class you might have the following:

class FooClass
{
function doSomething()
{
$this-doSomethingElse();
}

function doSomethingElse()
{
$foo = 1;

return (++$foo === $foo++);  //  ;)
}
}

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] Stupid question

2004-03-17 Thread Aaron Gould
Jeff McKeon wrote:
$this-

What does this do?  I know it has something to do with classes but can't
quite get my head around it.
You might want to check out this:

http://ca.php.net/oop

--
Aaron Gould
Parts Canada - Web Developer
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Stupid question

2004-03-17 Thread noginn
Jeff McKeon wrote:

I've been using PHP for about 6 months and I'm ok with it but I'm now
starting to get into more advanced stuff and inheriting project that
other people have coded.  One of the major stumpers I have is any line
of code that contains:
$this-

What does this do?  I know it has something to do with classes but can't
quite get my head around it.
Thanks,

Jeff

 

I am not expert but I have a general idea of what it is and used for, 
for example you have a class named test.
Inside that class you have a function named testfunc.

If you were going to call that function you would use $this-testfunc(); 
*I think*
I am sure you will get some more detailed explanations from the experts 
though :)

I am new here so thought I would start to contribute.

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


Re: [PHP] Stupid question

2004-03-17 Thread Ben Ramsey
If you were going to call that function you would use $this-testfunc(); 
You're on the right track.  If you're going to call that function (or 
method) from within the class, then you use the $this.  Also, you can 
use $this to access member variables from within the class.  Outside of 
the class, you would need to access those methods or variables using the 
name of the object.

Don't be afraid to contribute!  It will even help you grow as a 
programmer to try to help others solve their coding problems.

--
Regards,
 Ben Ramsey
 http://benramsey.com
 http://www.phpcommunity.org/wiki/People/BenRamsey
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Stupid question

2004-03-17 Thread Jeff McKeon
Ewe... OOP

Ok, I guess I'll have to learn OOP.  

Thanks for the info!

Jeff

 -Original Message-
 From: Jordan S. Jones [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, March 17, 2004 4:02 PM
 To: Jeff McKeon
 Subject: Re: [PHP] Stupid question
 
 
 That has to deal with Object Oriented programming, and instead of 
 fumbling my way through trying to explain it, I will point you to the 
 PHP documents that deal with this.
 
 Overview:
 http://www.php.net/manual/en/language.oop.php
 
 OO Functions/what not: http://www.php.net/manual/en/ref.classobj.php
 
 Jordan S. Jones
 
 Jeff McKeon wrote:
 
 I've been using PHP for about 6 months and I'm ok with it 
 but I'm now 
 starting to get into more advanced stuff and inheriting project that 
 other people have coded.  One of the major stumpers I have 
 is any line 
 of code that contains:
 
 $this-
 
 What does this do?  I know it has something to do with classes but 
 can't quite get my head around it.
 
 Thanks,
 
 Jeff
 
   
 
 
 

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



Re: [PHP] Stupid question

2004-03-17 Thread Ben Ramsey
With PHP 5 looming on the horizon (and even many already using it), it'd 
be a good idea to go ahead and learn OOP now.  ;-)

Jeff McKeon wrote:

Ewe... OOP

Ok, I guess I'll have to learn OOP.  

Thanks for the info!

Jeff

--
Regards,
 Ben Ramsey
 http://benramsey.com
 http://www.phpcommunity.org/wiki/People/BenRamsey
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Stupid question

2004-03-17 Thread Robert Cummings
On Wed, 2004-03-17 at 16:08, Jeff McKeon wrote:

 Ewe... OOP

That should read:

$this-ewww( 'OOP' )

:)

-- 
..
| 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] Stupid question perhaps?

2003-03-27 Thread Andrew Powell
Tom:

The install.txt file that came with PHP 4.3.1 states:

   At this time, support for Apache 2 is experimental.  It's
   highly recommended you use PHP with Apache 1.3.x and not
   Apache 2.
aap

Tom Tsongas wrote:

 I just recently upgraded to PHP 4.3.1 and Apache 2.0.44. I had been
 previously running PHP 4.0.4 and Apache 1.3.20. I had a fully enabled
 PHP website that I had been developing on for some time.
 After I upgraded, the entire website is virtually non-functional. I
 keep receiving 'Page cannot Display' or 'Document contains no data'
 errors.

 I am not sure if this is a configuration issue on Apache or PHP.
 phpinfo seems to work fine and I don't encounter issues accessing pure
 HTML pages directly. Just the PHP ones?

 Any ideas folks?

 - Tom




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


Re: [PHP] Stupid question perhaps?

2003-03-27 Thread Evan Nemerson
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

register globals is of in newer versions of php. you can re-enable it in the 
php.ini.. See 
http://www.php.net/manual/en/configuration.directives.php#ini.register-globals


On Thursday 27 March 2003 10:57 am, Tom Tsongas wrote:
 I just recently upgraded to PHP 4.3.1 and Apache 2.0.44. I had been
 previously running PHP 4.0.4 and Apache 1.3.20. I had a fully enabled
 PHP website that I had been developing on for some time.
 After I upgraded, the entire website is virtually non-functional. I keep
 receiving 'Page cannot Display' or 'Document contains no data' errors.

 I am not sure if this is a configuration issue on Apache or PHP. phpinfo
 seems to work fine and I don't encounter issues accessing pure HTML
 pages directly. Just the PHP ones?

 Any ideas folks?

 - Tom

- -- 
Businesses may come and go, but religion will last forever, for in no other 
endeavor does the consumer blame himself for product failure.

- -Harvard Lamphoon
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE+g0xM/rncFku1MdIRArx/AJ9HYhHbEQRTWwz3+qqFibKKubOmZACgp9yh
KqCV12CJR4Td92mAITOn6vw=
=F145
-END PGP SIGNATURE-


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



Re: [PHP] Stupid question perhaps?

2003-03-27 Thread Tom Tsongas
Thx for the feedback everyone.

Based on what most have told me, I think I will defer to an older Apache 
version (1.3.x) and use that with the latest PHP. Not enough time to 
experiment with getting newer Apache to work with newest PHP.

- Tom

Evan Nemerson wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
register globals is of in newer versions of php. you can re-enable it in the 
php.ini.. See 
http://www.php.net/manual/en/configuration.directives.php#ini.register-globals

On Thursday 27 March 2003 10:57 am, Tom Tsongas wrote:
 

I just recently upgraded to PHP 4.3.1 and Apache 2.0.44. I had been
previously running PHP 4.0.4 and Apache 1.3.20. I had a fully enabled
PHP website that I had been developing on for some time.
After I upgraded, the entire website is virtually non-functional. I keep
receiving 'Page cannot Display' or 'Document contains no data' errors.
I am not sure if this is a configuration issue on Apache or PHP. phpinfo
seems to work fine and I don't encounter issues accessing pure HTML
pages directly. Just the PHP ones?
Any ideas folks?

- Tom
   

- -- 
Businesses may come and go, but religion will last forever, for in no other 
endeavor does the consumer blame himself for product failure.

- -Harvard Lamphoon
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.7 (GNU/Linux)
iD8DBQE+g0xM/rncFku1MdIRArx/AJ9HYhHbEQRTWwz3+qqFibKKubOmZACgp9yh
KqCV12CJR4Td92mAITOn6vw=
=F145
-END PGP SIGNATURE-
 




RE: [PHP] Stupid question perhaps?

2003-03-27 Thread Bryan Lipscy
Anything in the apache error_log?

-Original Message-
From: Tom Tsongas [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 27, 2003 10:58 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Stupid question perhaps?


I just recently upgraded to PHP 4.3.1 and Apache 2.0.44. I had been 
previously running PHP 4.0.4 and Apache 1.3.20. I had a fully enabled 
PHP website that I had been developing on for some time.
After I upgraded, the entire website is virtually non-functional. I keep

receiving 'Page cannot Display' or 'Document contains no data' errors.

I am not sure if this is a configuration issue on Apache or PHP. phpinfo

seems to work fine and I don't encounter issues accessing pure HTML 
pages directly. Just the PHP ones?

Any ideas folks?

- Tom


-- 
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] Stupid question perhaps?

2003-03-27 Thread Justin French
PHP and Apache 2 don't boogie.

A lot has changed in PHP over those versions... did you read the
relase/upgrade notes across those versions??  I assume quite a lot of your
issues are in relation to the register_globals directive in php.ini, which
now defaults to off, not on.  If you switch it back, and downgrade Apache, I
dounbt you'll have many further problems.

You should compare other settings between your old php.ini and the new one
too, for little things like magic quotes, etc.


Justin


on 28/03/03 5:57 AM, Tom Tsongas ([EMAIL PROTECTED]) wrote:

 I just recently upgraded to PHP 4.3.1 and Apache 2.0.44. I had been
 previously running PHP 4.0.4 and Apache 1.3.20. I had a fully enabled
 PHP website that I had been developing on for some time.
 After I upgraded, the entire website is virtually non-functional. I keep
 receiving 'Page cannot Display' or 'Document contains no data' errors.
 
 I am not sure if this is a configuration issue on Apache or PHP. phpinfo
 seems to work fine and I don't encounter issues accessing pure HTML
 pages directly. Just the PHP ones?
 
 Any ideas folks?
 
 - Tom
 


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



Re: [PHP] Stupid Question

2003-03-07 Thread Liam Gibbs
 How do you make a command not return a warning... I thought it was the
 @ sign, but i think i'm wrong, and everything i've tried hasn't worked,
 i want this for a switch command if that matters.

It's the @ sign. Put it right before the command, as in @fopen(). Show us
the line that is giving you the error message.


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



Re: [PHP] Stupid question, sorry...

2003-02-06 Thread Jason Sheets
Because PHP performs evaluation on the contents of double quotes and
does not evaluate the contents of single quotes.  This is covered in the
PHP manual in the Variables section at
http://www.php.net/manual/en/language.variables.php.

Jason

On Thu, 2003-02-06 at 08:27, Chris Boget wrote:
 Why is it that \n gets translated to a _new line_ when in
 double quotes whereas it's displayed as the literal when
 in single quotes?  I checked out the docs but couldn't 
 come up with a definitive answer.  If someone could point
 me to the right page in the docs that explains this, I'd be
 ever so appreciative!
 
 thnx,
 Chris
 
 
 -- 
 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] stupid question (Back Function)

2003-01-13 Thread Sean Malloy
You could grab the referring page and send the user back to it, but some
proxies/software stop your browser from sending that information, so it
might not work in all situations

a href=?php echo $_SERVER['HTTP_REFERER']; ?Back/a

however, quoting the docs on using the referrer:

This is set by the user agent (client browser). Not all user agents will set
this, and some provide the ability to modify HTTP_REFERER as a feature. In
short, it cannot really be trusted.

-Original Message-
From: Remon Redika [mailto:[EMAIL PROTECTED]]
Sent: Monday, 13 January 2003 8:33 PM
To: [EMAIL PROTECTED]
Subject: [PHP] stupid question (Back Function)


hi everyone,

It's Possible We used Php Scripting to Back the client Browser
Like This Below :
(ussualy I make it with java script) :

javascript:history.back(1)

but right now, i need using the 'header's function', functionaly to back
the page to previouse page.

sorry before :)


--
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] stupid question (Back Function)

2003-01-13 Thread David T-G
Remon, et al --

...and then Remon Redika said...
% 
% hi everyone, 

Hi!


% 
% It's Possible We used Php Scripting to Back the client Browser

Well, yes and no.  There was just a new 'crumb' class released (see 

  http://www.phpclasses.org/browse.html/package/934.html

for more) which will let you track where you've been.  You can then put
up a 'back' link to your last page for the user, or otherwise direct it;
although the user's browser history will actually only be going forward,
you'll get the forward and back that you need.


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg92769/pgp0.pgp
Description: PGP signature


Re: [PHP] stupid question

2002-08-15 Thread Michael Sims

Liam MacKenzie wrote:

Ok, I'm having a blonde day...

If $idx == 1, 4 or 9 I don't want it to echo $results.
I have this, what's the syntax to put multiple values in there?


if ($idx != 1) {
echo$results;
}

Another way to do it is by using in_array(), like so:

if (!in_array($idx,array(1,4,9))) {
  echo $results;
}

I don't know if that is more or less efficient to the parser, but it
looks cleaner IMHO...

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




RE: [PHP] stupid question

2002-08-14 Thread César Aracena

Just usa an OR concatenator like:

If ($idx != '1' OR $idx != '4' OR $idx != '9'){
echo $results;
}

Remember that if you are echoing just $result, it should not be enclosed
into double quotes... just a tip.

 -Original Message-
 From: Liam MacKenzie [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, August 15, 2002 12:42 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] stupid question
 
 Ok, I'm having a blonde day...
 
 If $idx == 1, 4 or 9 I don't want it to echo $results.
 I have this, what's the syntax to put multiple values in there?
 
 
 if ($idx != 1) {
 echo$results;
 }
 
 
 Thanks,
 Liam
 
 
 
 
 --
 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] stupid question

2002-08-14 Thread Adam Williams

if ( ($idx != 1) || ($idx != 4) || ($idx != 9) )
{
echo $results;
}

Adam

On Thu, 15 Aug 2002, Liam MacKenzie wrote:

 Ok, I'm having a blonde day...

 If $idx == 1, 4 or 9 I don't want it to echo $results.
 I have this, what's the syntax to put multiple values in there?


 if ($idx != 1) {
 echo$results;
 }


 Thanks,
 Liam







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




Re: [PHP] stupid question

2002-08-14 Thread Chris Shiflett

There are other ways of doing this, but I think you might be looking for 
the logical AND operator ().

if ($idx != 1  $idx != 4  $idx != 9)

Happy hacking.

Chris

Liam MacKenzie wrote:

Ok, I'm having a blonde day...

If $idx == 1, 4 or 9 I don't want it to echo $results.
I have this, what's the syntax to put multiple values in there?


if ($idx != 1) {
echo$results;
}



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




Re: [PHP] stupid question

2002-08-14 Thread Chris Shiflett

César Aracena wrote:

Just usa an OR concatenator like:

If ($idx != '1' OR $idx != '4' OR $idx != '9'){
echo $results;
}


Actually, this statement will always evaluate to true. I think you mean 
to use .

Chris


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




RE: [PHP] stupid question

2002-08-14 Thread César Aracena

You got a point there... unless you change the operator from != to ==
right? Missed that.

 -Original Message-
 From: Chris Shiflett [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, August 15, 2002 1:00 AM
 To: César Aracena
 Cc: 'Liam MacKenzie'; [EMAIL PROTECTED]
 Subject: Re: [PHP] stupid question
 
 César Aracena wrote:
 
 Just usa an OR concatenator like:
 
 If ($idx != '1' OR $idx != '4' OR $idx != '9'){
 echo $results;
 }
 
 
 Actually, this statement will always evaluate to true. I think you
mean
 to use .
 
 Chris
 
 
 --
 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] Stupid question

2002-05-02 Thread Craig Vincent


 I have a script that outputs this:
 0.023884057998657

 What's the command to make it shrink down to this:
 0.023


 I thought it was eregi() something, but I forgot.  sorry

It depends on what you need.

If you want to round the number off to 3 decimal points use the round()
function.  However if you don't want to round and instead just want to
truncate the number, the number_format() function would be what you need.

Sincerely,

Craig Vincent



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




RE: [PHP] Stupid question

2002-05-02 Thread Dan Hardiker

 I have a script that outputs this:
 0.023884057998657

 What's the command to make it shrink down to this:
 0.023

 I thought it was eregi() something, but I forgot.  sorry

 It depends on what you need.

 If you want to round the number off to 3 decimal points use the round()
 function.  However if you don't want to round and instead just want to
 truncate the number, the number_format() function would be what you
 need.

 Sincerely,

 Craig Vincent


If speed is an issue, instead of using number_format for truncation use
substr. i.e: echo substr($var, 0, 5); to get 3 dp.

-- 
Dan Hardiker [[EMAIL PROTECTED]]
ADAM Software  Systems Engineer
First Creative Ltd



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




RE: [PHP] Stupid question

2002-05-02 Thread Robert V. Zwink

When I run:

$number = 0.023884057998657;
echo round($number, 3);
echo number_format($number, 3);

Both function output 0.024, both functions round the last digit.  This is
contrary to the example in the manual which shows this:

$number = 1234.5678;

// english notation without thousands seperator
$english_format_number = number_format($number, 2, '.', '');
// 1234.56

http://www.php.net/manual/en/function.number-format.php

My output for the above is:
1234.57 not 1234.56

I'm using PHP Version 4.0.6

I would consider using the following to truncate a number if you do not want
to round.  There may be a better way, but this seems to work fine.

substr($number, 0,strpos($number, .)+4);


Robert V. Zwink
http://www.zwink.net


-Original Message-
From: Craig Vincent [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 02, 2002 5:54 AM
To: Liam MacKenzie; [EMAIL PROTECTED]
Subject: RE: [PHP] Stupid question



 I have a script that outputs this:
 0.023884057998657

 What's the command to make it shrink down to this:
 0.023


 I thought it was eregi() something, but I forgot.  sorry

It depends on what you need.

If you want to round the number off to 3 decimal points use the round()
function.  However if you don't want to round and instead just want to
truncate the number, the number_format() function would be what you need.

Sincerely,

Craig Vincent



--
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] Stupid question

2002-05-02 Thread Pushkar Pradhan

Since round() is a maths routine, it will return the most approx. value of
your 0.02388.. in 3 decimal digits.
If you just want to return the first 3 digits after the decimal use the
string routines suggested by Rober Zwink or :
$number = $number*1000;   // 23.884
$number = floor($number); // 23
You can also see http://www.php.net/manual/en/function.floor.php and
http://www.php.net/manual/en/function.ceil.php for what they do.

for a more general routine which will return any no of digits after
decimal:
$multiplier = pow(10, $noOfDigitsAfterDecimal); // 10^3
$number = $number*$multiplier;
$number = floor($number);


 When I run:

 $number = 0.023884057998657;
 echo round($number, 3);
 echo number_format($number, 3);

 Both function output 0.024, both functions round the last digit.  This is
 contrary to the example in the manual which shows this:

 $number = 1234.5678;

 // english notation without thousands seperator
 $english_format_number = number_format($number, 2, '.', '');
 // 1234.56

 http://www.php.net/manual/en/function.number-format.php

 My output for the above is:
 1234.57 not 1234.56

 I'm using PHP Version 4.0.6

 I would consider using the following to truncate a number if you do not want
 to round.  There may be a better way, but this seems to work fine.

 substr($number, 0,strpos($number, .)+4);


 Robert V. Zwink
 http://www.zwink.net


 -Original Message-
 From: Craig Vincent [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, May 02, 2002 5:54 AM
 To: Liam MacKenzie; [EMAIL PROTECTED]
 Subject: RE: [PHP] Stupid question



  I have a script that outputs this:
  0.023884057998657
 
  What's the command to make it shrink down to this:
  0.023
 
 
  I thought it was eregi() something, but I forgot.  sorry

 It depends on what you need.

 If you want to round the number off to 3 decimal points use the round()
 function.  However if you don't want to round and instead just want to
 truncate the number, the number_format() function would be what you need.

 Sincerely,

 Craig Vincent



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


-Pushkar S. Pradhan


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




Re: [PHP] Stupid Question

2002-02-28 Thread Greg Donald

 Yes, this is probably in the manual, but I can't find it.

 If I want to upgrade from 4.0.6 to 4.1.2, do I have to re-compile apache
as
 well?

No.  I just upgraded 3 machines this morning, and left Apache the same on
all of them.


Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/



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




RE: [PHP] Stupid Question

2002-02-28 Thread Jackson Miller

I thought that you do have to recompile if you are running PHP as a module,
but not if you are running PHP as CGI.  I could be wrong.

-Jackson

-Original Message-
From: Greg Donald [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 28, 2002 12:28 PM
To: PHP List; php
Subject: Re: [PHP] Stupid Question


 Yes, this is probably in the manual, but I can't find it.

 If I want to upgrade from 4.0.6 to 4.1.2, do I have to re-compile apache
as
 well?

No.  I just upgraded 3 machines this morning, and left Apache the same on
all of them.


Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/



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


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




RE: [PHP] Stupid Question

2002-02-28 Thread DARCY,MATTHEW (Non-HP-UnitedKingdom,ex2)

if PHP is NOT a module axps and is build into apache then I was under the
impression you had to recompile apache as PHP was built into apache.


-Original Message-
From: Jackson Miller [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 28, 2002 5:46 PM
To: Greg Donald; PHP List; php
Subject: RE: [PHP] Stupid Question


I thought that you do have to recompile if you are running PHP as a module,
but not if you are running PHP as CGI.  I could be wrong.

-Jackson

-Original Message-
From: Greg Donald [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 28, 2002 12:28 PM
To: PHP List; php
Subject: Re: [PHP] Stupid Question


 Yes, this is probably in the manual, but I can't find it.

 If I want to upgrade from 4.0.6 to 4.1.2, do I have to re-compile apache
as
 well?

No.  I just upgraded 3 machines this morning, and left Apache the same on
all of them.


Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/



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


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

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




Re: [PHP] Stupid Question

2002-02-28 Thread Greg Donald

 I thought that you do have to recompile if you are running PHP as a
module,
 but not if you are running PHP as CGI.  I could be wrong.

No, you do not have to recompile apache.  I did this on all three of my
machines:

./configure --with-apxs=/usr/sbin/apxs --with-mysql
make
make install
/usr/sbin/apachectl stop
/usr/sbin/apachectl start



Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/



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




RE: [PHP] Stupid Question

2002-02-28 Thread DARCY,MATTHEW (Non-HP-UnitedKingdom,ex2)

so you are running with apxs and do not need to re-compile as I said.

If you are running with PHP as an apxs then fine, if you have built PHP into
apache then you should need to re-compile.

Matt.


-Original Message-
From: Greg Donald [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 28, 2002 5:44 PM
To: Jackson Miller; PHP List; php
Subject: Re: [PHP] Stupid Question


 I thought that you do have to recompile if you are running PHP as a
module,
 but not if you are running PHP as CGI.  I could be wrong.

No, you do not have to recompile apache.  I did this on all three of my
machines:

./configure --with-apxs=/usr/sbin/apxs --with-mysql
make
make install
/usr/sbin/apachectl stop
/usr/sbin/apachectl start



Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/



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

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




Re: [PHP] Stupid Question

2002-02-28 Thread PHP List

RE: [PHP] Stupid QuestionThanks for all the responses.

Just to be clear, I have php installed as a module, so I have to re-compile apache.



  - Original Message - 
  From: Adam Plocher 
  To: 'PHP List' 
  Sent: Thursday, February 28, 2002 9:46 AM
  Subject: RE: [PHP] Stupid Question


  It depends on how you have php setup to begin with.  If you have it setup to be used 
as a loadable module, then you can just recompile the php module and re-insert it (I 
don't remember how exactly).  If you don't know how it's setup, I'm guessing it's not 
a loadable module and you will need to recompile apache.

  FYI. http://www.php.net/manual/en/installation.php -- installation instructions. 

  -Original Message- 
  From: PHP List [mailto:[EMAIL PROTECTED]] 
  Sent: Thursday, February 28, 2002 9:27 AM 
  To: php 
  Subject: [PHP] Stupid Question 



  Yes, this is probably in the manual, but I can't find it. 

  If I want to upgrade from 4.0.6 to 4.1.2, do I have to re-compile apache as well? 

  Thanks 

  Chris 



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



Re: [PHP] Stupid question alert

2002-01-04 Thread Bogdan Stancescu

Your question is not stupid - it's just uninformed, and that's easily
understandable if you never used PHP.

The concept is dynamically creating the page SERVER-SIDE. That is, use some
databases or some nifty code to dynamically build a page using specific
parameters. Unforunately for you, this means that all the fun ends on the server
side. Once PHP ends its job, Apache takes over and serves the content generated
by PHP as it would serve any regular file. What you actually pass to the client
is dead information - it's not dynamic unless you echo some JavaScript code or
something similar from PHP (which is the same as writing the respective code in
a regular file, unless you create some custom parameters in JavaScript based on
some other parameters you pass to PHP).

Hope my explanation makes sense... ;-)

Bogdan

tim at 10Kv wrote:

 Hi,

 first of all apologise to the list ­ this is a very basic question for you
 I¹m sure. I have tried to find an answer on the web but the problem is
 knowing HOW to ask the question ­ and I hoping you can provide me with a
 starting point.

 Anyway.. I design a lot of graphic intensive pages which rely heavily on
 layers that contain images, mouseovers and image swaps. The trouble is, when
 there are more than a couple of these layers on a page the code gets long
 and over complicated.  For example, if I have a page which on one side
 contains an image map with 5 clickable points that shows one of 5 possible
 layers on the other side of the page  (each with different content)  this is
 automatically a page with lots of code which is slow to load ­ especially if
 the page already has a layer based navigation bar!

 My question is: is there a way to use a language like php to make this
 process easier? For example populate the layers from a different file rather
 than have all the code on the same page and perhaps slim the page down a
 little ­ or is this missing the point of what a language like php is about.

 Thanks for your help and my apologies if this is the worst question of the
 week.

 Tim Rogers


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]