[PHP] Help With PEAR::DB Connection

2004-09-10 Thread php-list
Hello everyone,

I have a problem connecting to the Database. When I execute the code at the
bottom, it gives me this message: "DB Error: extension not found". It sees
the DB file and the parameters are correct. I checked the include path and
it was correct. Did I do something wrong? Any help would be greatly
appreciated. Thank you.


require_once 'DB.php';
$user = 'foo';
$pass = 'bar';
$host = 'localhost';
$db_name = 'clients_db';
$dsn = "mysql://$user:[EMAIL PROTECTED]/$db_name";
$db = DB::connect($dsn);
if (DB::isError($db)) {
die ($db->getMessage());
}



-- Nilaab

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



Re: [PHP] Perplexing problem, suggestions or answer needed

2004-09-10 Thread John Holmes
Mag wrote:
Hi,
I will be getting input from a textarea and then I am
using "explode" to break the text into an array when
it encounters a space.
eg:
one two three four ninty
would be broken into 5 parts of an array.
** The array would then be put into a session ** 
now I need to display the last part (which would be
"ninty" using the above example) then take out the
last part from the array then echo the next last part
(which would be "four") then take out the last part
(using unset? ) etc etc so I have something like:

Displaying Array : 
ninty
(deleteing ninty)
four
(deleteing four)
three
(deleteing three)
etc

I have been reading the manual and have come this far,
then I think I have to use the array splice function..
Am totally confused, any help, links, tutorials,
pointers, tips or code would be appreciated.
Why not just use array_reverse() and then print them out in order using 
foreach?

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Totaling sales by month

2004-09-10 Thread John Holmes
Andrew Kreps wrote:
>> I have a MySQL db with a datetime field containing the
>> date and time of the sale. I want to query for a simple
>> report that shows total sales by month.
>
This one worked for me, on MySQL 3.23.xx.  I hope it's closer to what you need.
select sum(ordersubtotal), date_format(orderdate, '%Y-%m') as odate
from orders group by odate
Also,
SELECT SUM(ordersubtotal), YEAR(orderdate), MONTH(orderdate) FROM orders 
GROUP BY YEAR(orderdate), MONTH(orderdate)

If you wanted the date parts in separate columns or wanted to limit to 
specific months. If you ever want to group by week, YEARWEEK() will come 
in handy, btw.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] create and read array

2004-09-10 Thread John Holmes
John Taylor-Johnston wrote:
Can someone help me, show me how to do this please?
1. How do I write $mydata->AUS and $mydata->id into an array?
$authors = array();
while ($mydata = mysql_fetch_object($news))
{
# echo "$mydata->AUS, $mydata->id\n";
??? write to array
}
mysql_close($myconnection);
What do you mean "write to array"??
$array = array($mydata->AUS,$mydata->id);
That?
2. Then I need to create $SQL
foreach ($authors as something)
{
$sql += "INSERT INTO newtable VALUES ($AUS, $id);\r\n";
}
+= is addition. I doubt that's what you want.
$sql .= "INSERT INTO newtable VALUES ({$mydata->AUS},{$mydata->id});\r\n";
Not sure why you're joining all these queries together, you can only run 
one at a time with MySQL...

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] create and read array

2004-09-10 Thread John Taylor-Johnston
Can someone help me, show me how to do this please?

1. How do I write $mydata->AUS and $mydata->id into an array?

$authors = array();
while ($mydata = mysql_fetch_object($news))
{
# echo "$mydata->AUS, $mydata->id\n";
??? write to array
}
mysql_close($myconnection);

2. Then I need to create $SQL

foreach ($authors as something)
{
$sql += "INSERT INTO newtable VALUES ($AUS, $id);\r\n";
}

I am reading http://ca3.php.net/manual/en/language.types.array.php but don't really 
get it.

Can I do $sql += "blah"; or do I have to write $sql = $sql + "blah";?

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



RE: [PHP] PHP5 OOP

2004-09-10 Thread Ed Lazor
Thanks everyone for the recommendations =)

> -Original Message-
> On Fri, 10 Sep 2004 15:09:57 -0700, Ed Lazor <[EMAIL PROTECTED]> wrote:
> >Any recommendations on the best PHP5 OOP book to get?  I have Advanced
> PHP
> >Programming by George Schlossnagle.  It's turning out to be a great book,
> >but I'd like to read more on PHP5 OOP.  The first chapter recommends two
> >books, but both deal with OOP from the perspective of C++, C#, and Perl.
> 
> The language doesn't matter. If you're learning OOP, you need to learn
> the concepts first, which can then be applied to any language.
> 
> I have the following book which I'd highly recommend:
> http://www.amazon.com/exec/obidos/tg/detail/-/0672318539/103-7282797-
> 1853467?v=glance

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



[PHP] Re: how to load extensions outside the extension_dir

2004-09-10 Thread Aidan Lister
You can't,

It's a security thing.


"Marten Lehmann" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hello,
>
> I need to load extensions with dl() within PHP running as CGI. But as this 
> is a shared hosting environment, I don't have access to the extension_dir. 
> Anyway, dl() prepends /lib/php/extensions/ 
> --ZEND_MODULE_API_NO if I'm calling 
> dl("myext.so"); even if I'm starting with a slash. How can I disable this?
>
> Regards
> Marten 

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



[PHP] [Newbie Guide] For the benefit of new members

2004-09-10 Thread Ma SivaKumar
===
Please feel free to add more points and send 
to the list. 
===

1. If you have any queries/problems about PHP 
try http://www.php.net/manual/en first. You 
can download a copy and use it offline also. 

Please also try 
http://www.php.net/manual/faq.php 
for answers to frequently answered questions 
about PHP (added by Christophe Chisogne).

2. Try http://www.google.com next. Searching 
for "php YOUR QUERY" may fetch you relevant 
information within the first 10 results.

3. There is a searchable archive of the 
mailing list discussion at 
http://phparch.com/mailinglists. Many of the 
common topics are discussed repeatedly, and 
you may get answer to your query from the 
earlier discussions. 

For example: One of the repeatedly discussed 
question in the list is "Best PHP editor". 
Everyone has his/her favourite editor. 
You can get all the opinions by going through 
the list archives. If you want a chosen list 
try this link : 
http://www.thelinuxconsultancy.co.uk/phpeditors/
(contributed by Christophe Chisogne).

4. Not sure if PHP is working or you want 
find out what extensions are available to 
you?

Just put the following code into a file with 
a .php extension and access it through your 
webserver:

 

If PHP is installed you will see a page with 
a lot of information on it. If PHP is not 
installed (or not working correctly) your 
browser will try to download the file.

(contributed by Teren and reworded by Chris W 
Parker)

5. If you are stuck with a script and do not 
understand what is wrong, instead of posting 
the whole script, try doing some research 
yourself. One useful trick is to print 
the variable/sql query using print or echo 
command and check whether you get what you 
expected. 

After diagnosing the problem, send the 
details of your efforts (following steps 1, 
2 & 3) and ask for help.

6. PHP is a server side scripting language. 
Whatever processing PHP does takes place 
BEFORE the output reaches the client. 
Therefore, it is not possible to access 
users' computer related information (OS, 
screen size etc) using PHP. Nor can you 
modify any the user side settings. You need 
to go for JavaScript and ask the question in 
a JavaScript list.

On the other hand, you can access the 
information that is SENT by the user's 
browser when a client requests a page from 
your server. You can find details about 
browser, OS etc as reported by 
this request. - contributed by Wouter van 
Vliet and reworded by Chris W Parker.

7. Provide a clear descriptive subject line. 
Avoid general subjects like "Help!!", "A 
Question" etc. Especially avoid blank 
subjects. 

8. When you want to start a new topic, open a 
new mail composer and enter the mailing list 
address [EMAIL PROTECTED] instead of 
replying to an existing thread and replacing 
the subject and body with your message.

9. Only quote the relevant parts of
an email when replying. Do not Quote
everything (including huge code snippets) 
only to say "I agree", for instance.
[contribued by Paul Waring]

10. It's always a good idea to post back to 
the list once you've solved your problem. 
People usually add [SOLVED] to the subject 
line of their email when posting solutions. 
By posting your solution you're helping the 
next person with the same question. 
[contribued by Chris W Parker]

11. Ask smart questions 
http://catb.org/~esr/faqs/smart-questions.html
[contributed by Jay Blanchard)

12. Do not send your email to the list with 
attachments. If you don't have a place to 
upload your code, try the many pastebin 
websites (such as www.pastebin.com).
[contributed by Burhan Khalid]

Following these guidelines will ensure that 
you get effective responses from the list
members. Otherwise, your questions might not 
be answered.

Hope you have a good time programming with 
PHP.
-- 
Integrated Management Tools for leather 
industry
--
http://www.leatherlink.net

Ma SivaKumar,
BSG LeatherLink (P) Ltd,
Chennai - 600106

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



Re: [PHP] PHP5 OOP

2004-09-10 Thread John Holmes
On Fri, 10 Sep 2004 15:09:57 -0700, Ed Lazor <[EMAIL PROTECTED]> wrote:
Any recommendations on the best PHP5 OOP book to get?  I have Advanced PHP
Programming by George Schlossnagle.  It's turning out to be a great book,
but I'd like to read more on PHP5 OOP.  The first chapter recommends two
books, but both deal with OOP from the perspective of C++, C#, and Perl.
The language doesn't matter. If you're learning OOP, you need to learn 
the concepts first, which can then be applied to any language.

I have the following book which I'd highly recommend:
http://www.amazon.com/exec/obidos/tg/detail/-/0672318539/103-7282797-1853467?v=glance
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP5 OOP

2004-09-10 Thread Greg Beaver
Greg Donald wrote:
On Fri, 10 Sep 2004 15:09:57 -0700, Ed Lazor <[EMAIL PROTECTED]> wrote:
Any recommendations on the best PHP5 OOP book to get?  I have Advanced PHP
Programming by George Schlossnagle.  It's turning out to be a great book,
but I'd like to read more on PHP5 OOP.  The first chapter recommends two
books, but both deal with OOP from the perspective of C++, C#, and Perl.

Do not bother to get "PHP5 and MySQL Bible" unless you're a complete
PHP beginner.  The one OO chapter is not much more than is in the PHP
manual.  I got it and wish I hadn't.  Overall it's long-winded and the
humor is dry.  Tons of useless chatter in between the information you
really want.
Honestly, if you want to learn OOP in php5, the best way to do it is to 
get an IDE that contains a PHP 5 step-through debugger such as Zend IDE 
and try out the stuff you see in the link from the php.net home page 
regarding Zend Engine 2.  It is very similar to java/c# and perl in 
terms of the similarity to those features (exceptions, try/catch, PPP 
are all from those languages).  The big changes are the new xml 
extensions and their derivatives like simplexml, dom, soap.  Learning 
the DOM extension and simplexml is very difficult to do without some 
kind of prior knowledge of DOM, but you'll learn more from sites like 
w3cschools.com than you will from a book.  In addition, ReflectionClass 
is your friend, as in:

getMethods());
// or even
$a = new ReflectionClass('ReflectionClass');
var_dump($a->getMethods());
?>
I would recommend starting with the big red "Beginning PHP4" and then 
simply using trial and error to learn the differences with PHP5, it's 
not all that different from php4 in the basics, it is a question of how 
you use it.

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


Re: [PHP] Totaling sales by month

2004-09-10 Thread Brian Dunning
Amazing - that did it, first try! THANKS. I knew it had to be simple. 
SQL rocks.

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


[PHP] GD Library list

2004-09-10 Thread bskolb
Does anyone know if there is a mailing list for gdlib?  Can't seem to find
in Google.


Re: [PHP] Totaling sales by month

2004-09-10 Thread Andrew Kreps
This one worked for me, on MySQL 3.23.xx.  I hope it's closer to what you need.

select sum(ordersubtotal), date_format(orderdate, '%Y-%m') as odate
from orders group by odate

On Fri, 10 Sep 2004 15:01:34 -0700, Brian Dunning
<[EMAIL PROTECTED]> wrote:
> I have a MySQL db with a datetime field containing the date and time of
> the sale. I want to query for a simple report that shows total sales by
> month.
> 
> I thought this would be quick & easy but it's NOT! I can't figure out
> how to query for it.
> 
> If this question would be better posed to a SQL list, I'd appreciate a
> recommendation to a good one. I couldn't find one via STFW that had any
> kind of volume.
> 
> - Brian
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

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



[PHP] Re: problems setting up php5 on apache2 (WinXP Pro)

2004-09-10 Thread Richard Harb
I have no experience with PHP5 so far but this subject was asked
before often enough with PHP4 - so the advice should still be valid...

