php-general Digest 20 Jul 2006 04:01:47 -0000 Issue 4248

2006-07-19 Thread php-general-digest-help

php-general Digest 20 Jul 2006 04:01:47 - Issue 4248

Topics (messages 239570 through 239603):

Class ADODB - Method GenID() in MySQL
239570 by: Renne Rocha
239571 by: John Meyer
239573 by: chris smith
239575 by: John Meyer
239578 by: Renne Rocha
239585 by: Lester Caine
239587 by: Lester Caine
239592 by: Brady Mitchell
239602 by: chris smith

Re: pg_query and COPY in transaction
239572 by: David Tulloh
239589 by: Luis Magaña
239591 by: Jochem Maas

Return XML using PHP and Content-Type with UTF-8 breaks the UTF-8
239574 by: Mathijs
239576 by: Ray Hauge

Basic PHP knowledge test
239577 by: John Nichel
239579 by: Ray Hauge
239580 by: Jim Moseby
239581 by: KermodeBear
239582 by: John Nichel
239583 by: John Nichel
239584 by: Ray Hauge
239586 by: Rory Browne
239596 by: tedd
239598 by: tedd

Problem With Cookies
239588 by: Prathaban Mookiah
239595 by: Prathaban Mookiah

Re: GD to database directly
239590 by: Jay Blanchard
239600 by: tedd

Re: Different php.ini files for different apache processes on one server
239593 by: spam.pflaesterer.de (Karl Pflästerer)

Re: forcing a script to run on page unload
239594 by: tedd

Open Source mailinglist?
239597 by: Gustav Wiberg
239599 by: Jay Blanchard
239601 by: Gustav Wiberg

ROZ pdf
239603 by: weetat

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
php-general@lists.php.net


--
---BeginMessage---

 Hello,

 I am using the ADODB class to connect to a MySQL server. I am trying
to generate an ID with the method GenID(), but when I tried this:

 $id = $db-GenID('table');

 The value of $id is equal to zero. I know that MySQL doesn't use
sequences like PostgreSQL does (I've used this code in a PostgreSQL
project), but in the documentation of ADODB I saw that it is possible
to use it. Is there any trick about how to make it work?

 Thanks.

--
Renne Rocha
www.inova.unicamp.br
[EMAIL PROTECTED]
+55 11 8467-9456
---End Message---
---BeginMessage---

Renne Rocha wrote:

 Hello,

 I am using the ADODB class to connect to a MySQL server. I am trying
to generate an ID with the method GenID(), but when I tried this:

 $id = $db-GenID('table');

 The value of $id is equal to zero. I know that MySQL doesn't use
sequences like PostgreSQL does (I've used this code in a PostgreSQL
project), but in the documentation of ADODB I saw that it is possible
to use it. Is there any trick about how to make it work?

 Thanks.


Okay, I'd have to ask at this point what are you using the ID for?  If 
you're generating it for an insert, just put null on the primary key if 
it's auto-increment and MySQL will do it for you.
---End Message---
---BeginMessage---

On 7/19/06, Renne Rocha [EMAIL PROTECTED] wrote:

  Hello,

  I am using the ADODB class to connect to a MySQL server. I am trying
to generate an ID with the method GenID(), but when I tried this:

  $id = $db-GenID('table');

  The value of $id is equal to zero. I know that MySQL doesn't use
sequences like PostgreSQL does (I've used this code in a PostgreSQL
project), but in the documentation of ADODB I saw that it is possible
to use it. Is there any trick about how to make it work?


You'll need to insert a value into the table first, then you can do:

$query = UPDATE tablename SET id=LAST_INSERT_ID(id+1);
$result = mysql_query($query);
$id = mysql_insert_id();

This is in the mysql docs somewhere...

--
Postgresql  php tutorials
http://www.designmagick.com/
---End Message---
---BeginMessage---

Wouldn't this:
$id = mysql_insert_id();
$query = UPDATE tablename SET id= . ($id + 1);
$result = mysql_query($query);
Be a little simpler.
But like I said, I'm confused over the need for this in the first place,
seeing as how an auto_incremented primary key is self-descriptive.  or are
you saving this somewhere else in the DB?



On 7/19/06, chris smith [EMAIL PROTECTED] wrote:


On 7/19/06, Renne Rocha [EMAIL PROTECTED] wrote:
   Hello,

   I am using the ADODB class to connect to a MySQL server. I am trying
 to generate an ID with the method GenID(), but when I tried this:

   $id = $db-GenID('table');

   The value of $id is equal to zero. I know that MySQL doesn't use
 sequences like PostgreSQL does (I've used this code in a PostgreSQL
 project), but in the documentation of ADODB I saw that it is possible
 to use it. Is there any trick about how to make it work?

You'll need to insert a value into the table first, then you can do:

$query = UPDATE tablename SET id=LAST_INSERT_ID(id+1);
$result = mysql_query($query);
$id = mysql_insert_id();

This is in the mysql docs 

[PHP] Re: User defined function problem

2006-07-19 Thread Stephen Lake
Thanx Jon and Jochem for the reminders, they were much appreciated. :)

Best Regards,
Steve