I generally didn't put any files in the %SYSTEMROOT% folder (which
usually translates to C:\WINDOWS on a default installed WinXP machine)
but instead I put the php.ini and php4ts.dll into the apache
respectively apache2/bin folder and modified the php.ini to point to
the dlls. works like a charm for me.

With all the stuff related to the local webserver put into
'c:\webroot' those entries in php.ini are:

include_path = ".;c:\webroot\php4\dlls\;c:\webroot\php4\pear"
extension_dir = "c:\webroot\php4\extensions"

... you get the idea.

HTH
Richard



On Fri, 10 Sep 2004 09:31:43 -0400, [EMAIL PROTECTED] (Mathieu
Dumoulin) wrote:

>(Don't write to me telling me to use linux, i dont want to, this is my home
>machine not a production server, thank you, now if you really want to help
>keep on reading)
>
>I got a most recent copy of PHP 5.01 extracted into "C:\php" and everything
>seems to be working fine as long as i dont ask to load extensions. Any
>extension that i try to add will fail to load and i'm clueless.
>
>At first in the PHP.ini file this was the original directive:
>
>; Directory in which the loadable extensions (modules) reside.
>extension_dir = "./"
>
>And it would not work so i changed it to a hardcoded path
>
>; Directory in which the loadable extensions (modules) reside.
>extension_dir = "C:\php\ext"
>
>Still no extensions wont load. Whats the weirdest, all the DLLs are at the
>correct location, apache reports: "PHP startup: Unable to load dynamic
>library 'C:\php\ext\php_mysql.dll' - The specified module could not be
>found."
>
>but it IS there, at the exact location, i even looked and compared both
>paths manually letter by letter. Another weird thing to note is that some
>extensions DO load while some don't, here is a list of the extensions that
>i'm loading and which one fails (Note ALL extensions DLL are indeed in the
>folder intended, they just dont load)
>
>extension=php_bz2.dll
>extension=php_gd2.dll
>extension=php_imap.dll
>extension=php_mysql.dll <<< fails but it's vital to me
>
>these extensions are activated, only mysql fails, but there are other i
>wanted earlier lemme see which ones: (These would be nice to have, i'll tell
>you which one fails too)
>
>;extension=php_exif.dll <<< fails
>;extension=php_ldap.dll <<< fails (The file really isnt there so it's not a
>real problem)
>;extension=php_openssl.dll <<< fails
>;extension=php_pdf.dll
>;extension=php_pgsql.dll
>;extension=php_snmp.dll
>;extension=php_sockets.dll
>;extension=php_tidy.dll
>;extension=php_zip.dll
>
>All of these will load... S I'm stuck there, i need help, tell me if you
>need to know anything else. i'll be glad to give you info, i want to set
>this up to further my PHP developement at home. We intensively use PHP4 at
>work but i wanted to start working on PHP5 to see how good it is.
>
>Till then
>See ya'll
>TheInsaneCoder

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



Re: [PHP] PHP5 OOP

2004-09-10 Thread Greg Donald
On Fri, 10 Sep 2004 15:09:57 -0700, Ed Lazor <[EMAIL PROTECTED]> wrote:
> Any recommendations on the best PHP5 OOP book to get?  I have Advanced PHP
> Programming by George Schlossnagle.  It's turning out to be a great book,
> but I'd like to read more on PHP5 OOP.  The first chapter recommends two
> books, but both deal with OOP from the perspective of C++, C#, and Perl.

Do not bother to get "PHP5 and MySQL Bible" unless you're a complete
PHP beginner.  The one OO chapter is not much more than is in the PHP
manual.  I got it and wish I hadn't.  Overall it's long-winded and the
humor is dry.  Tons of useless chatter in between the information you
really want.


-- 
Greg Donald
http://destiney.com/

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



[PHP] Perplexing problem, suggestions or answer needed

2004-09-10 Thread Mag
Hi,
I will be getting input from a textarea and then I am
using "explode" to break the text into an array when
it encounters a space.

eg:
one two three four ninty
would be broken into 5 parts of an array.

** The array would then be put into a session ** 
now I need to display the last part (which would be
"ninty" using the above example) then take out the
last part from the array then echo the next last part
(which would be "four") then take out the last part
(using unset? ) etc etc so I have something like:

Displaying Array : 
ninty
(deleteing ninty)
four
(deleteing four)
three
(deleteing three)
etc

I have been reading the manual and have come this far,
then I think I have to use the array splice function..
Am totally confused, any help, links, tutorials,
pointers, tips or code would be appreciated.

Thanks,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)



___
Do you Yahoo!?
Shop for Back-to-School deals on Yahoo! Shopping.
http://shopping.yahoo.com/backtoschool

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



Re: [PHP] Totaling sales by month

2004-09-10 Thread Brian Dunning
Thanks Pablo - but it's more complicated than that. I'm trying to 
return totals for all calendar months, not all records within the past 
month. I'll word my question better and post it to one of your 
suggested lists.  :)