Stephen Lake [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Hey Guys and Gals,

 I am having a small problem with a user defined function, I placed it in a 
 config file and it works as expected, but the problem seems to arise only 
 when I try to use my login script for a members area I am redeveloping.

 The error message that comes up is the following:

 Fatal error: Cannot redeclare clean_sql() (previously declared in 
 C:\Apache2\htdocs\braille\config.php:94) in 
 C:\Apache2\htdocs\braille\config.php on line 108

 The problem is its claiming that I am trying to redeclare the function in 
 the config file when there is only the original function.

 I checked in other area's where this config file is being used and I do 
 not get this error. Nor am I including other files that have the config 
 included in them.

 The problem is only in my login script. If anyone can give me a little 
 insight into this error I would be greatly appreciated.

 Best Regards,
 Steve 

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



[PHP] Class ADODB - Method GenID() in MySQL

2006-07-19 Thread Renne Rocha

 Hello,

 I am using the ADODB class to connect to a MySQL server. I am trying
to generate an ID with the method GenID(), but when I tried this:

 $id = $db-GenID('table');

 The value of $id is equal to zero. I know that MySQL doesn't use
sequences like PostgreSQL does (I've used this code in a PostgreSQL
project), but in the documentation of ADODB I saw that it is possible
to use it. Is there any trick about how to make it work?

 Thanks.

--
Renne Rocha
www.inova.unicamp.br
[EMAIL PROTECTED]
+55 11 8467-9456

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



Re: [PHP] Class ADODB - Method GenID() in MySQL

2006-07-19 Thread John Meyer

Renne Rocha wrote:

 Hello,

 I am using the ADODB class to connect to a MySQL server. I am trying
to generate an ID with the method GenID(), but when I tried this:

 $id = $db-GenID('table');

 The value of $id is equal to zero. I know that MySQL doesn't use
sequences like PostgreSQL does (I've used this code in a PostgreSQL
project), but in the documentation of ADODB I saw that it is possible
to use it. Is there any trick about how to make it work?

 Thanks.


Okay, I'd have to ask at this point what are you using the ID for?  If 
you're generating it for an insert, just put null on the primary key if 
it's auto-increment and MySQL will do it for you.


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



Re: [PHP] pg_query and COPY in transaction

2006-07-19 Thread David Tulloh
Luis Magaña wrote:
 I have the following code:
 
 pg_query($conn,BEGIN TRANSACTION;
   DELETE FROM codigo_postal;
   COPY
 codigo_postal(codigo_postal,asentamiento,tipo_asentamiento,municipio,estado)
 FROM '$tmpfname2' DELIMITER '|';
   COMMIT);
 
 It is suppoused as I understand it, that if an error occurs on the copy
 statement, then the codigo_postal table should still have all of the
 previous records. Actually I've tested it within psql and it works as
 expected.
 
 However, the shown code does not. If an error occurs on the copy
 transaction, the data on the table gets deleted.
 

The above code looks like it should work.  I have done similar stuff in
the past.

A useful trick that you might like to try is that PHP automatically will
automatically wrap a query with multiple parts into a transaction for
you.  I believe it will also do slightly more advanced clean up of the
commit/rollback than the default.  Doing it this way might work better
for you.


David

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



Re: [PHP] Class ADODB - Method GenID() in MySQL

2006-07-19 Thread chris smith

On 7/19/06, Renne Rocha [EMAIL PROTECTED] wrote:

  Hello,

  I am using the ADODB class to connect to a MySQL server. I am trying
to generate an ID with the method GenID(), but when I tried this:

  $id = $db-GenID('table');

  The value of $id is equal to zero. I know that MySQL doesn't use
sequences like PostgreSQL does (I've used this code in a PostgreSQL
project), but in the documentation of ADODB I saw that it is possible
to use it. Is there any trick about how to make it work?


You'll need to insert a value into the table first, then you can do:

$query = UPDATE tablename SET id=LAST_INSERT_ID(id+1);
$result = mysql_query($query);
$id = mysql_insert_id();

This is in the mysql docs somewhere...

--
Postgresql  php tutorials
http://www.designmagick.com/

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



[PHP] Return XML using PHP and Content-Type with UTF-8 breaks the UTF-8

2006-07-19 Thread Mathijs

Hello there,

I Have an problem with UTF-8 and XML.

I Output perfect XML (according to IE, Opera and Firefox).
I use the Content-Type header with text/xml; charset=utf-8.
For some reason this breaks UTF-8 output.
When i remove it it works. But i need the text/xml header.

If i save an document as .xml with the same contents as UTF-8 it works.

Is this a known problem?

Thx in advanced.

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



Re: [PHP] Class ADODB - Method GenID() in MySQL

2006-07-19 Thread John Meyer

Wouldn't this:
$id = mysql_insert_id();
$query = UPDATE tablename SET id= . ($id + 1);
$result = mysql_query($query);
Be a little simpler.
But like I said, I'm confused over the need for this in the first place,
seeing as how an auto_incremented primary key is self-descriptive.  or are
you saving this somewhere else in the DB?



On 7/19/06, chris smith [EMAIL PROTECTED] wrote:


On 7/19/06, Renne Rocha [EMAIL PROTECTED] wrote:
   Hello,

   I am using the ADODB class to connect to a MySQL server. I am trying
 to generate an ID with the method GenID(), but when I tried this:

   $id = $db-GenID('table');

   The value of $id is equal to zero. I know that MySQL doesn't use
 sequences like PostgreSQL does (I've used this code in a PostgreSQL
 project), but in the documentation of ADODB I saw that it is possible
 to use it. Is there any trick about how to make it work?

You'll need to insert a value into the table first, then you can do:

$query = UPDATE tablename SET id=LAST_INSERT_ID(id+1);
$result = mysql_query($query);
$id = mysql_insert_id();

This is in the mysql docs somewhere...

--
Postgresql  php tutorials
http://www.designmagick.com/

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





--
I'm American, fatboy.  What's your excuse?


Re: [PHP] Return XML using PHP and Content-Type with UTF-8 breaks the UTF-8

2006-07-19 Thread Ray Hauge
On Wednesday 19 July 2006 09:27, Mathijs wrote:
 Hello there,

 I Have an problem with UTF-8 and XML.

 I Output perfect XML (according to IE, Opera and Firefox).
 I use the Content-Type header with text/xml; charset=utf-8.
 For some reason this breaks UTF-8 output.
 When i remove it it works. But i need the text/xml header.

 If i save an document as .xml with the same contents as UTF-8 it works.

 Is this a known problem?

 Thx in advanced.

I would try just specifying UTF-8 in the XML header, and remove the charset 
from the content-type header, and just have the text/xml.

?xml version=1.0 encoding=utf-8?

HTH

-- 
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
www.americanstudentloan.com
1.800.575.1099

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



[PHP] Basic PHP knowledge test

2006-07-19 Thread John Nichel
We're looking to hire an entry level php programmer here, and I've been 
tasked with writing the test to evaluate the potential candidates. 
Being the lazy guy that I am, I naturally turned to Google to see if I 
could find some tests that I could use.  After clicking thru many links, 
and finding mostly 'basic php tutorials', I've come here to ask you 
people to do my homework for me.  ;)  Does anyone have any 
links/resources for a basic php knowledge test?  If not, I'll have to 
write one from scratch myself, and mess up the rest of my day of goofing 
off/sleeping.


--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] Class ADODB - Method GenID() in MySQL

2006-07-19 Thread Renne Rocha

 Yes, using the PHP functions for MySQL, it works. But I am using the
abstraction class ADODB to make the queries in my database. Why?
Probably we will change the database system (probably to PostgreSQL)
and we don want to change all the code to make the things work in the
new BD.

 I don't know if anyone have ever used this class before. I am trying
to use the GenID method, because in PostgreSQL we don't have the
auto_increment field type. I made it work (with the Insert_ID method),
but it isn't portable. Does anyone that knows this class can help me?

 Thanks a lot for the replies.

--
Renne Rocha
[EMAIL PROTECTED]
55 11 8467-9456

On 7/19/06, John Meyer [EMAIL PROTECTED] wrote:


Wouldn't this:
$id = mysql_insert_id();
$query = UPDATE tablename SET id= . ($id + 1);
$result = mysql_query($query);
Be a little simpler.
But like I said, I'm confused over the need for this in the first place,
seeing as how an auto_incremented primary key is self-descriptive.  or are
you saving this somewhere else in the DB?



On 7/19/06, chris smith [EMAIL PROTECTED] wrote:

On 7/19/06, Renne Rocha [EMAIL PROTECTED] wrote:
   Hello,

   I am using the ADODB class to connect to a MySQL server. I am trying
 to generate an ID with the method GenID(), but when I tried this:

   $id = $db-GenID('table');

The value of $id is equal to zero. I know that MySQL doesn't use
 sequences like PostgreSQL does (I've used this code in a PostgreSQL
 project), but in the documentation of ADODB I saw that it is possible
 to use it. Is there any trick about how to make it work?

You'll need to insert a value into the table first, then you can do:

$query = UPDATE tablename SET id=LAST_INSERT_ID(id+1);
$result = mysql_query($query);
$id = mysql_insert_id();

This is in the mysql docs somewhere...


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



Re: [PHP] Basic PHP knowledge test

2006-07-19 Thread Ray Hauge
On Wednesday 19 July 2006 10:31, John Nichel wrote:
 We're looking to hire an entry level php programmer here, and I've been
 tasked with writing the test to evaluate the potential candidates.
 Being the lazy guy that I am, I naturally turned to Google to see if I
 could find some tests that I could use.  After clicking thru many links,
 and finding mostly 'basic php tutorials', I've come here to ask you
 people to do my homework for me.  ;)  Does anyone have any
 links/resources for a basic php knowledge test?  If not, I'll have to
 write one from scratch myself, and mess up the rest of my day of goofing
 off/sleeping.

 --
 John C. Nichel IV
 Programmer/System Admin (ÜberGeek)
 Dot Com Holdings of Buffalo
 716.856.9675
 [EMAIL PROTECTED]

I just recently ran into the same problem.  I got tired of trying to find one, 
so I made it myself.  It's very specific to what we do here though.  I'd 
definitely be interested in that info though, because we're still looking, 
and I'm not totally happy with mine, as I didn't have a whole lot of time to 
write it.

-- 
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
www.americanstudentloan.com
1.800.575.1099

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