On Sep 10, 2004, at 4:27 PM, Pablo Gosse wrote:
Brian Dunning wrote:
I have a MySQL db with a datetime field containing the date and time
of the sale. I want to query for a simple report that shows total
sales by month.
I thought this would be quick & easy but it's NOT! I can't figure out
how to query for it.
If this question would be better posed to a SQL list, I'd appreciate a
recommendation to a good one. I couldn't find one via STFW that had
any kind of volume.
- Brian
Haven't used MySQL in about four or five years (use PostgreSQL instead)
but it will be something like this:
select * from tablename where datetime_field <= (now() - interval('1
month'));
The difference for you would be in the now() function (whatever mysql
function returns the current system time is what you need) and the
interval function.  This just takes the present time and applys the
specified interval.
Check out http://forums.devshed.com and http://www.tek-tips.com.
They have a lot of forums that are pretty heavily visited.
HTH.
Pablo

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


Re: [PHP] Parsing HTML files

2004-09-10 Thread Peter Brodersen
On Fri, 10 Sep 2004 11:58:58 +0100, in php.general
[EMAIL PROTECTED] (Abdul-Wahid Paterson) wrote:

>> I was wondering if any classes/functions could help me with this little
>> challenge, (im hopeless at regex ;-)
>> 
>> 
>
>No easy way of doing it, regex somthing like:
>
>$id = preg_replace("/.*/", $1, $string);

How about just using an xml-based function? Much cleaner, doesn't
require name-attribute to be present before value-attribute.

';
$x = xml_parser_create();
xml_parse_into_struct($x,$string,$array);
print $array[0]['attributes']['VALUE'];
// or, out of curiousity:
var_dump($array); 
?>

(and why preg_replace? $1 wouldn't even be set since no capturing
parenthesises are used)

-- 
- Peter Brodersen

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



[PHP] creating multiple sessions

2004-09-10 Thread John Gostick
Hi,

I've encountered a situation where I need to have two or more SEPARATE sessions 
running in separate windows. The reasons are complicated, so I'll keep things simple 
by just explaining the problem!

Unfortunately my understanding of sessions is a little sketchy at best so please stick 
with me...

As I understand it, you can start a new session by manually opening another separate 
Internet Explorer window, but I wish the new session to start in a window I've opened 
automatically from a previous page. Unfortunately this appears to carry on the session 
from the source window, which I don't want - I want a new, separate session.

I've considered calling  session_start(); in the new window, then destroying the 
session and calling  session_start(); to start a new, separate session, but surely 
this will destroy the session in the original window, which I want to keep intact!

So put simply, is there anyway to 'force' a new session?

Thanks,

John

[PHP] Re: Can I name a session variable using another variable?

2004-09-10 Thread Greg Beaver
Hi John,
I would recommend making $_SESSION['prevtime'] an array
$roomname = 'sampleroom';
if (!isset($_SESSION['prevtime'])) {
$_SESSION['prevtime'] = array();
}
$_SESSION['prevtime'][$roomname] = time();
Then, you can
if (isset($_SESSION['prevtime'][$roomname])) {
// update the session subvariable, or use it
} else {
// create the session subvariable
}
Regards,
Greg
John Gostick wrote:
Hi,
I've encountered a problem I can't seem to find much reference to on the web, so I 
was wondering if anyone here could help me...
Fisrt a brief background:
I am building a fairly simple PHP/MySQL chat system with multiple rooms. Each room is loaded from the main chat page by clicking on a link that uses JavaScript to open and size a new window, and also passes the roomname as a variable to the new chat window. Messages sent from a room are tagged with the roomname, and the window refreshes periodically to look for new messages(rows) in the database that have that rooms name. In this way a room only recieves messages meant for it. So far so good. However, to determine what messages are new, a SESSION variable $prevtime is set each time the script checks for new messages, so that next time it checks, it will only download messages posted SINCE the time given in $prevtime. This was not a problem with a single room, but when multiple rooms are open they are sharing the same session variable $prevtime because they are all using the same session as they were all opened from the same window. This leads to 'skipping' of messages and 
not all messages being picked up by each room.
I've stratched my head over this, and decided to try and generate a unique SESSION 
variable for each room, named using the string 'prevtime' prefixed with the value of 
the variable $roomname (the name of the current room). However I can't seem to get 
this to work.
To summarise my problem: Can I name/create a session variable like this?:
$roomname="sampleroom";
$_SESSION["$roomname" . "prevtime"]=time();
With the aim of making a session variable named 'sampleroomprevtime'. It is possible 
to use a variable in naming a session this way? I would really appreciate any help 
anyone could give me in making this work, or any suggestions of a better way from 
people with a much better knowledge of sessions than myself!
Thanks in advance,
John
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] PHP5 OOP

2004-09-10 Thread Ed Lazor
Any recommendations on the best PHP5 OOP book to get?  I have Advanced PHP
Programming by George Schlossnagle.  It's turning out to be a great book,
but I'd like to read more on PHP5 OOP.  The first chapter recommends two
books, but both deal with OOP from the perspective of C++, C#, and Perl.

 

Thanks,

 

Ed

 



[PHP] Totaling sales by month

2004-09-10 Thread Brian Dunning
I have a MySQL db with a datetime field containing the date and time of 
the sale. I want to query for a simple report that shows total sales by 
month.

I thought this would be quick & easy but it's NOT! I can't figure out 
how to query for it.

If this question would be better posed to a SQL list, I'd appreciate a 
recommendation to a good one. I couldn't find one via STFW that had any 
kind of volume.

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


[PHP] Can I name a session variable using another variable?

2004-09-10 Thread John Gostick
Hi,

I've encountered a problem I can't seem to find much reference to on the web, so I 
was wondering if anyone here could help me...


Fisrt a brief background:

I am building a fairly simple PHP/MySQL chat system with multiple rooms. Each room is 
loaded from the main chat page by clicking on a link that uses JavaScript to open and 
size a new window, and also passes the roomname as a variable to the new chat window. 
Messages sent from a room are tagged with the roomname, and the window refreshes 
periodically to look for new messages(rows) in the database that have that rooms name. 
In this way a room only recieves messages meant for it. So far so good. However, to 
determine what messages are new, a SESSION variable $prevtime is set each time the 
script checks for new messages, so that next time it checks, it will only download 
messages posted SINCE the time given in $prevtime. This was not a problem with a 
single room, but when multiple rooms are open they are sharing the same session 
variable $prevtime because they are all using the same session as they were all opened 
from the same window. This leads to 'skipping' of messages and not all messages being 
picked up by each room.

I've stratched my head over this, and decided to try and generate a unique SESSION 
variable for each room, named using the string 'prevtime' prefixed with the value of 
the variable $roomname (the name of the current room). However I can't seem to get 
this to work.

To summarise my problem: Can I name/create a session variable like this?:

$roomname="sampleroom";
$_SESSION["$roomname" . "prevtime"]=time();

With the aim of making a session variable named 'sampleroomprevtime'. It is possible 
to use a variable in naming a session this way? I would really appreciate any help 
anyone could give me in making this work, or any suggestions of a better way from 
people with a much better knowledge of sessions than myself!

Thanks in advance,


John

Re: [PHP] php|works in Toronto - anyone going?

2004-09-10 Thread Torsten Roehr
"Chris Shiflett" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> --- Aaron Gould <[EMAIL PROTECTED]> wrote:
> > Just curious if anyone on the list was headed to Toronto on Sep 22-24
> > for php|works.  I live about two hours from Toronto, and my company
> > is sending me.
> >
> > I wonder what kind of reception this conference will get...
>
> I'm giving a talk on PHP session security, so I'll be there.
>
> If anyone from the list is coming, please drop by and say hi.
>
> Chris

I'm only in Toronto from 13th to 16th, unfortunately. So all the best and
good luck to those that are able to attend!

Torsten Roehr

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



Re: [PHP] multi dimension array

2004-09-10 Thread Greg Donald
On Fri, 10 Sep 2004 13:33:37 -0700 (PDT), Dan McCullough
<[EMAIL PROTECTED]> wrote:
> So I have orders and customers.  I need to go through and list out the orders and 
> then I need to
> use the customer to grab all the order associated with them, then list out their 
> contact
> information.  Anythough on how I can group orders by customer, list the customer 
> information (from

I'd use a table join with a group by clause.

> another table) and then go on to the next order and so the same thing all over again?

I'd use a PHP loop construct such as while().

What database are you using?  What do your tables look like?  Where's
the code you've written already if any?


-- 
Greg Donald
http://destiney.com/

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



Re: [PHP] Shared Memories in PHP

2004-09-10 Thread Curt Zirzow
* Thus wrote Chidanand:
> 
> I have a requirement where in i have to access shared
> memory allocated by some C process. Can i do this in
> PHP?
> 
> I am trying out some thing like this. 
> I want to access the existing shared memory.
> 
> $shm_id = ftok("/tmp/", 'm');
> echo "$shm_id". "";
> $shmid = shmop_open($shm_id, "c", 0644, 164);
> $shm_data = shmop_read($shm_id, 0, 50);

you really want $shmid not $shm_id passed to shmop_read, the
$shm_id is basically a filehandle where the $shmid is the resource
to that file.

> 
> Why is the shm_id generated from ftok in C and ftok in
> php different?

For me:

#include 
#include 

int main() {
  int shmkey = 0;

  shmkey = ftok("/tmp/", 'l');
  printf("shmkey %d\n", shmkey);
}

Produces the same key as:
http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Adding +7 more days on date() value problem

2004-09-10 Thread Gryffyn, Trevor
Yes, it does!  That's why I find it so useful. :)

http://www.php.he.net/manual/en/function.mktime.php

Quoted:

mktime() is useful for doing date arithmetic and validation, as it will
automatically calculate the correct value for out-of-range input. For
example, each of the following lines produces the string "Jan-01-1998".
Example 1. mktime() example

  
 
Year may be a two or four digit value, with values between 0-69 mapping
to 2000-2069 and 70-99 to 1970-1999 (on systems where time_t is a 32bit
signed integer, as most common today, the valid range for year is
somewhere between 1901 and 2038). 

Windows: Negative timestamps are not supported under any known version
of Windows. Therefore the range of valid years includes only 1970
through 2038. 



Another tidbit regarding mktime:

The last day of any given month can be expressed as the "0" day of the
next month, not the -1 day. Both of the following examples will produce
the string "The last day in Feb 2000 is: 29". 

Example 2. Last day of next month

  


Kind of goofy, but good stuff.

-TG


> -Original Message-
> From: Vail, Warren [mailto:[EMAIL PROTECTED] 
> Sent: Friday, September 10, 2004 4:47 PM
> To: Gryffyn, Trevor; [EMAIL PROTECTED]
> Cc: Louie Miranda
> Subject: RE: [PHP] Adding +7 more days on date() value problem
> 
> 
> So if this is run on the 30th of the month, you are saying 
> this handles a
> month with day 37 correctly?
> 
> Warren Vail
> 
> 
> -Original Message-
> From: Gryffyn, Trevor [mailto:[EMAIL PROTECTED] 
> Sent: Friday, September 10, 2004 11:58 AM
> To: [EMAIL PROTECTED]
> Cc: Louie Miranda
> Subject: RE: [PHP] Adding +7 more days on date() value problem
> 
> 
> I disagree on the strtotime recommendations that everyone 
> else gave. The
> mktime() function itself will compensate for leap years, "day 
> = 36" type
> stuff and all of that.
> 
>  $curdate = date("Y-m-d");
> $plus7 = date("Y-m-d",mktime(0,0,0,date("m"),date("d")+7,date("Y")));
> Echo "Current Date: $curdate";
> Echo "+7 Dats Date: $plus7";
> ?>
> 
> 
> Simple as that!
> 
> -TG
> 
> > -Original Message-
> > From: Louie Miranda [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, July 27, 2004 11:31 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] Adding +7 more days on date() value problem
> > 
> > 
> > I can't figure how could i add +7 more days on the DD (Day) 
> value. My 
> > problem is, when the day is close on the end of the month like
> > 
> > 07/29/2004
> > 
> > when i add +7 on 29 = 36, its obvious we dont have 36 on 
> the calendar. 
> > And im creating a program below, to explode it and maybe 
> just add +. 
> > But i think its useless if im just going to do + on the DD (Day) 
> > value.
> > 
> > Hmm :?
> > 
> > ##
> >  > $curdate = date("Y-m-d");
> > $plus7 = explode("-", $curdate);
> > 
> > print ("
> > cut:
> > " .$plus7[0]. "
> > " .$plus7[1]. "
> > " .$plus7[2]. "
> > 
> > 
> > Current Date: $curdate
> > +7 Dats Date: $plus7
> > 
> > ");
> > ?>
> > ##
> > 
> > --
> > Louie Miranda
> > http://www.axishift.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



[PHP] Re: multi dimension array

2004-09-10 Thread Torsten Roehr
"Dan McCullough" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I believe that would be the correct term for what I need.
>
> Here is what I have been trying to do.
>
> I have orders and customers.  Customers are required to do a few things
before we can process the
> order.  Some times they are very slow in doing so.  So I wanted to write a
little reminder script
> to poke us to email/call them.
>
> So I have orders and customers.  I need to go through and list out the
orders and then I need to
> use the customer to grab all the order associated with them, then list out
their contact
> information.  Anythough on how I can group orders by customer, list the
customer information (from
> another table) and then go on to the next order and so the same thing all
over again?

Load all customers and while looping through the result set load all orders
associated with the current customer:

// open db connection etc.

// load all customers
$result = mysql_query('SELECT * FROM customers');
while ($row = mysql_fetch_assoc($result)) {

// output customer data if required
echo $row['customerName'];

// load all associated orders
$tempResult = mysql_query('SELECT * FROM orders WHERE customerID = ' .
$row['customerID']);
while ($tempRow = mysql_fetch_assoc($result)) {
 // output order data if required
 echo $tempRow['orderID'];
}
}

Regards, Torsten Roehr

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



RE: [PHP] Adding +7 more days on date() value problem

2004-09-10 Thread Gryffyn, Trevor
Because $now+(7*24*60*60) isn't very intuitive to a human.

Why would you do it that way instead of:

$days = 24*60*60;
$now = time();
$plus7 = $now+(7*$days);

echo 'Current Date: '.date('Y-m-d', $now);
echo 'Date in 7 days: '.date('Y-m-d', $plus7);


Maybe you think like a machine, but the way I did it avoids the whole
*24*60*60 nonesense that just makes the code seem cluttered to me.  And
what happens if I make a typo and do *70 or *25?  I've made plenty of
typos in my day and I'm sure everyone else has.  Why risk a slight
miscalculation that could give you inaccurate results when PHP is happy
to help?

Maybe you'd say, "What if you mistype the 7 as a 9?"  well, then I'm
screwed either way.  But I've gone from 4 potential typo problems to
one.  Sounds like a good improvement to me.

This is mostly a matter of style.  Your way works as well as mine.  I
just like mine better.  People can decide which way they'd prefer.  Your
example is good to help people realize how they can manually do the
calculations if they should need to though, so thanks for posting it!

-TG

> -Original Message-
> From: M. Sokolewicz [mailto:[EMAIL PROTECTED] 
> Sent: Friday, September 10, 2004 4:08 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Adding +7 more days on date() value problem
> 
> 
> Why would you do such strange things? It's a lot more simple :P
> 
> $now = time();
> $plus7 = $now+(7*24*60*60); // 7 days, containing 24 hours each, 
> containing 60 minutes each, containing 60 seconds each.
> 
> echo 'Current Date: '.date('Y-m-d', $now);
> echo 'Date in 7 days: '.date('Y-m-d', $plus7);
> 
> now isn't that easier ;)
> 
> Trevor Gryffyn wrote:
> 
> > I disagree on the strtotime recommendations that everyone else gave.
> > The mktime() function itself will compensate for leap 
> years, "day = 36"
> > type stuff and all of that.
> > 
> >  > $curdate = date("Y-m-d");
> > $plus7 = 
> date("Y-m-d",mktime(0,0,0,date("m"),date("d")+7,date("Y")));
> > Echo "Current Date: $curdate";
> > Echo "+7 Dats Date: $plus7";
> > ?>
> > 
> > 
> > Simple as that!
> > 
> > -TG
> > 
> > 
> >>-Original Message-
> >>From: Louie Miranda [mailto:[EMAIL PROTECTED] 
> >>Sent: Tuesday, July 27, 2004 11:31 PM
> >>To: [EMAIL PROTECTED]
> >>Subject: [PHP] Adding +7 more days on date() value problem
> >>
> >>
> >>I can't figure how could i add +7 more days on the DD (Day) 
> value. My
> >>problem is, when the day is close on the end of the month like
> >>
> >>07/29/2004
> >>
> >>when i add +7 on 29 = 36, its obvious we dont have 36 on 
> the calendar.
> >>And im creating a program below, to explode it and maybe just add +.
> >>But i think its useless if im just going to do + on the DD (Day)
> >>value.
> >>
> >>Hmm :?
> >>
> >>##
> >> >>$curdate = date("Y-m-d");
> >>$plus7 = explode("-", $curdate);
> >>
> >>print ("
> >>cut:
> >>" .$plus7[0]. "
> >>" .$plus7[1]. "
> >>" .$plus7[2]. "
> >>
> >>
> >>Current Date: $curdate
> >>+7 Dats Date: $plus7
> >>
> >>");
> >>?>
> >>##
> >>
> >>-- 
> >>Louie Miranda
> >>http://www.axishift.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] php|works in Toronto - anyone going?

2004-09-10 Thread Chris Shiflett
--- Aaron Gould <[EMAIL PROTECTED]> wrote:
> Just curious if anyone on the list was headed to Toronto on Sep 22-24 
> for php|works.  I live about two hours from Toronto, and my company
> is sending me.
> 
> I wonder what kind of reception this conference will get...

I'm giving a talk on PHP session security, so I'll be there.

If anyone from the list is coming, please drop by and say hi.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming Fall 2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

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



RE: [PHP] Adding +7 more days on date() value problem

2004-09-10 Thread Vail, Warren
Actually, I stand corrected on this one, it will be off by an hour on
daylight savings change date (either one).

Warren Vail


-Original Message-
From: M. Sokolewicz [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 10, 2004 1:08 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Adding +7 more days on date() value problem


Why would you do such strange things? It's a lot more simple :P

$now = time();
$plus7 = $now+(7*24*60*60); // 7 days, containing 24 hours each, 
containing 60 minutes each, containing 60 seconds each.

echo 'Current Date: '.date('Y-m-d', $now);
echo 'Date in 7 days: '.date('Y-m-d', $plus7);

now isn't that easier ;)

Trevor Gryffyn wrote:

> I disagree on the strtotime recommendations that everyone else gave. 
> The mktime() function itself will compensate for leap years, "day = 
> 36" type stuff and all of that.
> 
>  $curdate = date("Y-m-d");
> $plus7 = date("Y-m-d",mktime(0,0,0,date("m"),date("d")+7,date("Y")));
> Echo "Current Date: $curdate";
> Echo "+7 Dats Date: $plus7";
> ?>
> 
> 
> Simple as that!
> 
> -TG
> 
> 
>>-Original Message-
>>From: Louie Miranda [mailto:[EMAIL PROTECTED]
>>Sent: Tuesday, July 27, 2004 11:31 PM
>>To: [EMAIL PROTECTED]
>>Subject: [PHP] Adding +7 more days on date() value problem
>>
>>
>>I can't figure how could i add +7 more days on the DD (Day) value. My 
>>problem is, when the day is close on the end of the month like
>>
>>07/29/2004
>>
>>when i add +7 on 29 = 36, its obvious we dont have 36 on the calendar. 
>>And im creating a program below, to explode it and maybe just add +. 
>>But i think its useless if im just going to do + on the DD (Day) 
>>value.
>>
>>Hmm :?
>>
>>##
>>>$curdate = date("Y-m-d");
>>$plus7 = explode("-", $curdate);
>>
>>print ("
>>cut:
>>" .$plus7[0]. "
>>" .$plus7[1]. "
>>" .$plus7[2]. "
>>
>>
>>Current Date: $curdate
>>+7 Dats Date: $plus7
>>
>>");
>>?>
>>##
>>
>>--
>>Louie Miranda
>>http://www.axishift.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] problem with Header("Location: home.php");

2004-09-10 Thread Chris Shiflett
--- CBharadwaj <[EMAIL PROTECTED]> wrote:
> In conection.php I have written.
> SESSION_ START();
> 
> on successful login I am registering a session variable.
> SESSION_REGISTER("userId");


Do this instead:

session_start();
$_SESSION['userid'] = 'myuser';

>  Header("Location: home.php");

Use an absolute URL:

header('Location: http://example.org/home.php');

> Warning: Cannot modify header information - headers already sent by 
> (output started at E:\PHPMySql scripts\bugtrack\connection.php:3)
>  in E:\PHPMySql scripts\bugtrack\index.php on line 117

This call to header() on line 117 of index.php generates an error, because
line 3 of connection.php generated output. Calls to header() must come
prior to output. You can either rearrange your code or use output
buffering:

http://www.php.net/ob_start

Hope that helps.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming Fall 2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

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



RE: [PHP] Adding +7 more days on date() value problem

2004-09-10 Thread Vail, Warren
So if this is run on the 30th of the month, you are saying this handles a
month with day 37 correctly?

Warren Vail


-Original Message-
From: Gryffyn, Trevor [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 10, 2004 11:58 AM
To: [EMAIL PROTECTED]
Cc: Louie Miranda
Subject: RE: [PHP] Adding +7 more days on date() value problem


I disagree on the strtotime recommendations that everyone else gave. The
mktime() function itself will compensate for leap years, "day = 36" type
stuff and all of that.

";
Echo "+7 Dats Date: $plus7";
?>


Simple as that!

-TG

> -Original Message-
> From: Louie Miranda [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, July 27, 2004 11:31 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Adding +7 more days on date() value problem
> 
> 
> I can't figure how could i add +7 more days on the DD (Day) value. My 
> problem is, when the day is close on the end of the month like
> 
> 07/29/2004
> 
> when i add +7 on 29 = 36, its obvious we dont have 36 on the calendar. 
> And im creating a program below, to explode it and maybe just add +. 
> But i think its useless if im just going to do + on the DD (Day) 
> value.
> 
> Hmm :?
> 
> ##
>  $curdate = date("Y-m-d");
> $plus7 = explode("-", $curdate);
> 
> print ("
> cut:
> " .$plus7[0]. "
> " .$plus7[1]. "
> " .$plus7[2]. "
> 
> 
> Current Date: $curdate
> +7 Dats Date: $plus7
> 
> ");
> ?>
> ##
> 
> --
> Louie Miranda
> http://www.axishift.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] Adding +7 more days on date() value problem

2004-09-10 Thread Vail, Warren
I believe this one will be off by an hour on leap day.

Warren Vail


-Original Message-
From: M. Sokolewicz [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 10, 2004 1:08 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Adding +7 more days on date() value problem


Why would you do such strange things? It's a lot more simple :P

$now = time();
$plus7 = $now+(7*24*60*60); // 7 days, containing 24 hours each, 
containing 60 minutes each, containing 60 seconds each.

echo 'Current Date: '.date('Y-m-d', $now);
echo 'Date in 7 days: '.date('Y-m-d', $plus7);

now isn't that easier ;)

Trevor Gryffyn wrote:

> I disagree on the strtotime recommendations that everyone else gave. 
> The mktime() function itself will compensate for leap years, "day = 
> 36" type stuff and all of that.
> 
>  $curdate = date("Y-m-d");
> $plus7 = date("Y-m-d",mktime(0,0,0,date("m"),date("d")+7,date("Y")));
> Echo "Current Date: $curdate";
> Echo "+7 Dats Date: $plus7";
> ?>
> 
> 
> Simple as that!
> 
> -TG
> 
> 
>>-Original Message-
>>From: Louie Miranda [mailto:[EMAIL PROTECTED]
>>Sent: Tuesday, July 27, 2004 11:31 PM
>>To: [EMAIL PROTECTED]
>>Subject: [PHP] Adding +7 more days on date() value problem
>>
>>
>>I can't figure how could i add +7 more days on the DD (Day) value. My 
>>problem is, when the day is close on the end of the month like
>>
>>07/29/2004
>>
>>when i add +7 on 29 = 36, its obvious we dont have 36 on the calendar. 
>>And im creating a program below, to explode it and maybe just add +. 
>>But i think its useless if im just going to do + on the DD (Day) 
>>value.
>>
>>Hmm :?
>>
>>##
>>>$curdate = date("Y-m-d");
>>$plus7 = explode("-", $curdate);
>>
>>print ("
>>cut:
>>" .$plus7[0]. "
>>" .$plus7[1]. "
>>" .$plus7[2]. "
>>
>>
>>Current Date: $curdate
>>+7 Dats Date: $plus7
>>
>>");
>>?>
>>##
>>
>>--
>>Louie Miranda
>>http://www.axishift.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



[PHP] Re: How to access one class from another

2004-09-10 Thread Torsten Roehr
"Brent Baisley" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> What is the best way to access one class from another? What I have is a
> couple of "core" classes that are loaded into instances at the start of
> each page. I then load instances of page specific classes. How would I
> access the already loaded instances of the core classes from inside one
> of the page specific classes?
>
> I tried a few things that didn't work. Is the only way to do this is to
> load another instance of the core classes?
> I'm finally trying to really get my hands around OOP, which has gone
> very smooth up until this instance:). I'm using v4 not v5.
>
> I'm looking for something like this:
> class Lists {
> function UserList() {
> }
> ...
> }
> $coreLists = new Lists();
> ...
> class Data {
> function Entry() {
> $users = $coreLists->UserList();  file://Accessing Lists Class
> ...
> }
> }

Hi Brent,

this is a case of variable scope:
http://de2.php.net/variables.scope

There are different ways to solve your problem:

1. Declare $coreLists global in your method:
   function Entry() {
  global $coreLists;
  $users = $coreLists->UserList();
   }

2. Access it via the superglobal $GLOBALS:
   function Entry() {
  $users = $GLOBALS['coreLists']->UserList();
   }

3. Pass the variable it to the class constructor and assign it to a class
property:
   var $coreLists;

   function Data($coreLists) {
  $this->coreLists = $coreLists;
   }

Best regards, Torsten Roehr

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



[PHP] Re: How to access one class from another

2004-09-10 Thread Matthew Weier O'Phinney
* Brent Baisley <[EMAIL PROTECTED]>:
> What is the best way to access one class from another? What I have is a 
> couple of "core" classes that are loaded into instances at the start of 
> each page. I then load instances of page specific classes. How would I 
> access the already loaded instances of the core classes from inside one 
> of the page specific classes?
>
> I tried a few things that didn't work. Is the only way to do this is to 
> load another instance of the core classes?



> I'm looking for something like this:
> class Lists {
>   function UserList() {
>   }
>   ...
> }
> $coreLists = new Lists();
> ...
> class Data {
>   function Entry() {
>   $users = $coreLists->UserList();  //Accessing Lists Class
>   ...
>   }
> }

Well, what comes to mind is to:
* create an instance of Lists
* pass that instance to Data when you instantiate a Data object (or
  later), and assign it to a property of Data.

It'd look something like this:

$coreLists = new Lists();
$coreData = new Data($coreLists);

and in Data:

class Data {
function __construct(&$lists) {
$this->lists =& $lists;
}
function Entry() {
$users = $this->lists->UserList();
}
}


-- 
Matthew Weier O'Phinney   | mailto:[EMAIL PROTECTED]
Webmaster and IT Specialist   | http://www.garden.org
National Gardening Association| http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org

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



[PHP] multi dimension array

2004-09-10 Thread Dan McCullough
I believe that would be the correct term for what I need.

Here is what I have been trying to do.

I have orders and customers.  Customers are required to do a few things before we can 
process the
order.  Some times they are very slow in doing so.  So I wanted to write a little 
reminder script
to poke us to email/call them.

So I have orders and customers.  I need to go through and list out the orders and then 
I need to
use the customer to grab all the order associated with them, then list out their 
contact
information.  Anythough on how I can group orders by customer, list the customer 
information (from
another table) and then go on to the next order and so the same thing all over again?

=

"Theres no such thing as a problem unless the servers are on fire!"




___
Do you Yahoo!?
Shop for Back-to-School deals on Yahoo! Shopping.
http://shopping.yahoo.com/backtoschool

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



Re: [PHP] Array inside Class

2004-09-10 Thread Greg Beaver
M. Sokolewicz wrote:
To summarize:

   var $input2;
   var $input;
function Liste() { /* or, if you're using php5: public function
__construct() { */
   $this->input = array(1,2,3);
   $this->input2 = array_pad($this->input,10,1);
}
}
The reason being, for this, that inside a class property definition, 
only static values are allowed. This has to do with the Static use of a 
class. Imagine the following (PHP 4):
--- PHP 4 ---
class foo {
   var $a = 2;
   var $b = 5;
}
--- end ---
or
--- PHP 5 ---
class foo {
   public $a = 2;
   public $b = 5;
}
--- end ---

Now, when someone uses it statically, he/she can call them like:
---
echo foo::a;
This is not entirely accurate.

results in:
Fatal error:  Undefined class constant 'a' in PHPDocument1 on line 7

results in:
Fatal Error: Access to undeclared static property:  foo::$a in 
PHPDocument1 on line 7


results in:
2
The reasoning behind not allowing complex expressions in variable 
declarations is that they must be evaluated at compile time, *before* 
any functions, classes, or other complex structures have been parsed and 
therefore created, otherwise php would be either incredibly unstable or 
much slower.

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


[PHP] How to access one class from another

2004-09-10 Thread Brent Baisley
What is the best way to access one class from another? What I have is a 
couple of "core" classes that are loaded into instances at the start of 
each page. I then load instances of page specific classes. How would I 
access the already loaded instances of the core classes from inside one 
of the page specific classes?

I tried a few things that didn't work. Is the only way to do this is to 
load another instance of the core classes?
I'm finally trying to really get my hands around OOP, which has gone 
very smooth up until this instance:). I'm using v4 not v5.

I'm looking for something like this:
class Lists {
function UserList() {
}
...
}
$coreLists = new Lists();
...
class Data {
function Entry() {
$users = $coreLists->UserList();  //Accessing Lists Class
...
}
}
Thanks
--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] OO Docs for SQLite extension

2004-09-10 Thread Ricardo Cezar
I told:

"I search php.net website"

This page don´t have the docs for constructor, methods and properties. It
doesn´t have docs for OO programing with SQLite. Only procedural programing.
I´m looking for the OO docs...


"Greg Donald" <[EMAIL PROTECTED]> escreveu na mensagem
news:[EMAIL PROTECTED]
On Fri, 10 Sep 2004 16:20:21 -0300, Ricardo Cezar <[EMAIL PROTECTED]>
wrote:
> Where can I find the docs for Constructor, Properties and Methods for the
> SQLite extension? I search PHP.NET website but I can´t found it. I found
> this information for mysqli only...


http://www.php.net/sqlite


--
Greg Donald
http://destiney.com/

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



Re: [PHP] OO Docs for SQLite extension

2004-09-10 Thread Greg Donald
On Fri, 10 Sep 2004 16:20:21 -0300, Ricardo Cezar <[EMAIL PROTECTED]> wrote:
> Where can I find the docs for Constructor, Properties and Methods for the
> SQLite extension? I search PHP.NET website but I can´t found it. I found
> this information for mysqli only...


http://www.php.net/sqlite


-- 
Greg Donald
http://destiney.com/

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



Re: [PHP] Advanced Query Wizard

2004-09-10 Thread Robb Kerr
On Fri, 10 Sep 2004 14:57:29 -0500, Greg Donald wrote:

> On Fri, 10 Sep 2004 14:00:47 -0500, Robb Kerr
> <[EMAIL PROTECTED]> wrote:
>> This is not a sales post.
> 
> It sure sounds like one, not that I care or anything.
> 
> Curious.. did they have a non-windows version?  Something for the vim
> crowd perhaps?  What about for Postgres?  I'm using MySQL less and
> less all the time.

Sorry. Just found a really cool tool that makes my life much easier. And,
with all of the recent posts discussing sophisticated queries and dealing
with the results, I thought I'd pass on the info.

No. There is not a non-windows version. Don't know aobout Postgres. VIM
crowd?
-- 
Robb Kerr
Digital IGUANA

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



Re: [PHP] Adding +7 more days on date() value problem

2004-09-10 Thread M. Sokolewicz
Why would you do such strange things? It's a lot more simple :P
$now = time();
$plus7 = $now+(7*24*60*60); // 7 days, containing 24 hours each, 
containing 60 minutes each, containing 60 seconds each.

echo 'Current Date: '.date('Y-m-d', $now);
echo 'Date in 7 days: '.date('Y-m-d', $plus7);
now isn't that easier ;)
Trevor Gryffyn wrote:
I disagree on the strtotime recommendations that everyone else gave.
The mktime() function itself will compensate for leap years, "day = 36"
type stuff and all of that.
";
Echo "+7 Dats Date: $plus7";
?>
Simple as that!
-TG

-Original Message-
From: Louie Miranda [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, July 27, 2004 11:31 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Adding +7 more days on date() value problem

I can't figure how could i add +7 more days on the DD (Day) value. My
problem is, when the day is close on the end of the month like
07/29/2004
when i add +7 on 29 = 36, its obvious we dont have 36 on the calendar.
And im creating a program below, to explode it and maybe just add +.
But i think its useless if im just going to do + on the DD (Day)
value.
Hmm :?
##

print ("
cut:
" .$plus7[0]. "
" .$plus7[1]. "
" .$plus7[2]. "

Current Date: $curdate
+7 Dats Date: $plus7
");
?>
##
--
Louie Miranda
http://www.axishift.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] Re: PHP modules

2004-09-10 Thread Catalin Trifu
http://ro.php.net/manual/en/zend.php

This might be a good start.

Cheers,
Catalin

"Benjamin Bostow" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>I have heard of php modules and to the sound of it it allows me to create 
>php functions that I don't have to have include files to have access to 
>those functions. I have been searching for any information on this and have 
>not had any success. I am basically trying to write an API that others can 
>use in php that will interface with my software. I would like to make it so 
>that they don't have to worry about adding include files and having all of 
>the structures set up for that. If anyone can provide information on 
>building custom functions and calls into PHP it would be helpful.
>
> Benjamin Bostow 

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



Re: [PHP] Array inside Class

2004-09-10 Thread M. Sokolewicz
Wouter Van Vliet wrote:
On Fri, 10 Sep 2004 14:26:22 -0400, John Holmes
<[EMAIL PROTECTED]> wrote:
From: "dirk" <[EMAIL PROTECTED]>
can anyone explain to me, why I can't resize an array inside a class?
Sample Code:

Output:
Parse error: parse error, unexpected '(', expecting ',' or ';' in
/srv/www/htdocs/stundenplan/stpoo.php on line 4
You can't assign values like that.
Try this:
var $input = array(1,2,3);
var $input2 = array();
$this->input2 = array_pad($this->input,10,1);

To summarize:

   var $input2;
   var $input;
function Liste() { /* or, if you're using php5: public function
__construct() { */
   $this->input = array(1,2,3);
   $this->input2 = array_pad($this->input,10,1);
}
}
The reason being, for this, that inside a class property definition, 
only static values are allowed. This has to do with the Static use of a 
class. Imagine the following (PHP 4):
--- PHP 4 ---
class foo {
   var $a = 2;
   var $b = 5;
}
--- end ---
or
--- PHP 5 ---
class foo {
   public $a = 2;
   public $b = 5;
}
--- end ---

Now, when someone uses it statically, he/she can call them like:
---
echo foo::a;
---
returning 2.
Now, if someone were allowed to use non-static values, eg. those 
supplied by functions, one could do:
--- PHP 4 ---
class bar {
   var $a = rand();
}
--- end ---
or
--- PHP 5 ---
class bar {
   public $a = rand();
}
--- end ---

Now, when someone would be calling the class properties STATICALLY, what 
would one get? Certainly not static results. Correct?
echo bar::a;
might return 2, or 26565984 or anything else. It also might return 
different values with each call to it.
The behaviour is not static. It is dynamic. This would thus not comply 
with the idea "Static" calling. Which is also the reason not to allow it.

The workaround given by Wouter is a common way of getting around this. 
That change however only makes the variables work when not the class is 
called, but the object instantiated from it. In other words, when it is 
called dynamically. When it's called dynamically, the object is stored 
seperatly from the class, and represents a sibling of the class, and 
thus MAY contain different property values than the other siblings of 
that class.

Hope that makes it a bit clearer.
- Tul
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Advanced Query Wizard

2004-09-10 Thread Greg Donald
On Fri, 10 Sep 2004 14:00:47 -0500, Robb Kerr
<[EMAIL PROTECTED]> wrote:
> This is not a sales post.

It sure sounds like one, not that I care or anything.

Curious.. did they have a non-windows version?  Something for the vim
crowd perhaps?  What about for Postgres?  I'm using MySQL less and
less all the time.


-- 
Greg Donald
http://destiney.com/

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



Re: [PHP] PHP modules

2004-09-10 Thread Greg Donald
On Fri, 10 Sep 2004 11:57:03 -0700, Benjamin Bostow
<[EMAIL PROTECTED]> wrote:
> I have heard of php modules and to the sound of it it allows me to
> create php functions that I don't have to have include files to have
> access to those functions. I have been searching for any information on
> this and have not had any success. I am basically trying to write an
> API that others can use in php that will interface with my software. I
> would like to make it so that they don't have to worry about adding
> include files and having all of the structures set up for that. If
> anyone can provide information on building custom functions and calls
> into PHP it would be helpful.


Did you try Google'ng for 'extending PHP'.  I found lots of stuff just now.


-- 
Greg Donald
http://destiney.com/

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



[PHP] OO Docs for SQLite extension

2004-09-10 Thread Ricardo Cezar
Where can I find the docs for Constructor, Properties and Methods for the
SQLite extension? I search PHP.NET website but I can´t found it. I found
this information for mysqli only...

Thanks,
Rics

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



[PHP] Advanced Query Wizard

2004-09-10 Thread Robb Kerr
This is not a sales post. I also posted this on the MySQL board. I have 
been struggling with JOINed SELECT statements in MySQL for a while now. The 
syntax just seems to elude me. However, I just found a Win Dreamweaver 
extension that rocks. The Advanced Query Wizard allows me to very quickly 
and easily write sophisticated, joined queries with conditionals and 
sorting from many tables at once. It has made my life considerably easier 
so I wanted to pass on the information.

https://www.advancedextensions.com/products.htm

Thanx
-- 
Robb Kerr
Digital IGUANA
Helping Digital Artists Achieve their Dreams

http://www.digitaliguana.com
http://www.cancerreallysucks.org

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



RE: [PHP] Adding +7 more days on date() value problem

2004-09-10 Thread Gryffyn, Trevor
I disagree on the strtotime recommendations that everyone else gave.
The mktime() function itself will compensate for leap years, "day = 36"
type stuff and all of that.

";
Echo "+7 Dats Date: $plus7";
?>


Simple as that!

-TG

> -Original Message-
> From: Louie Miranda [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, July 27, 2004 11:31 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Adding +7 more days on date() value problem
> 
> 
> I can't figure how could i add +7 more days on the DD (Day) value. My
> problem is, when the day is close on the end of the month like
> 
> 07/29/2004
> 
> when i add +7 on 29 = 36, its obvious we dont have 36 on the calendar.
> And im creating a program below, to explode it and maybe just add +.
> But i think its useless if im just going to do + on the DD (Day)
> value.
> 
> Hmm :?
> 
> ##
>  $curdate = date("Y-m-d");
> $plus7 = explode("-", $curdate);
> 
> print ("
> cut:
> " .$plus7[0]. "
> " .$plus7[1]. "
> " .$plus7[2]. "
> 
> 
> Current Date: $curdate
> +7 Dats Date: $plus7
> 
> ");
> ?>
> ##
> 
> -- 
> Louie Miranda
> http://www.axishift.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] PHP modules

2004-09-10 Thread Benjamin Bostow
I have heard of php modules and to the sound of it it allows me to 
create php functions that I don't have to have include files to have 
access to those functions. I have been searching for any information on 
this and have not had any success. I am basically trying to write an 
API that others can use in php that will interface with my software. I 
would like to make it so that they don't have to worry about adding 
include files and having all of the structures set up for that. If 
anyone can provide information on building custom functions and calls 
into PHP it would be helpful.

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


RE: [PHP] adding *** on email address upon view

2004-09-10 Thread Gryffyn, Trevor
One simple way to do it would be:

List($username,$domain) = explode("@",$emailaddress);

$newemailaddress = "[EMAIL PROTECTED]";

Maybe I just use list/explode too much. :)

-TG

> -Original Message-
> From: Jason Wong [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, July 22, 2004 6:09 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] adding *** on email address upon view
> 
> 
> On Thursday 22 July 2004 16:09, Louie Miranda wrote:
> 
> > What command in php? can i convert certain text ex the
> > [EMAIL PROTECTED] to [EMAIL PROTECTED]
> 
> If this is to protect people's email addresses then make it 
> easy on yourself 
> and just discard the whole domain.
> 
> -- 
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications 
> Development *
> --
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> --
> /*
> Never say no
>   -- Murphy's Laws on Sex n45
> */
> 
> -- 
> 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] Active windows

2004-09-10 Thread Gryffyn, Trevor
Check into the Javascript events "onfocus" and "onblur" (forgive my syntax).   Focus 
is when a window becomes 'active' and Blur is when it becomes 'non active'.

-TG

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, June 15, 2004 10:07 PM
> To: PHP general
> Subject: [PHP] Active windows
> 
> 
> I am trying to get my website to refresh when the window 
> becomes active.
> 
> This is needed so when a user downloads a report and the PDF 
> is displayed,
> there is now a new state in the previously active window.  
> However, the page
> needs to refresh to regenerate the new page.  Any ideas on 
> how to do this?
> Can one send header information to a separate window, or 
> discern between
> active and non active windows?
> 
> I know this is a stretch but I thought I¹d ask
> 
> /T
> 
> 

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



Re: [PHP] image size?

2004-09-10 Thread Wouter van Vliet
You probably need this to set the Content-length: header, don't you?

I'd go into:

ob_start()
imagegif($imageResource);
// or whatever type of image you're writing
$blob = ob_get_clean();
unset($imageResource); // free the memory once you're not using the image

// size in bytes = strlen()+1, due to the \0 or null character at the end.
$byteSize = strlen($blob)+1;


On Fri, 10 Sep 2004 10:02:42 -0700, Ed Lazor <[EMAIL PROTECTED]> wrote:
> > -Original Message-
> > On Friday 10 September 2004 06:59, Ed Lazor wrote:
> > > Is there a way to get the size of an image created using the imagecreate
> > > function?
> >
> > Size as in ... ?
> 
> I was looking for the size of the image in bytes.
> 
> -Ed
> 
> --
> 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] Array inside Class

2004-09-10 Thread Wouter van Vliet
On Fri, 10 Sep 2004 14:26:22 -0400, John Holmes
<[EMAIL PROTECTED]> wrote:
> From: "dirk" <[EMAIL PROTECTED]>
> > can anyone explain to me, why I can't resize an array inside a class?
> > Sample Code:
> >
> >  > class Liste {
> >   var $input = array (1,2,3);
> >   var $input2 = array_pad ($input,10, 1);
> > }
> > ?>
> >
> > Output:
> > Parse error: parse error, unexpected '(', expecting ',' or ';' in
> > /srv/www/htdocs/stundenplan/stpoo.php on line 4
> 
> You can't assign values like that.
> 
> Try this:
> var $input = array(1,2,3);
> var $input2 = array();
> $this->input2 = array_pad($this->input,10,1);
> 

To summarize:

input = array(1,2,3);
   $this->input2 = array_pad($this->input,10,1);
}
}

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



Re: [PHP] Array inside Class

2004-09-10 Thread dirk
Works fine within the constructor, thanks.

Dirk

On Fri, 10 Sep 2004 14:38:45 -0400, John Holmes
<[EMAIL PROTECTED]> wrote:
> From: "dirk" <[EMAIL PROTECTED]>
> >> Try this:
> >> var $input = array(1,2,3);
> >> var $input2 = array();
> >> $this->input2 = array_pad($this->input,10,1);
> >
> > Well, doesn't work either:
> >
> > Parse error: parse error, unexpected T_VARIABLE, expecting T_FUNCTION
> > in /srv/www/htdocs/stundenplan/stpoo.php on line 5
> 
> The array_pad part needs to go inside of a function. The constructor would
> be a good place for it.
> 
> ---John Holmes...
> 
> 



-- 
Try http://einx.dyndns.org

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



Re: [PHP] Array inside Class

2004-09-10 Thread John Holmes
From: "dirk" <[EMAIL PROTECTED]>
Try this:
var $input = array(1,2,3);
var $input2 = array();
$this->input2 = array_pad($this->input,10,1);
Well, doesn't work either:
Parse error: parse error, unexpected T_VARIABLE, expecting T_FUNCTION
in /srv/www/htdocs/stundenplan/stpoo.php on line 5
The array_pad part needs to go inside of a function. The constructor would 
be a good place for it.

---John Holmes... 

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


Re: [PHP] Array inside Class

2004-09-10 Thread dirk
Well, doesn't work either:

Parse error: parse error, unexpected T_VARIABLE, expecting T_FUNCTION
in /srv/www/htdocs/stundenplan/stpoo.php on line 5

I forgot to mention that I'm using php-5.0.1 before

Dirk

On Fri, 10 Sep 2004 14:26:22 -0400, John Holmes
<[EMAIL PROTECTED]> wrote:
> From: "dirk" <[EMAIL PROTECTED]>
> 
> 
> > can anyone explain to me, why I can't resize an array inside a class?
> > Sample Code:
> >
> >  > class Liste {
> >   var $input = array (1,2,3);
> >   var $input2 = array_pad ($input,10, 1);
> > }
> > ?>
> >
> > Output:
> > Parse error: parse error, unexpected '(', expecting ',' or ';' in
> > /srv/www/htdocs/stundenplan/stpoo.php on line 4
> 
> You can't assign values like that.
> 
> Try this:
> var $input = array(1,2,3);
> var $input2 = array();
> $this->input2 = array_pad($this->input,10,1);
> 
> ---John Holmes...
> 
> 



-- 
Try http://einx.dyndns.org

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



RE: [PHP] A follow up on my question about good coding practice [isset]

2004-09-10 Thread Gryffyn, Trevor
For reference:

http://www.blueshoes.org/en/developer/php_cheat_sheet/


> -Original Message-
> From: Al [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, June 06, 2004 7:47 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] A follow up on my question about good coding 
> practice [isset]
> 
> 
> I could use one additional clarification regarding good practice.
> 
> As I understand the php manual the following is acceptable.
> 
> $foo= TRUE;
> 
> if($foo) do..  ;
> 
> where $foo is a binary; but not a variable.
> 
> Use isset($var) for variables and be careful with $var= ' '; etc.  
> because $var is assigned, i.e., "set". 
> 
> -- 
> 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] Array inside Class

2004-09-10 Thread John Holmes
From: "dirk" <[EMAIL PROTECTED]>
can anyone explain to me, why I can't resize an array inside a class?
Sample Code:

Output: 
Parse error: parse error, unexpected '(', expecting ',' or ';' in
/srv/www/htdocs/stundenplan/stpoo.php on line 4
You can't assign values like that.
Try this:
var $input = array(1,2,3);
var $input2 = array();
$this->input2 = array_pad($this->input,10,1);
---John Holmes...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Array inside Class

2004-09-10 Thread Chris Dowell
From the manual:
In PHP 4, only constant initializers for var variables are allowed. To 
initialize variables with non-constant values, you need an 
initialization function which is called automatically when an object 
is being constructed from the class. Such a function is called a 
constructor (see below).

Cheers
Chris
dirk wrote:
Hello everybody,
can anyone explain to me, why I can't resize an array inside a class?
Sample Code:

Output: 
Parse error: parse error, unexpected '(', expecting ',' or ';' in
/srv/www/htdocs/stundenplan/stpoo.php on line 4

Thanks,
Dirk
 

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


Re: [PHP] Array inside Class

2004-09-10 Thread Greg Donald
On Fri, 10 Sep 2004 20:09:55 +0200, dirk <[EMAIL PROTECTED]> wrote:
> can anyone explain to me, why I can't resize an array inside a class?
> Sample Code:
> 
>  class Liste {
>var $input = array (1,2,3);
>var $input2 = array_pad ($input,10, 1);
> }
> ?>
> 
> Output:
> Parse error: parse error, unexpected '(', expecting ',' or ';' in
> /srv/www/htdocs/stundenplan/stpoo.php on line 4

Did you try

var $input2 = array_pad($this->input, 10, 1);


-- 
Greg Donald
http://destiney.com/

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



Re: [PHP] [PHP-GEN] Check Boxes

2004-09-10 Thread Chris Dowell
Try something along these lines:
...
Date: 
Time: 
Cost: 
Colour: 
...

...
mysql_query("SELECT " . implode(',', $_REQUEST['columns']) . " FROM 
tablename");

...
?>
This should product a query like
SELECT date,time,colour FROM tablename;
And it's a lot neater than writing a huge chunk of code to generate your 
column list when a little judicious use of built in functions can do it 
all for you.


Cheers
Chris

Gryffyn, Trevor wrote:
You got it right, except you're going to have it blow up on you if
someone doesn't select something
Try these changes:
$a1 = $_POST['ch1'];
$a2 = $_POST['ch2'];
$a3 = $_POST['ch3'];
# Add this bit
If (isset($_POST['ch1')) {
 $collist .= ",$a1";
}
If (isset($_POST['ch2')) {
 if ($collist == "") {
   $collist = $a2;
 } else {
   $collist .= ",$a2";
 }
}If (isset($_POST['ch3')) {
 if ($collist == "") {
   $collist = $a3;
 } else {
   $collist .= ",$a3";
 }
}
# Make slight changes here
if ($collist <> "") {
 $query = "SELECT $collist FROM form";
 [EMAIL PROTECTED] ($query);
}
Enter_Date
Opening_Units
Unit_Consumed

 

-Original Message-
From: balwantsingh [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 18, 2004 5:33 AM
To: [EMAIL PROTECTED]
Subject: [PHP] [PHP-GEN] Check Boxes

balwantsingh wrote:
   

can somebody advise me
i want to use checkboxes on my website, i want that if user 
 

selects some
   

checkboxes (there will be more than 20 checkboxes), 
 

checkbox's value will
be
   

stored in variables and than SELECT query command will be 
 

run using these
   

variables through PHP.  but my problem is that in SELECT 
 

query command
after
   

each column name comma (,) is required and if i use the 
 

same than it is
   

displaying  "You have an error in your SQL syntax near 
 

'FROM form' at line
   

1"
 

i am using following coding
$a1 = $_POST['ch1'];
$a2 = $_POST['ch2'];
$a3 = $_POST['ch3'];
if ($a1 or $a2 or $a3) {
$query = "SELECT $a1, $a2, $a3 FROM form";
[EMAIL PROTECTED] ($query);
}
Enter_Date
Opening_Units
Unit_Consumed

balwant
--
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] Array inside Class

2004-09-10 Thread dirk
Hello everybody,

can anyone explain to me, why I can't resize an array inside a class?
Sample Code:



Output: 
Parse error: parse error, unexpected '(', expecting ',' or ';' in
/srv/www/htdocs/stundenplan/stpoo.php on line 4

Thanks,
Dirk

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



RE: [PHP] [PHP-GEN] Check Boxes

2004-09-10 Thread Gryffyn, Trevor
You got it right, except you're going to have it blow up on you if
someone doesn't select something

Try these changes:

$a1 = $_POST['ch1'];
$a2 = $_POST['ch2'];
$a3 = $_POST['ch3'];

# Add this bit
If (isset($_POST['ch1')) {
  $collist .= ",$a1";
}
If (isset($_POST['ch2')) {
  if ($collist == "") {
$collist = $a2;
  } else {
$collist .= ",$a2";
  }
}If (isset($_POST['ch3')) {
  if ($collist == "") {
$collist = $a3;
  } else {
$collist .= ",$a3";
  }
}


# Make slight changes here
if ($collist <> "") {
  $query = "SELECT $collist FROM form";
  [EMAIL PROTECTED] ($query);
}

Enter_Date
Opening_Units
Unit_Consumed




> -Original Message-
> From: balwantsingh [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, August 18, 2004 5:33 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] [PHP-GEN] Check Boxes
> 
> 
> balwantsingh wrote:
> > can somebody advise me
> > i want to use checkboxes on my website, i want that if user 
> selects some
> > checkboxes (there will be more than 20 checkboxes), 
> checkbox's value will
> be
> > stored in variables and than SELECT query command will be 
> run using these
> > variables through PHP.  but my problem is that in SELECT 
> query command
> after
> > each column name comma (,) is required and if i use the 
> same than it is
> > displaying  "You have an error in your SQL syntax near 
> 'FROM form' at line
> > 1"
> 
> i am using following coding
> 
> $a1 = $_POST['ch1'];
> $a2 = $_POST['ch2'];
> $a3 = $_POST['ch3'];
> 
> if ($a1 or $a2 or $a3) {
> $query = "SELECT $a1, $a2, $a3 FROM form";
> [EMAIL PROTECTED] ($query);
> }
> Enter_Date
> Opening_Units
> Unit_Consumed
> 
> 
> 
> balwant
> 
> -- 
> 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] Getting free space of remote directory

2004-09-10 Thread Jason Wong
On Friday 10 September 2004 19:23, Benkovich Mishail wrote:
> I have some paths, for example:
>  \\192.168.0.254\C\Windows\SomeDir\  or
> ftp://myhost.com/folder/  (login and password I also know)
> How I can check writable this dirs or no? - I can try to write temporary
> file or use touch() funktion. But how I can get free space of this remote
> catalogue?

It depends on how you access the remote directory. Eg using standard ftp there 
is no command to show free space, so what you're asking for is impossible.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Teamwork is essential -- it allows you to blame someone else.
*/

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



[PHP] Use of date(), and therefore time(), in the PEAR Date class

2004-09-10 Thread Andrew Hill
Hi all,

I've run into a bit of a doozy that I can't seem to figure out.

I'm using the PEAR Date class to deal with some time/date requirements
for some code, and everything has been working (to the best of my
knowledge) really well, up until now.

I decided to extend my code test suite (using Simple Test,
http://www.lastcraft.com/simple_test.php), by caluclating the execution
time. I did this by:

1) Creating a Date object at the start of the test suite, via "new
Date()";
2) Creating another Date object at the end of the test suite, via "new
Date()";
3) Creating a Date_Span object, via "new Date_Span()";
4) Setting the Date_Span object's span by using the
Date_Span::setFromDateDiff() method, with the two Date objects.

Finally, I can use the Date_Span object to output the time taken to run
the test suite, using the Date_Span::format() method.

However, this gave me a run time that was clearly wrong, so I started
looking into why, and discovered that the Date object I create at the
end of the test suite run is one hour earlier than the current time. I
have traced the code through the execution of the creation of the Date
objects, and it is correctly setting the time zone as UTC during the
creation of *both* Date objects -- however, as each Date object is
created with the code "new Date()", the PEAR Date class uses a call to
"date("Y-m-d H:i:s")" (and, by association, to "time()") in order to get
the current time, and use it to set the properties of the Date object.

It is the call to PHP's date()/time() function that returns a time that
is one hour earlier than my system clock.

What I don't understand is *why* this is happening. If I call the time()
function directly before/after the creation of the second call to Date
(which is the one that generates the incorrect date), I actually get the
correct time!

Can anyone please suggest what might be causing date()/time() to
(sometimes) return an incorrect time inside the Date class?

Cheers,

--
Andrew Hill
Developer
Awarez Ltd.
Kirkman House, 12-14 Whitfield Street, London W1T 2RF
T: +44 (0)20 7299 7370  F: +44 (0)20 7299 7374

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



RE: [PHP] image size?

2004-09-10 Thread Ed Lazor
> -Original Message-
> On Friday 10 September 2004 06:59, Ed Lazor wrote:
> > Is there a way to get the size of an image created using the imagecreate
> > function?
> 
> Size as in ... ?

I was looking for the size of the image in bytes.

-Ed

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



RE: [PHP] Barcodes ?

2004-09-10 Thread Jesse Castro
[snip]
Hi List,

Anyone have any pointers to examples of Code 39 barcode generation using
php please.

Thanks for any help

Dave Carrera
[/snip]

STFW

http://www.aditus.nu/jpgraph/jpg_barcodes.php

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



RE: [PHP] Barcodes ?

2004-09-10 Thread Justin Palmer
Hi,

Google Search: Code 39 Barcode Generation PHP

Found this here:

http://www.hotscripts.com/Detailed/9608.html

Justin

-Original Message-
From: Dave Carrera [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 10, 2004 9:48 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Barcodes ?


Hi List,

Anyone have any pointers to examples of Code 39 barcode generation using
php please.

Thanks for any help

Dave Carrera


-- 
UK Web Hosting @ http://www.ephgroup.com  

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.754 / Virus Database: 504 - Release Date: 06/09/2004
 

-- 
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] Barcodes ?

2004-09-10 Thread Dave Carrera
Hi List,

Anyone have any pointers to examples of Code 39 barcode generation using php
please.

Thanks for any help

Dave Carrera


-- 
UK Web Hosting @ http://www.ephgroup.com  

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.754 / Virus Database: 504 - Release Date: 06/09/2004
 

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



[PHP] Shared Memories in PHP

2004-09-10 Thread Chidanand

I have a requirement where in i have to access shared
memory allocated by some C process. Can i do this in
PHP?

I am trying out some thing like this. 
I want to access the existing shared memory.

$shm_id = ftok("/tmp/", 'm');
echo "$shm_id". "";
$shmid = shmop_open($shm_id, "c", 0644, 164);
$shm_data = shmop_read($shm_id, 0, 50);
echo "$shm_data". "";

with the above script the shm_id which gets generated
by ftok function is very much different then that of
existing shared memory. 
Out put of ipcs command is as shown below

-- Shared Memory Segments 
keyshmid  owner  perms  bytes 
nattch status
0x6d023641 1867780root  666164   
1
0x00180004 1638405apache644164   
0

0x6d023641 allocated with some C process which i am
intersted in.
0x00180004 is the one which is created by the above
script.

Why is the shm_id generated from ftok in C and ftok in
php different?

I also tried hard coding the shm_id in the above
script
but that too did not work. It gives following warning

Warning: shmop_read(): no shared memory segment with
an id of [1867780]

Where am i going wrong?

Thanks,
Chidanand.









__
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 

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



Re: [PHP] php|works in Toronto - anyone going?

2004-09-10 Thread Aaron Gould
John Holmes wrote:
From: "John Nichel" <[EMAIL PROTECTED]>
My company was going to send me, but backed out (money).  I'm in 
Buffalo, so it's right up the road...I may still go and just pay for 
it out of my own pocket.

Put an alias on your name tag otherwise people will be hunting you down! ;)
Have fun guys... wish I could go but it's not a good time. Maybe the 
next one.
Lucky for me I'm more of a lurker in this group, and as such I haven't 
made many enemies. Yet.  :)

--
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] imap and multipart

2004-09-10 Thread raditha dissanayake
Maxime Thonon wrote:
hello,
i work with imap and php to make a webmail. it works fine but i have a
big problem with some mails, those who contains a multipart into a
multipart. it happends with outlook express who puts into a mutlipart
the text and html version of the text into the first part of the mail.
an other case is when i forward a mail, the whole mail is fully
contained into a part of the mail. the problem is that with the imap
commands i cannot access into these parts to retrieve their contents. if
someone could help me !
 

Haven't played around with imap functions of late so I cannot comment on 
the 'not being able to access into these parts'. However if indeed you 
are having trouble with it you could look elsewhere for parsing help. 
You could perhaps retrieve the whole body and give it to the Mail_mime 
module (available as an extension or as a pear module) to have a go.


thx
--maxime--
 


--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] problems setting up php5 on apache2 (WinXP Pro)

2004-09-10 Thread Wouter van Vliet
On Fri, 10 Sep 2004 10:16:28 -0400, John Holmes
<[EMAIL PROTECTED]> wrote:
> From: "Wouter van Vliet" <[EMAIL PROTECTED]>
> > Ok, first of all: really, do use linux. It's not THAT bad for a home
> > machine ;)
> >
> > Now, the solution is quite simple as it is documented. Just copy the
> > file 'libmysql.dll' to your %WINDIR% folder and all should work. If it
> > doesn't, take libmysqli.dll as well. While you're at it, you might as
> > well copy all .dll's from the footdir of the zippackage to your
> > %WINDIR%, windows can't be hurt anymore than it already hurts and
> > it'll save you some hassle next time you want to enable another
> > extension.
> 
> I believe the installation instructions have been updated so that copying
> files to the windows directories are not recommended or needed anymore. May
> want to consult the manual once again (but Apache not finding libmysql.dll
> is your problem).
> 
> ---John Holmes...
> 

;), solution remains as easy as it is documented. I just based my
advice on the docs downloading with php5.0.0, new docs are indeed a
bit different. Should've known that before.

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



[PHP] Re: problems setting up php5 on apache2 (WinXP Pro)

2004-09-10 Thread Catalin Trifu
Hi,

I 2 use winxp pro at home, actually linux + windowoze and i have
encountered the same problem with mysql extension.
Some extensions, such as iconv, openssl depend on external libraries.

btw! it's not a good idea to mess with windows\system32 folder. If you 
want
you can add the c:\php dir to the PATH variable and all dlls in there will 
be found at
runtime by the engine which should happen anyway, since php5ts.dll is in 
that dir
anyway.
You should try and check for famous win32 DLL HELL.
http://www.sysinternals.com/ntw2k/source/filemon.shtml
This tool can be really helpfull to see which files are accessed during 
startup and see
which dlls are loaded and where they are looked for.

As far as mysql is concerned, my installation is mysql-4.0.18. I tried 
the following:
- i saw that the libmysql.dll which was delivered with php-5.0.1 was not 
working so
i tried to use the libmysql.dll which came with my mysql server 
installation.
This did not work either, so, I recompiled the mysql extension against 
my mysql server
installation and since then everything works perfect.
I used VC 6.0 since php-5.0.1 for win32 is compiled with it.
If you need some help with compiling the extension, please ask.

Cheers,
Catalin

P.S.
It's not so bad considering linux for home use either. I have to use 
winxp but i would
go for only linux if I could

"Mathieu Dumoulin" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> (Don't write to me telling me to use linux, i dont want to, this is my 
> home
> machine not a production server, thank you, now if you really want to help
> keep on reading)
>
> I got a most recent copy of PHP 5.01 extracted into "C:\php" and 
> everything
> seems to be working fine as long as i dont ask to load extensions. Any
> extension that i try to add will fail to load and i'm clueless.
>
> At first in the PHP.ini file this was the original directive:
>
> ; Directory in which the loadable extensions (modules) reside.
> extension_dir = "./"
>
> And it would not work so i changed it to a hardcoded path
>
> ; Directory in which the loadable extensions (modules) reside.
> extension_dir = "C:\php\ext"
>
> Still no extensions wont load. Whats the weirdest, all the DLLs are at the
> correct location, apache reports: "PHP startup: Unable to load dynamic
> library 'C:\php\ext\php_mysql.dll' - The specified module could not be
> found."
>
> but it IS there, at the exact location, i even looked and compared both
> paths manually letter by letter. Another weird thing to note is that some
> extensions DO load while some don't, here is a list of the extensions that
> i'm loading and which one fails (Note ALL extensions DLL are indeed in the
> folder intended, they just dont load)
>
> extension=php_bz2.dll
> extension=php_gd2.dll
> extension=php_imap.dll
> extension=php_mysql.dll <<< fails but it's vital to me
>
> these extensions are activated, only mysql fails, but there are other i
> wanted earlier lemme see which ones: (These would be nice to have, i'll 
> tell
> you which one fails too)
>
> ;extension=php_exif.dll <<< fails
> ;extension=php_ldap.dll <<< fails (The file really isnt there so it's not 
> a
> real problem)
> ;extension=php_openssl.dll <<< fails
> ;extension=php_pdf.dll
> ;extension=php_pgsql.dll
> ;extension=php_snmp.dll
> ;extension=php_sockets.dll
> ;extension=php_tidy.dll
> ;extension=php_zip.dll
>
> All of these will load... S I'm stuck there, i need help, tell me if 
> you
> need to know anything else. i'll be glad to give you info, i want to set
> this up to further my PHP developement at home. We intensively use PHP4 at
> work but i wanted to start working on PHP5 to see how good it is.
>
> Till then
> See ya'll
> TheInsaneCoder 

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



Re: [PHP] php|works in Toronto - anyone going?

2004-09-10 Thread John Nichel
John Holmes wrote:
From: "John Nichel" <[EMAIL PROTECTED]>
My company was going to send me, but backed out (money).  I'm in 
Buffalo, so it's right up the road...I may still go and just pay for 
it out of my own pocket.

Put an alias on your name tag otherwise people will be hunting you down! ;)
Yeah, if I just have 'John' on there, people may think I'm you...and 
well all know how loathed you are on here. ;)

--
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|works in Toronto - anyone going?

2004-09-10 Thread John Holmes
From: "John Nichel" <[EMAIL PROTECTED]>
My company was going to send me, but backed out (money).  I'm in Buffalo, 
so it's right up the road...I may still go and just pay for it out of my 
own pocket.
Put an alias on your name tag otherwise people will be hunting you down! ;)
Have fun guys... wish I could go but it's not a good time. Maybe the next 
one.

---John Holmes... 

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


[PHP] how to load extensions outside the extension_dir

2004-09-10 Thread Marten Lehmann
Hello,
I need to load extensions with dl() within PHP running as CGI. But as 
this is a shared hosting environment, I don't have access to the 
extension_dir. Anyway, dl() prepends /lib/php/extensions/ 
--ZEND_MODULE_API_NO if I'm calling 
dl("myext.so"); even if I'm starting with a slash. How can I disable this?

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


Re: [PHP] Ouput buffer and vertual()

2004-09-10 Thread John Holmes
From: "Wouter van Vliet" <[EMAIL PROTECTED]>
I think I must add something here - besides the fact that a function
like vertual() doesn't exist - I believe Ivik asked how he could get
around this, still doing something like the virtual but keep buffering
the output.
I don't think you can... virtual() just doesn't allow it. Make the .pl file 
accessible over the web and include/get contents/etc through HTTP if you 
really need it buffered. Or have the .pl file save it's results to another 
file that can be included into the buffer.

---John Holmes... 

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


Re: [PHP] problems setting up php5 on apache2 (WinXP Pro)

2004-09-10 Thread John Holmes
From: "Wouter van Vliet" <[EMAIL PROTECTED]>
Ok, first of all: really, do use linux. It's not THAT bad for a home 
machine ;)

Now, the solution is quite simple as it is documented. Just copy the
file 'libmysql.dll' to your %WINDIR% folder and all should work. If it
doesn't, take libmysqli.dll as well. While you're at it, you might as
well copy all .dll's from the footdir of the zippackage to your
%WINDIR%, windows can't be hurt anymore than it already hurts and
it'll save you some hassle next time you want to enable another
extension.
I believe the installation instructions have been updated so that copying 
files to the windows directories are not recommended or needed anymore. May 
want to consult the manual once again (but Apache not finding libmysql.dll 
is your problem).

---John Holmes... 

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


Re: [PHP] Ouput buffer and vertual()

2004-09-10 Thread Wouter van Vliet
On Fri, 10 Sep 2004 09:24:06 -0400, John Holmes
<[EMAIL PROTECTED]> wrote:
> From: "Ivik Injerd" <[EMAIL PROTECTED]>
> 
> > --- test.php:
> > ob_start();
> > virtual("blah.pl");
> > $tmp = ob_get_contents();
> > echo "\n[ TMP: $tmp ]";
> > ob_end_clean();
> >
> > --- test.php (output):
> > blah
> > [ TMP:  ]
> >
> > Looks like vertual() gets past the output buffer. How can I keep it in the
> > buffer?
> 
> I believe a RTFM is in order here.
> 
> Quote: "To run the sub-request, all buffers are terminated and flushed to
> the browser, pending headers are sent too."
> 
> You can assume the good F or the back F, it's up to you. :)
> 
> ---John Holmes... 
> 
> 

I think I must add something here - besides the fact that a function
like vertual() doesn't exist - I believe Ivik asked how he could get
around this, still doing something like the virtual but keep buffering
the output.

(and well, I'm quite curious for this myself too)

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



Re: [PHP] find quoted string within a string (more of a regex question, though ..)

2004-09-10 Thread Wouter van Vliet
On Fri, 10 Sep 2004 16:41:56 +0300, Robin Vickery <[EMAIL PROTECTED]> wrote:
> On Fri, 10 Sep 2004 11:43:54 +0200, Wouter van Vliet
> <[EMAIL PROTECTED]> wrote:
> >
> > For my own reasons (can explain, would take long, won't till sbody
> > asks) I want to match a quoted string within a string. That is somehow
> > kind of easy, I know ... if it weren't for the slashing of quotes.
> 
> The standard perl regexp for matching double-quote delimited strings is this:
> 
>/"([^"\\]|\\.)*"/
> 
> which copes nicely with escaped characters. You'll probably need to
> double up the backslashes in php.
> 
>   $regex = '/"([^"]|.)*"/';
> 