RE: [PHP] Basic PHP knowledge test

2006-07-19 Thread Jim Moseby
 
 We're looking to hire an entry level php programmer here, and 
 I've been 
 tasked with writing the test to evaluate the potential candidates. 
 Being the lazy guy that I am, I naturally turned to Google to 
 see if I 
 could find some tests that I could use.  After clicking thru 
 many links, 
 and finding mostly 'basic php tutorials', I've come here to ask you 
 people to do my homework for me.  ;)  Does anyone have any 
 links/resources for a basic php knowledge test?  If not, I'll have to 
 write one from scratch myself, and mess up the rest of my day 
 of goofing 
 off/sleeping.

stock answer
STFW!  RTFM!!  STFA!!  STFU!!
/stock answer

Ahem...  Now that that's out of my system, you could start with the Zend
sample exam:

http://www.zend.com/education/certification/self_test

I know you're saying entry level, not Zend certified, but there are some
pretty basic questions there.

JM

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



RE: [PHP] Basic PHP knowledge test

2006-07-19 Thread KermodeBear
 Does anyone have any links/resources for a 
 basic php knowledge test?  If not, I'll have to 
 write one from scratch myself, and mess up the 
 rest of my day of goofing off/sleeping.

It wouldn't hurt to pick up one of those Zend PHP Certification study guides
and pull some things from there. Or, browse the PHP manual for commonly used
functions and ask questions from there. 

What might work better though would be to pull some questions from this
mailing list and ask them how they would answer them. It will give you some
insight into their knowledge of PHP as well as how well they can solve
problems using the language.

That, in my (not so) humble opinion, is better than just knowledge of the
language. You need to know how to apply it to be a decent programmer.

HTH. I would be very interested in seeing what you come up with, actually.
(o:

-K. Bear

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



Re: [PHP] Basic PHP knowledge test

2006-07-19 Thread John Nichel

Jim Moseby wrote:

stock answer
STFW!  RTFM!!  STFA!!  STFU!!
/stock answer


That totally goes against my being lazy.  Hell, I didn't get to where I 
am today by *not* exploiting the 'little people' :-p


--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] Basic PHP knowledge test

2006-07-19 Thread John Nichel

Ray Hauge wrote:

On Wednesday 19 July 2006 10:31, John Nichel wrote:

We're looking to hire an entry level php programmer here, and I've been
tasked with writing the test to evaluate the potential candidates.
Being the lazy guy that I am, I naturally turned to Google to see if I
could find some tests that I could use.  After clicking thru many links,
and finding mostly 'basic php tutorials', I've come here to ask you
people to do my homework for me.  ;)  Does anyone have any
links/resources for a basic php knowledge test?  If not, I'll have to
write one from scratch myself, and mess up the rest of my day of goofing
off/sleeping.



I just recently ran into the same problem.  I got tired of trying to find one, 
so I made it myself.  It's very specific to what we do here though.  I'd 
definitely be interested in that info though, because we're still looking, 
and I'm not totally happy with mine, as I didn't have a whole lot of time to 
write it.




Yeah, reading the writing on the wall, I think I'm just going to have to 
suck it up, and write it.  The worst part of it is, I'm going to have to 
be involved in the interview process, and I'm *not* a people person.  ;)


I think I'll go with a few syntax questions (not really worried about 
that aspect, cause even after 8 years of doing php, I still hit the 
manual a few times a week), maybe have the people write a basic function 
or two to check how clean/readable their code it.  Possibly also test 
how efficient their code would be (like to they call a function inside 
of a loop to get a static value that could have been set outside the 
loop).  Basic db stuff...ugh, I don't feel like doing this.


I'll post what I come up with here; maybe we (this list) can combine 
ideas and such, and actually put together a pretty good test or two so 
we can spare the next poor soul who gets put into this position by MBA 
wielding managers.


--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] Basic PHP knowledge test

2006-07-19 Thread Ray Hauge
On Wednesday 19 July 2006 11:12, John Nichel wrote:
 Yeah, reading the writing on the wall, I think I'm just going to have to
 suck it up, and write it.  The worst part of it is, I'm going to have to
 be involved in the interview process, and I'm *not* a people person.  ;)

 I think I'll go with a few syntax questions (not really worried about
 that aspect, cause even after 8 years of doing php, I still hit the
 manual a few times a week), maybe have the people write a basic function
 or two to check how clean/readable their code it.  Possibly also test
 how efficient their code would be (like to they call a function inside
 of a loop to get a static value that could have been set outside the
 loop).  Basic db stuff...ugh, I don't feel like doing this.

 I'll post what I come up with here; maybe we (this list) can combine
 ideas and such, and actually put together a pretty good test or two so
 we can spare the next poor soul who gets put into this position by MBA
 wielding managers.

That's pretty much what I did.  I went with questions that would show how much 
they understand from a conceptual level.  I don't know many people who don't 
have www.php.net as a bookmark.  I did basic questions to show they 
understood OOP, recursion, pass-by-reference, etc.

I also had to be in the interview.  There were a lot of odd moments of silence 
when people were looking at me to ask some questions.  I just wanted him to 
do the quiz and that was pretty much it ;)

-- 
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
www.americanstudentloan.com
1.800.575.1099

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



Re: [PHP] Class ADODB - Method GenID() in MySQL

2006-07-19 Thread Lester Caine

Renne Rocha wrote:


 Yes, using the PHP functions for MySQL, it works. But I am using the
abstraction class ADODB to make the queries in my database. Why?
Probably we will change the database system (probably to PostgreSQL)
and we don want to change all the code to make the things work in the
new BD.


ADOdb will emulate SEQUENCES using what is available in the database 
engine. Firebird uses Generators - MySQL it generates a table of values. 
So which ever engine you use, GenID should give you the next values for 
the SEQUENCE you asked for.



 I don't know if anyone have ever used this class before. I am trying
to use the GenID method, because in PostgreSQL we don't have the
auto_increment field type. I made it work (with the Insert_ID method),
but it isn't portable. Does anyone that knows this class can help me?


GenID is not needed to be linked to an AUTO field. In fact it's much 
better NOT to make the field AUTO, and use the SEQUENCE value instead. 
That way you can create an ID and use it in several tables.


MySQL driver may have the option switched off - check $hasGenID setting.

Main thing is that the name of the SEQUENCE should not be the same as a 
table name for easier understanding.


--
Lester Caine - G8HFL
-
L.S.Caine Electronic Services - http://home.lsces.co.uk
Model Engineers Digital Workshop - 
http://home.lsces.co.uk/ModelEngineersDigitalWorkshop/

Treasurer - Firebird Foundation Inc. - http://www.firebirdsql.org/index.php

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



Re: [PHP] Basic PHP knowledge test

2006-07-19 Thread Rory Browne

On 7/19/06, KermodeBear [EMAIL PROTECTED] wrote:


 Does anyone have any links/resources for a
 basic php knowledge test?  If not, I'll have to
 write one from scratch myself, and mess up the
 rest of my day of goofing off/sleeping.

It wouldn't hurt to pick up one of those Zend PHP Certification study
guides
and pull some things from there. Or, browse the PHP manual for commonly
used
functions and ask questions from there.



Assuming that doing so was either Fair use or authorised by Zend, and that
you aren't going to get your ass sued for copyright violation - then again
maybe on a small enough scale.



What might work better though would be to pull some questions from this

mailing list and ask them how they would answer them. It will give you
some
insight into their knowledge of PHP as well as how well they can solve
problems using the language.




To an extent. I personally think the best way is to outline a set of
situations and have them write scripts to solve that problem. You need to
know that they have both the knowledge and language to solve a problem. It
doesn't really matter if they know the syntax of strpos, if they know other
methods of solving their potential problems.

Perhaps a CSV to MySQL converter - although not exactly that, because I've
mentioned it on the list :p


That, in my (not so) humble opinion, is better than just knowledge of the

language. You need to know how to apply it to be a decent programmer.