Strawberryjuice on earth, I was expecting something very easy - but
this beats it all. Changed it a little, for it to also find 
single-quote delimited strings:

/( "([^"\\]|\\.)*" | '([^'\\]|\\.)*' )/x

works like a coconut!

Thanks a lot!
Wouter

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



Re: [PHP] php|works in Toronto - anyone going?

2004-09-10 Thread John Nichel
Aaron Gould wrote:
Just curious if anyone on the list was headed to Toronto on Sep 22-24 
for php|works.  I live about two hours from Toronto, and my company is 
sending me.

I wonder what kind of reception this conference will get...
My company was going to send me, but backed out (money).  I'm in 
Buffalo, so it's right up the road...I may still go and just pay for it 
out of my own pocket.

--
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] problems setting up php5 on apache2 (WinXP Pro)

2004-09-10 Thread Wouter van Vliet
Ok, first of all: really, do use linux. It's not THAT bad for a home machine ;)

Now, the solution is quite simple as it is documented. Just copy the
file 'libmysql.dll' to your %WINDIR% folder and all should work. If it
doesn't, take libmysqli.dll as well. While you're at it, you might as
well copy all .dll's from the footdir of the zippackage to your
%WINDIR%, windows can't be hurt anymore than it already hurts and
it'll save you some hassle next time you want to enable another
extension.