HTH. I would be very interested in seeing what you come up with, actually.
(o:



After the person sitting the exam has passed their test.


-K. Bear


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




Re: [PHP] Class ADODB - Method GenID() in MySQL

2006-07-19 Thread Lester Caine

Renne Rocha wrote:


 Yes, using the PHP functions for MySQL, it works. But I am using the
abstraction class ADODB to make the queries in my database. Why?
Probably we will change the database system (probably to PostgreSQL)
and we don want to change all the code to make the things work in the
new BD.


ADOdb will emulate SEQUENCES using what is available in the database 
engine. Firebird uses Generators - MySQL it generates a table of values. 
So which ever engine you use, GenID should give you the next values for 
the SEQUENCE you asked for.



 I don't know if anyone have ever used this class before. I am trying
to use the GenID method, because in PostgreSQL we don't have the
auto_increment field type. I made it work (with the Insert_ID method),
but it isn't portable. Does anyone that knows this class can help me?


GenID is not needed to be linked to an AUTO field. In fact it's much 
better NOT to make the field AUTO, and use the SEQUENCE value instead. 
That way you can create an ID and use it in several tables.


MySQL driver may have the option switched off - check $hasGenID setting.

Main thing is that the name of the SEQUENCE should not be the same as a 
table name for easier understanding.


--
Lester Caine - G8HFL
-
L.S.Caine Electronic Services - http://home.lsces.co.uk
Model Engineers Digital Workshop - 
http://home.lsces.co.uk/ModelEngineersDigitalWorkshop/

Treasurer - Firebird Foundation Inc. - http://www.firebirdsql.org/index.php

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



[PHP] Problem With Cookies

2006-07-19 Thread Prathaban Mookiah

I have run into a wierd problem with cookies. I am trying to set a cookie as 
usual:

$COOKIE_EXPIRES = 3600;
$COOKIE_VALID_PATH = /mydirectory/;
$COOKIE_DOMAIN = .myhost.com

setcookie(mycookie1, somevalue, time()+$COOKIE_EXPIRES, 
$COOKIE_VALID_PATH, $COOKIE_DOMAIN, 0)

I want this cookie to be valid only for the directory /mydirectory in the 
server www.myhost.com. i.e. only for http://www.myhost.com/mydirectory/

The problem is that it works fine with IE 5.5  Opera 8.5  Firefox 1.5. But 
the cookies are not being accepted by IE 6  Opera 9.0. 

And this is the header I captured through ethreal:

Set-Cookie: mycookie1=somevalue; expires=Wed,19-Jul-2006 17:08:59 GMT; path=/
mydirectory/; domain=.myhost.com\r\n

I am sure I am not doing something totally wrong because it works well with 
some versions. Are there any known issues with the later versions of IE and 
Opera.

Thanks in advance.

Prathap

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



Re: [PHP] pg_query and COPY in transaction

2006-07-19 Thread Luis Magaña
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I've found the problem and this is not a PHP issue with the pg_query
function at all.

It turned out the COPY command was executing properly since the
specified file for copying records was empty, therefore the COPY was not
issuing any error as it should be.

Thank you for the help.

Jochem Maas wrote:
 Luis Magaña wrote:
 It is a PHP question because the Postgres querys do work, I ran them
 directly on the postgres server and there is no problem, but if you use
 pg_query then it does not work, and pg_query is a PHP function, is it no t?

 Any way, I've tried already giving each query in separate function
 calls, and it does not work either. As the rollback you suggest, I
 haven't tried that since it is suppoused to be automatic. So I will try
 that and it might work but that does not change the fact that the
 pg_query function is not doing what the manual says it should do, or at
 least does not beheave as expected.
 
 so it seems that you _may_ have a bug. what version of php are you using?
 and do pg_last_error() and/or pg_last_notice() offer any useful info?
 
 (having read the pg_*() docs somewhat I can only - ouch! makes firebird
 look even simpler than it is already)
 
 I don't know what the COPY syntax in your SQL does exactly but have you looked
 at pg_copy_from() and pg_copy_to() ?
 
 thank you very much for your help.

 regards.

 Jochem Maas wrote:
 Luis Magaña wrote:
 I have the following code:

 pg_query($conn,BEGIN TRANSACTION;
   DELETE FROM codigo_postal;
   COPY
 codigo_postal(codigo_postal,asentamiento,tipo_asentamiento,municipio,estado)
 FROM '$tmpfname2' DELIMITER '|';
   COMMIT);

 It is suppoused as I understand it, that if an error occurs on the copy
 statement, then the codigo_postal table should still have all of the
 previous records. Actually I've tested it within psql and it works as
 expected.

 However, the shown code does not. If an error occurs on the copy
 transaction, the data on the table gets deleted.
 wrapping an SQL question in a php function doesn't make it a php question. 
 ;-)

 $apps = array(apache, mysql, windows); $i = 0;
 while ($i++  100) printf(how do I install %s?\n, $apps[ rand(0,2) ]);

 // I ran that code for a laugh a number of times - seems to a bias towards
 // asking how to install windows... go figure on a php list.

 I'm certainly lost on this one, is it a bug ?, am I doing something
 wrong ? (most likely I guess)
 you are wrong. there is no ROLLBACK specified. I suggest you
 do the queries one by one (i.e. one call to pg_query() for each statement)
 and if the 'COPY' fails call a 'ROLLBACK'

 disclaimer: I know nothing about PG as such - I mostly use Firebird;

 Any help will be apprecciated.

 PHP: 5.1.2
 PostgreSQL: 8.1.4
 Apache: 2.0.55
 Debian Linux with Kernel 2.6.16


 

- --
Luis Magaña
Gnovus Networks  Software
www.gnovus.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (Darwin)

iD8DBQFEvmTQ+QIHCUdTm7sRAib8AKCcdlpR+cv4eMQRNEVJRTRiLycW5QCeNx1d
HsJ2PvsiKOQ1PLN+92JmnrA=
=KEzZ
-END PGP SIGNATURE-

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



RE: [PHP] GD to database directly

2006-07-19 Thread Jay Blanchard
[snip]
... some research ...
[/snip]

So, am I to assume that this issue about storing images in databases is
dead? 

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



Re: [PHP] pg_query and COPY in transaction

2006-07-19 Thread Jochem Maas
Luis Magaña wrote:
 I've found the problem and this is not a PHP issue with the pg_query
 function at all.
 
 It turned out the COPY command was executing properly since the
 specified file for copying records was empty, therefore the COPY was not
 issuing any error as it should be.

LOL. It's always in the last place you look. :-)

 
 Thank you for the help.

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



RE: [PHP] Class ADODB - Method GenID() in MySQL

2006-07-19 Thread Brady Mitchell
 -Original Message-
   I am using the ADODB class to connect to a MySQL server. I am trying
 to generate an ID with the method GenID(), but when I tried this:
 
   $id = $db-GenID('table');
 
   The value of $id is equal to zero. I know that MySQL doesn't use
 sequences like PostgreSQL does (I've used this code in a PostgreSQL
 project), but in the documentation of ADODB I saw that it is possible
 to use it. Is there any trick about how to make it work?

From the ADOdb Manual:   GenID() will automatically create the sequence
for you if it does not exist (provided the userid has permission to do
so).

Does the MySQL user have permission to create tables?  Since ADOdb fakes
sequences by creating a table, that could be a problem.

Brady

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



[PHP] Re: Different php.ini files for different apache processes on one server

2006-07-19 Thread spam
On 19 Jul 2006, [EMAIL PROTECTED] wrote:

 You could chroot each apache instance but I would probably try to modify
 the apache module to accept a parameter (and in the process verify that
 one does not already exist).

Thanks to all for the answers.  As the solution has to work with Apache 1
I can't use the PHPIniDir directive.  One poster suggested to try to set
the PHPRC env variable.  That seems to be the easiest approach since all
Apache instances get started with a different shell script.

   KP

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



Re: [PHP] forcing a script to run on page unload

2006-07-19 Thread tedd
At 9:32 PM -0700 7/18/06, jekillen wrote:
Hi:
I have a web application that creates files and directories to save info
for a user. If the user decides to link to another page or site altogether
I want to run a script that will clean up after him or her but won't
interfere with where they are going. It will eventually expand
to asking the user if he or she wants to save the info for a return
visit. If they don't want to save it has to clean up after them
and if they do it goes through the process of tagging and
saving the info on the server.
My strategy is to run a spontaneous form submission with the
body onunload event. Then run the script and exit. I seem to
remember a way to force a script to run and I've seen that
in a site that I visit occasionally. Even if I quit the browser
it still manages to delay the exit of the browser. But I don't
remember whether it was one of my books on php or the php
manual that this is in.
Can someone point me in the right direction?
Thanks in advance:
JK

JK:

I got something to work. It may be an overkill, or perhaps someone has a 
simpler solution, but I took a bit of ajax and mixed it with an onUnload event 
and it ran a php app after a browser exited my site.

If you want to see the code, contact me privately and I'll provide.

hth's

tedd
-- 

http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Problem With Cookies

2006-07-19 Thread Prathaban Mookiah
This is with regard to my earlier mail today morning.

In fact I found out that, that problem is due to the way the timestamp is 
handled.

Are there any safe ways to handle cookie expiry time regardless of the time 
system the client uses?

Prathap


-- Original Message ---
From: Prathaban Mookiah [EMAIL PROTECTED]
To: PHP Mailing Lists php-general@lists.php.net
Sent: Wed, 19 Jul 2006 23:01:29 +0600
Subject: [PHP] Problem With Cookies

 I have run into a wierd problem with cookies. I am trying to set a 
 cookie as usual:
 
 $COOKIE_EXPIRES = 3600;
 $COOKIE_VALID_PATH = /mydirectory/;
 $COOKIE_DOMAIN = .myhost.com
 
 setcookie(mycookie1, somevalue, time()+$COOKIE_EXPIRES, 
 $COOKIE_VALID_PATH, $COOKIE_DOMAIN, 0)
 
 I want this cookie to be valid only for the directory /mydirectory 
 in the server www.myhost.com. i.e. only for http://www.myhost.com/
mydirectory/
 
 The problem is that it works fine with IE 5.5  Opera 8.5  Firefox 
 1.5. But the cookies are not being accepted by IE 6  Opera 9.0.
 
 And this is the header I captured through ethreal:
 
 Set-Cookie: mycookie1=somevalue; expires=Wed,19-Jul-2006 17:08:59 
 GMT; path=/ mydirectory/; domain=.myhost.com\r\n
 
 I am sure I am not doing something totally wrong because it works 
 well with some versions. Are there any known issues with the later 
 versions of IE and Opera.
 
 Thanks in advance.
 
 Prathap
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
--- End of Original Message ---

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



Re: [PHP] Basic PHP knowledge test

2006-07-19 Thread tedd
At 12:12 PM -0400 7/19/06, John Nichel wrote:
The worst part of it is, I'm going to have to be involved in the interview 
process, and I'm *not* a people person.  ;)

Really, who would have guessed that? ;)

tedd
-- 

http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] Open Source mailinglist?

2006-07-19 Thread Gustav Wiberg

Hi there!

I hope you don't kill me out there, but I'm totally out of luck here. I've 
been doing some research on Open Source questions because I want a product 
of mine to become better in any ways (yes, it's written in PHP and yes, it's 
Open Source). Because of not doing advertising here, I'll skip the name :-)


I can't seem to find any place on the net where you can discuss Open 
Source-related questions in general???


Best regards
/Gustav Wiberg 


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



Re: [PHP] Basic PHP knowledge test

2006-07-19 Thread tedd
At 11:31 AM -0400 7/19/06, John Nichel wrote:
We're looking to hire an entry level php programmer here, and I've been tasked 
with writing the test to evaluate the potential candidates. Being the lazy guy 
that I am, I naturally turned to Google to see if I could find some tests that 
I could use.  After clicking thru many links, and finding mostly 'basic php 
tutorials', I've come here to ask you people to do my homework for me.  ;)  
Does anyone have any links/resources for a basic php knowledge test?  If not, 
I'll have to write one from scratch myself, and mess up the rest of my day of 
goofing off/sleeping.

Why is hr typically so limited in creativity? Do you want someone who can read 
and regurgitate the manual or do you want someone who can get the job done?

My advice, give the candidates problems and see how they solve them. Even if 
they don't finish, you get an idea of how they think.

tedd
-- 

http://sperling.com  http://ancientstones.com  http://earthstones.com

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



RE: [PHP] Open Source mailinglist?