Cheers,
Wouter

On Fri, 10 Sep 2004 09:31:43 -0400, Mathieu Dumoulin
<[EMAIL PROTECTED]> wrote:
> (Don't write to me telling me to use linux, i dont want to, this is my home
> machine not a production server, thank you, now if you really want to help
> keep on reading)
> 
> I got a most recent copy of PHP 5.01 extracted into "C:\php" and everything
> seems to be working fine as long as i dont ask to load extensions. Any
> extension that i try to add will fail to load and i'm clueless.
> 
> At first in the PHP.ini file this was the original directive:
> 
> ; Directory in which the loadable extensions (modules) reside.
> extension_dir = "./"
> 
> And it would not work so i changed it to a hardcoded path
> 
> ; Directory in which the loadable extensions (modules) reside.
> extension_dir = "C:\php\ext"
> 
> Still no extensions wont load. Whats the weirdest, all the DLLs are at the
> correct location, apache reports: "PHP startup: Unable to load dynamic
> library 'C:\php\ext\php_mysql.dll' - The specified module could not be
> found."
> 
> but it IS there, at the exact location, i even looked and compared both
> paths manually letter by letter. Another weird thing to note is that some
> extensions DO load while some don't, here is a list of the extensions that
> i'm loading and which one fails (Note ALL extensions DLL are indeed in the
> folder intended, they just dont load)
> 
> extension=php_bz2.dll
> extension=php_gd2.dll
> extension=php_imap.dll
> extension=php_mysql.dll <<< fails but it's vital to me
> 
> these extensions are activated, only mysql fails, but there are other i
> wanted earlier lemme see which ones: (These would be nice to have, i'll tell
> you which one fails too)
> 
> ;extension=php_exif.dll <<< fails
> ;extension=php_ldap.dll <<< fails (The file really isnt there so it's not a
> real problem)
> ;extension=php_openssl.dll <<< fails
> ;extension=php_pdf.dll
> ;extension=php_pgsql.dll
> ;extension=php_snmp.dll
> ;extension=php_sockets.dll
> ;extension=php_tidy.dll
> ;extension=php_zip.dll
> 
> All of these will load... S I'm stuck there, i need help, tell me if you
> need to know anything else. i'll be glad to give you info, i want to set
> this up to further my PHP developement at home. We intensively use PHP4 at
> work but i wanted to start working on PHP5 to see how good it is.
> 
> Till then
> See ya'll
> TheInsaneCoder
> 
> --
> 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] Ouput buffer and vertual()

2004-09-10 Thread Ivik Injerd
Ok, thanks!
John Holmes wrote:
From: "Ivik Injerd" <[EMAIL PROTECTED]>
--- test.php:
ob_start();
virtual("blah.pl");
$tmp = ob_get_contents();
echo "\n[ TMP: $tmp ]";
ob_end_clean();
--- test.php (output):
blah
[ TMP:  ]
Looks like vertual() gets past the output buffer. How can I keep it in 
the buffer?

I believe a RTFM is in order here.
Quote: "To run the sub-request, all buffers are terminated and flushed 
to the browser, pending headers are sent too."

You can assume the good F or the back F, it's up to you. :)
---John Holmes...
--
Ivik Injerd [ www.zavaboy.com ]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] find quoted string within a string (more of a regex question, though ..)

2004-09-10 Thread Robin Vickery
On Fri, 10 Sep 2004 11:43:54 +0200, Wouter van Vliet
<[EMAIL PROTECTED]> wrote:
> 
> For my own reasons (can explain, would take long, won't till sbody
> asks) I want to match a quoted string within a string. That is somehow
> kind of easy, I know ... if it weren't for the slashing of quotes.

The standard perl regexp for matching double-quote delimited strings is this:

   /"([^"\\]|\\.)*"/

which copes nicely with escaped characters. You'll probably need to
double up the backslashes in php.

  $regex = '/"([^"]|.)*"/';


  -robin

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