2006-07-19 Thread Jay Blanchard
[snip]
I hope you don't kill me out there, but I'm totally out of luck here.
I've 
been doing some research on Open Source questions because I want a
product 
of mine to become better in any ways (yes, it's written in PHP and yes,
it's 
Open Source). Because of not doing advertising here, I'll skip the name
:-)

I can't seem to find any place on the net where you can discuss Open 
Source-related questions in general???
[/snip]

Don't Sourceforge and Freshmeat have lists?

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



RE: [PHP] GD to database directly

2006-07-19 Thread tedd
At 12:36 PM -0500 7/19/06, Jay Blanchard wrote:
[snip]
... some research ...
[/snip]

So, am I to assume that this issue about storing images in databases is
dead?

Yes, it was dead before it started, as it was the last time this issue was 
discussed.

Simply put, there are tradeoffs, but both sides are so entrenched in their 
beliefs that they find it difficult to acknowledge that.

So, as I did, try both and figure out what works for you.

tedd
-- 

http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Open Source mailinglist?

2006-07-19 Thread Gustav Wiberg


[snip]
I hope you don't kill me out there, but I'm totally out of luck here.
I've
been doing some research on Open Source questions because I want a
product
of mine to become better in any ways (yes, it's written in PHP and yes,
it's
Open Source). Because of not doing advertising here, I'll skip the name
:-)

I can't seem to find any place on the net where you can discuss Open
Source-related questions in general???
[/snip]

Don't Sourceforge and Freshmeat have lists?

I've checked there, but I just find newsletters. At freshmeat I found some 
chat-function located at IRC, and I don't want to install IRC.

, but no mailinglists...
(or else I'm blind)

Best regards
/Gustav Wiberg 


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



Re: [PHP] Class ADODB - Method GenID() in MySQL

2006-07-19 Thread Chris

John Meyer wrote:

Wouldn't this:
$id = mysql_insert_id();
$query = UPDATE tablename SET id= . ($id + 1);
$result = mysql_query($query);
Be a little simpler.
But like I said, I'm confused over the need for this in the first place, 
seeing as how an auto_incremented primary key is self-descriptive.  or 
are you saving this somewhere else in the DB?


Using it elsewhere in the db as a foreign key..

;)

--
Postgresql  php tutorials
http://www.designmagick.com/

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



[PHP] ROZ pdf

2006-07-19 Thread weetat

Hi all,

 I am using EZpdf class to create pdf in mysql database . The Ezpdf 
class is open source tool for auto-creation of pdf in php , the link is 
http://sourceforge.net/projects/pdf-php


I have the problem with tool , the pdf page is blank , eventhough have 
some data in my MySQL database .


Anybody have been using the ROS tool successfully , please give me some 
guidance what that i have done wrong . Thanks


Below is the code:


error_reporting(E_ALL);
require_once('../library/sql.php');
require_once('../library/class.ezpdf.php');

$pdf = new Cezpdf();
$pdf-selectFont('../fonts/Helvetica');

$_db = dbconnect();
$result = $_db-queryDB(Select user_name from tbl_user);
$data = array();

while ($row = $result-fetchRow(DB_FETCHMODE_ASSOC)) {
 $data [] = $row['user_name'];
}


$pdf-ezTable($data);
echo print_r($pdf);

if (isset($d)  $d) {
  $pdfcode = $pdf-output(1);
  $pdfcode = str_replace(\n, \nbr, htmlspecialchars($pdfcode));
  echo 'htmlbody';
  echo trim($pdfcode);
  echo '/body/html';
} else {
  $pdf-stream();
}

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



Re: [PHP] ROZ pdf

2006-07-19 Thread Chris

weetat wrote:

Hi all,

 I am using EZpdf class to create pdf in mysql database . The Ezpdf 
class is open source tool for auto-creation of pdf in php , the link is 
http://sourceforge.net/projects/pdf-php


I have the problem with tool , the pdf page is blank , eventhough have 
some data in my MySQL database .


Ask on their forums.

http://sourceforge.net/forum/?group_id=45168

We don't know the code so have no idea what's going on.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



RE: [PHP] Open Source mailinglist?

2006-07-19 Thread Paul Scott

On Wed, 2006-07-19 at 17:03 -0500, Jay Blanchard wrote:
 I can't seem to find any place on the net where you can discuss Open 
 Source-related questions in general???
 [/snip]
 
 Don't Sourceforge and Freshmeat have lists?
 

You could also join your local LUG, or a site like http://fsiu.uwc.ac.za
which is focused on PHP, Free Software and capacity building in Africa.
http://avoir.uwc.ac.za is similar, although tending more towards the
capacity and skills building side of things.

There are/should be mailing lists for most open projects that people
really don't mind you lurking on. Choose one and have some fun.

--Paul

All Email originating from UWC is covered by disclaimer  
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

[PHP] doubt - session file size

2006-07-19 Thread suresh kumar
Hi,
 I am having one doubt,i am using session variable for storing details.but 
i am afraid if there is around 1 users,wherether session will be able to 
store all the  datas of 1 users,as i know  abt session is that a temporary 
file will be created in /tmp directory with session id name,i dont know how 
much data that the session file will handle.
   
A.suresh


-
 Find out what India is talking about on Yahoo! Answers India.
 Send FREE SMS from New Yahoo! Messenger to Mobile: Download NOW!