[PHP] php|works in Toronto - anyone going?

2004-09-10 Thread Aaron Gould
Just curious if anyone on the list was headed to Toronto on Sep 22-24 
for php|works.  I live about two hours from Toronto, and my company is 
sending me.

I wonder what kind of reception this conference will get...
--
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] how to redirect ?

2004-09-10 Thread John Nichel
CBharadwaj wrote:
Hi
I have used 
Header (Location:PATH)  function  for redirection.
it is giving some errors.
is there any other method other than HEADER() funtion for redirecting ?

Bharadwaj

What are the errors?  Output already started?
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] problems setting up php5 on apache2 (WinXP Pro)

2004-09-10 Thread Mathieu Dumoulin
(Don't write to me telling me to use linux, i dont want to, this is my home
machine not a production server, thank you, now if you really want to help
keep on reading)

I got a most recent copy of PHP 5.01 extracted into "C:\php" and everything
seems to be working fine as long as i dont ask to load extensions. Any
extension that i try to add will fail to load and i'm clueless.

At first in the PHP.ini file this was the original directive:

; Directory in which the loadable extensions (modules) reside.
extension_dir = "./"

And it would not work so i changed it to a hardcoded path

; Directory in which the loadable extensions (modules) reside.
extension_dir = "C:\php\ext"

Still no extensions wont load. Whats the weirdest, all the DLLs are at the
correct location, apache reports: "PHP startup: Unable to load dynamic
library 'C:\php\ext\php_mysql.dll' - The specified module could not be
found."

but it IS there, at the exact location, i even looked and compared both
paths manually letter by letter. Another weird thing to note is that some
extensions DO load while some don't, here is a list of the extensions that
i'm loading and which one fails (Note ALL extensions DLL are indeed in the
folder intended, they just dont load)

extension=php_bz2.dll
extension=php_gd2.dll
extension=php_imap.dll
extension=php_mysql.dll <<< fails but it's vital to me

these extensions are activated, only mysql fails, but there are other i
wanted earlier lemme see which ones: (These would be nice to have, i'll tell
you which one fails too)

;extension=php_exif.dll <<< fails
;extension=php_ldap.dll <<< fails (The file really isnt there so it's not a
real problem)
;extension=php_openssl.dll <<< fails
;extension=php_pdf.dll
;extension=php_pgsql.dll
;extension=php_snmp.dll
;extension=php_sockets.dll
;extension=php_tidy.dll
;extension=php_zip.dll

All of these will load... S I'm stuck there, i need help, tell me if you
need to know anything else. i'll be glad to give you info, i want to set
this up to further my PHP developement at home. We intensively use PHP4 at
work but i wanted to start working on PHP5 to see how good it is.

Till then
See ya'll
TheInsaneCoder

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



Re: [PHP] Ouput buffer and vertual()

2004-09-10 Thread John Holmes
From: "Ivik Injerd" <[EMAIL PROTECTED]>
--- test.php:
ob_start();
virtual("blah.pl");
$tmp = ob_get_contents();
echo "\n[ TMP: $tmp ]";
ob_end_clean();
--- test.php (output):
blah
[ TMP:  ]
Looks like vertual() gets past the output buffer. How can I keep it in the 
buffer?
I believe a RTFM is in order here.
Quote: "To run the sub-request, all buffers are terminated and flushed to 
the browser, pending headers are sent too."

You can assume the good F or the back F, it's up to you. :)
---John Holmes... 

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


Re: [PHP] help-fetching-url-contents

2004-09-10 Thread John Holmes
From: "vijayaraj nagarajan" <[EMAIL PROTECTED]>
i would like to fetch the content of a url.
and then would like to put in my page... dynamically
refreshing it once in a day...
is it possible to do this in php.
i have used perl get url option and then parse the
file, with the date and time function...to do this.
$file = file_get_contents('http://www.domain.com/page.php');
Save $file locally and you have your copy. use cron to run the command once 
per day.

---John Holmes... 

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


Re: [PHP] Getting free space of remote directory

2004-09-10 Thread François Moreau
Hi Benkovich,
Le 04-09-10, à 07:23, Benkovich Mishail a écrit :
I have some paths, for example:
 \\192.168.0.254\C\Windows\SomeDir\  or
ftp://myhost.com/folder/  (login and password I also know)
How I can check writable this dirs or no? - I can try to write 
temporary
file or use touch() funktion.
You may check for writable on directories in an even simpler way using 
is_writeable() :
http://www.php.net/manual/en/function.is-writable.php

But how I can get free space of this remote
catalogue?
disk_free_space() :
http://www.php.net/manual/en/function.disk-free-space.php
Hope this does the trick!


__ 
Misha
ICQ#: 338012800 Current ICQ status: ( Home Tel#: 990161 + More ways to
contact me
__

--
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] Getting free space of remote directory

2004-09-10 Thread Benkovich Mishail
I have some paths, for example:
 \\192.168.0.254\C\Windows\SomeDir\  or
ftp://myhost.com/folder/  (login and password I also know)
How I can check writable this dirs or no? - I can try to write temporary
file or use touch() funktion. But how I can get free space of this remote
catalogue?




__ Misha
ICQ#: 338012800 Current ICQ status: ( Home Tel#: 990161 + More ways to
contact me
__

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



[PHP] Ouput buffer and vertual()

2004-09-10 Thread Ivik Injerd
--- blah.pl:
#!/usr/bin/perl
print "Content-type: text/plain\r\n\r\n";
print "blah";
exit;
--- test.php:
ob_start();
virtual("blah.pl");
$tmp = ob_get_contents();
echo "\n[ TMP: $tmp ]";
ob_end_clean();
--- test.php (output):
blah
[ TMP:  ]
Looks like vertual() gets past the output buffer. How can I keep it in 
the buffer?

Thanks!
--
Ivik Injerd [ www.zavaboy.com ]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: php_printer

2004-09-10 Thread Lester Caine
Lester Caine wrote:
Anybody got php_printer running?
If I give printer_open an invalid printer name, error. Give it a valid 
(shared) printer name, not error, but using the $handle in 
printer_set_option gives an 'invalid printer handle error'

What do I need to do next to check this out?
OK looking further into this I find that 'printer' is no longer present 
on pecl is it being dropped or has it moved elsewhere?

--
Lester Caine
-
L.S.Caine Electronic Services
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Parsing HTML files

2004-09-10 Thread Nick Wilson

* and then Abdul-Wahid Paterson declared
> No easy way of doing it, regex somthing like:
> 
> $id = preg_replace("/.*/", $1, $string);
> 
> where $string is a line from your input'd HTML page

OK, thanks abdul, much appreciated..


-- 
Nick W

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



Re: [PHP] Parsing HTML files

2004-09-10 Thread Abdul-Wahid Paterson
No easy way of doing it, regex somthing like:

$id = preg_replace("/.*/", $1, $string);

where $string is a line from your input'd HTML page

Abdul-Wahid



On Fri, 10 Sep 2004 12:54:37 +0200, Nick Wilson <[EMAIL PROTECTED]> wrote:
> Hi all,
> 
> I was wondering if any classes/functions could help me with this little
> challenge, (im hopeless at regex ;-)
> 
> 
> 
> I want to extract the value of 'id' from a webpage. Any simple way to do
> this or am I down to sweating of the regex functions?
> 
> Much thanks
> --
> Nick W
> 
> --
> 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: how to redirect ?

2004-09-10 Thread Torsten Roehr
>"Cbharadwaj" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>Hi
>
>I have used
>Header (Location:PATH)  function  for redirection.
>it is giving some errors.
>is there any other method other than HEADER() funtion for redirecting ?
>
>
>Bharadwaj

It will work if you specify a *full* URI:

header('location: http://www.yoursite.com/page.php'); exit;

Pay attention to the exit.

Regards, Torsten Roehr

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



[PHP] Parsing HTML files

2004-09-10 Thread Nick Wilson
Hi all, 

I was wondering if any classes/functions could help me with this little
challenge, (im hopeless at regex ;-)



I want to extract the value of 'id' from a webpage. Any simple way to do
this or am I down to sweating of the regex functions?

Much thanks
-- 
Nick W

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



  1   2   >