php-general Digest 10 Feb 2006 09:47:46 -0000 Issue 3955

2006-02-10 Thread php-general-digest-help

php-general Digest 10 Feb 2006 09:47:46 - Issue 3955

Topics (messages 230179 through 230189):

problem with code between 4.3.4rc1  upgrading to php 4.4.2
230179 by: Brent
230181 by: Curt Zirzow

Limitation on PEAR : Spreadsheet_Excel_Writer
230180 by: Bagus Nugroho

TMP directory
230182 by: Miguel Guirao
230183 by: Chris

Re: Sending error_log to screen
230184 by: Reuben D. Budiardja

Clone of the concurrent users limit of Zend Encoder 4.0 ?
230185 by: HoWang Wang

static variables
230186 by: suresh kumar
230187 by: Hugh Danaher

vaidation and mail function question
230188 by: Paul Goepfert
230189 by: Weber Sites LTD

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,
About 2 years ago i setup   Apache/1.3.28 (Unix) PHP/4.3.4RC1
mod_ssl/2.8.15 OpenSSL/0.9.7c  and mysql on BSD Unix and did up some
simple php enabled web pages to add / remove /edit / search  entries to
a 1 table mysql database to keep track of abuse complaints for my company.

This week Ive had to migrate all this to new Solaris 10 box which i
installed Apache/1.3.34 (Unix) PHP/4.4.2 mod_ssl/2.8.25 OpenSSL/0.9.8a
with mysql .  The problem im have is that when i go to search for an
entry through the web interface...it pulls ALL entries in the database
and displays them instead of the ones im searching for.  When i go to
add an entry ...it actually enters a entry to mysql ...but its empty. 
If i try to do an edit on an existing entry ...the form doesnt pull the
existing entries from the database to be edited...Im thinking its
probably something with my syntax that im using is no longer valid with
the new versions of php4. Does anyone have any thoughts or suggestions
??   I can submit some of the code for everyone to look at  ..  Any help
is greatly appreciated

-- 
--
Brent 
---End Message---
---BeginMessage---
On Thu, Feb 09, 2006 at 04:04:49PM -0500, Brent wrote:
 Hello,
 About 2 years ago i setup   Apache/1.3.28 (Unix) PHP/4.3.4RC1
 mod_ssl/2.8.15 OpenSSL/0.9.7c  and mysql on BSD Unix and did up some
 simple php enabled web pages to add / remove /edit / search  entries to
 a 1 table mysql database to keep track of abuse complaints for my company.
 
 This week Ive had to migrate all this to new Solaris 10 box which i
 installed Apache/1.3.34 (Unix) PHP/4.4.2 mod_ssl/2.8.25 OpenSSL/0.9.8a
 ...
 ??   I can submit some of the code for everyone to look at  ..  Any help
 is greatly appreciated

This sounds like the old version had register_globals [1] set to on.
You'll want to change your code [2] so it works with it off, like:

  $_GET['variable']; or
  $_POST['variable'];

It is strongly advisable to keep it off.

[1] http://php.net/register_globals
[2] http://php.net/language.variables.predefined

Curt.
-- 
cat .signature: No such file or directory
---End Message---
---BeginMessage---
Hello Everyone,
 
I'm succesfully generate report from mysql table using PEAR :
Spreadsheet_Excel_Writer, but I have problem to generate from table
which contain long text, the text is not download completely.
such as  blablabla.
it only contain  blab
 
How can manipulate PEAR, to get full text on excel sheet.
 
Thanks in advance
Bgs
---End Message---
---BeginMessage---


Hello list,

Does anybody know which is the TMP default directory when uploading file to
the server using PHP?

PHP 7.1.2-7
MySQL 3.23.49-3
APACHE 1.3.23-11
RED HAT LINUX 7.3

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


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

This message is for the sole use of the person or entity to whom it is being 
sent.  Therefore, it contains strictly confidential and legally protected 
material whose disclosure is subject to penalty by law.  If the person reading 
this message is not the one to whom it is being sent and/or is not an employee 
or the responsible agent for this information, 

RE: [PHP] vaidation and mail function question

2006-02-10 Thread Weber Sites LTD
You may want to have a look at : 

Power Form Validation
http://www.weberdev.com/get_example-4248.html
 
Sincerely 
 
berber 
 
Visit the Weber Sites Today, 
To see where PHP might take you tomorrow. 
PHP  MySQL Forums : http://www.weberforums.com
Learn PHP  MySQL Playing Trivia : http://www.webertrivia.com


-Original Message-
From: Paul Goepfert [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 10, 2006 9:49 AM
To: php-general@lists.php.net
Subject: [PHP] vaidation and mail function question

I am beginnging to do vaidation on my web form and I know of a few functions
to do this with.  For example the empty fuction and the is_ functions.  Ok
to give you a picture of what I am vaildating its just your basic form,
Name, Address, Email.  I am obviously going to check for empty fields.
However I do want better error checking other then testing for emptty
fields.  Can anyone help me with that?

After this form is finished vaildating I am going to be sending an
email of the contents of the form to an email account.   I have seen
in other messages on this board about the mail function.   I'm not
sure about this but I think I read that in order for the mail function to
work the webserver needs sendmail to make the mail function work. 
Is this true?  I have looked at the phpinfo page on the targeted webserver
and the sendmail value is missing.  I assume that is ok because the
webserver is on a windows system rather then a unix system. I just want to
be sure about this.

Thanks

Paul

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

2006-02-10 Thread Jochem Maas

Oracle buying Zend helps the general population?:

http://www.theregister.co.uk/2006/02/10/oracle_opens_source_acquisition/

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



[PHP] Newbie Question Can't insert values into MySQL DB via PHP

2006-02-10 Thread Duggles Temple
Hi,

I'd like to say in advance that I am sorry about the silly and very newbie
question I'm asking.

I am having a problem with a shop system. I can't add values into the MySQL
DB via a PHP statement. The values are being transferred from one page to
another (know that from the echo statement), but the SQL statement isn't
working.

The statement is as follows:

$conn = mysql_connect($DBhost,$DBuser,$DBpass) or die('Unable to connect to
database');
$t = $_GET['newdvdtitle'];
$y = $_GET['newdvdyear'];
$c = $_GET['newdvdcost'];
$p = $_GET['newdvdpurchased'];
@mysql_select_db($DBName) or die(Unable to select database $DBName);
$sqladd = INSERT INTO 'dvd' ('id', 'title', 'year','cost','purchased')
VALUES (  NULL , '$t', '$y', '$c' , '$p' );
echo $sqladd;
$result = mysql_query($sqladd);


The information is sent from another page which has the following values:


form name=add method=get action=addvalue.php

?php
echo 'tabletrtdInsert a DVD/td/tr';
echo 'trtdinput type=text name=newdvdtitle DVD name/td/tr';
echo 'trtdinput type=text name=newdvdyear DVD year/td/tr';
echo 'trtdinput type=text name=newdvdcost DVD cost/td/tr';
echo 'trtdinput type=text name=newdvdpurchased DVD date
purchased/td/tr';
echo 'trtdinput type=submit value=Insert new dvd/td/tr';
echo '/table';
?
/form


Thanks in advance,

Douglas


[PHP] Re: Newbie Question Can't insert values into MySQL DB via PHP

2006-02-10 Thread Barry

Duggles Temple wrote:

Hi,

I'd like to say in advance that I am sorry about the silly and very newbie
question I'm asking.

I am having a problem with a shop system. I can't add values into the MySQL
DB via a PHP statement. The values are being transferred from one page to
another (know that from the echo statement), but the SQL statement isn't
working.



What error do you get?



The statement is as follows:

$conn = mysql_connect($DBhost,$DBuser,$DBpass) or die('Unable to connect to
database');
$t = $_GET['newdvdtitle'];
$y = $_GET['newdvdyear'];
$c = $_GET['newdvdcost'];
$p = $_GET['newdvdpurchased'];
@mysql_select_db($DBName) or die(Unable to select database $DBName);
$sqladd = INSERT INTO 'dvd' ('id', 'title', 'year','cost','purchased')
VALUES (  NULL , '$t', '$y', '$c' , '$p' );
echo $sqladd;
$result = mysql_query($sqladd);


Insert Into dvd (title, year,cost,purchased)

When the id is auto_increment you dont have to add it to the query.
Barry


--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



RE: [PHP] Re: Newbie Question Can't insert values into MySQL DB via PHP

2006-02-10 Thread Dan Parry
Also when specifying the field list (and table name) it may be a better idea
to wrap the values in backticks (`) rather than quotes (')

Always works for me

Dan

-Original Message-
From: Barry [mailto:[EMAIL PROTECTED] 
Sent: 10 February 2006 10:31
To: php-general@lists.php.net
Subject: [PHP] Re: Newbie Question Can't insert values into MySQL DB via
PHP

Duggles Temple wrote:
 Hi,
 
 I'd like to say in advance that I am sorry about the silly and very newbie
 question I'm asking.
 
 I am having a problem with a shop system. I can't add values into the
MySQL
 DB via a PHP statement. The values are being transferred from one page to
 another (know that from the echo statement), but the SQL statement isn't
 working.
 

What error do you get?


 The statement is as follows:
 
 $conn = mysql_connect($DBhost,$DBuser,$DBpass) or die('Unable to connect
to
 database');
 $t = $_GET['newdvdtitle'];
 $y = $_GET['newdvdyear'];
 $c = $_GET['newdvdcost'];
 $p = $_GET['newdvdpurchased'];
 @mysql_select_db($DBName) or die(Unable to select database $DBName);
 $sqladd = INSERT INTO 'dvd' ('id', 'title', 'year','cost','purchased')
 VALUES (  NULL , '$t', '$y', '$c' , '$p' );
 echo $sqladd;
 $result = mysql_query($sqladd);

Insert Into dvd (title, year,cost,purchased)

When the id is auto_increment you dont have to add it to the query.
Barry


-- 
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

-- 
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] Newbie Question Can't insert values into MySQL DB via PHP

2006-02-10 Thread Jochem Maas

Duggles Temple wrote:

Hi,

I'd like to say in advance that I am sorry about the silly and very newbie
question I'm asking.


don't be - life's too short.



I am having a problem with a shop system. I can't add values into the MySQL
DB via a PHP statement. The values are being transferred from one page to
another (know that from the echo statement), but the SQL statement isn't


we generally call this submitting/posting. although it seems that technically 
your
using the GET mechanism. passing variables from one page to another can be 
construed
as meaning something quite different.


working.

The statement is as follows:

$conn = mysql_connect($DBhost,$DBuser,$DBpass) or die('Unable to connect to
database');
$t = $_GET['newdvdtitle'];
$y = $_GET['newdvdyear'];
$c = $_GET['newdvdcost'];
$p = $_GET['newdvdpurchased'];
@mysql_select_db($DBName) or die(Unable to select database $DBName);
$sqladd = INSERT INTO 'dvd' ('id', 'title', 'year','cost','purchased')
VALUES (  NULL , '$t', '$y', '$c' , '$p' );
echo $sqladd;


using echo to find out whats' in your variable is a good start, also
take a look a print_r() and var_dump() - they given more feedback regarding
passed in vars.

it would have been useful if you had actually posted the output of the
echo statement.


$result = mysql_query($sqladd);


try adding something like:

if (!$result) {
die(mysql_errno($conn) . :  . mysql_error($conn) . \n)
}




The information is sent from another page which has the following values:


form name=add method=get action=addvalue.php

?php
echo 'tabletrtdInsert a DVD/td/tr';
echo 'trtdinput type=text name=newdvdtitle DVD name/td/tr';
echo 'trtdinput type=text name=newdvdyear DVD year/td/tr';
echo 'trtdinput type=text name=newdvdcost DVD cost/td/tr';
echo 'trtdinput type=text name=newdvdpurchased DVD date
purchased/td/tr';
echo 'trtdinput type=submit value=Insert new dvd/td/tr';
echo '/table';
?
/form


Thanks in advance,

Douglas



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



Re: [PHP] Newbie Question Can't insert values into MySQL DB via PHP

2006-02-10 Thread Tom Rogers
Hi,

Friday, February 10, 2006, 8:16:41 PM, you wrote:
DT Hi,

DT I'd like to say in advance that I am sorry about the silly and very newbie
DT question I'm asking.

DT I am having a problem with a shop system. I can't add values into the MySQL
DT DB via a PHP statement. The values are being transferred from one page to
DT another (know that from the echo statement), but the SQL statement isn't
DT working.

DT The statement is as follows:

DT $conn = mysql_connect($DBhost,$DBuser,$DBpass) or die('Unable to connect to
DT database');
DT $t = $_GET['newdvdtitle'];
DT $y = $_GET['newdvdyear'];
DT $c = $_GET['newdvdcost'];
DT $p = $_GET['newdvdpurchased'];
DT @mysql_select_db($DBName) or die(Unable to select database $DBName);
DT $sqladd = INSERT INTO 'dvd' ('id', 'title', 'year','cost','purchased')
DT VALUES (  NULL , '$t', '$y', '$c' , '$p' );
DT echo $sqladd;
DT $result = mysql_query($sqladd);


DT The information is sent from another page which has the following values:


DT form name=add method=get action=addvalue.php

DT ?php
DT echo 'tabletrtdInsert a DVD/td/tr';
DT echo 'trtdinput type=text name=newdvdtitle DVD name/td/tr';
DT echo 'trtdinput type=text name=newdvdyear DVD year/td/tr';
DT echo 'trtdinput type=text name=newdvdcost DVD cost/td/tr';
DT echo 'trtdinput type=text name=newdvdpurchased DVD date
DT purchased/td/tr';
DT echo 'trtdinput type=submit value=Insert new dvd/td/tr';
DT echo '/table';
?
DT /form


DT Thanks in advance,

DT Douglas

Don't put the table name in quotes, use the back tick `dvd`

-- 
regards,
Tom

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



[PHP] PHP Examples

2006-02-10 Thread Dave Jarvis
Hi,

I didn't quite know where this should go inside the PHP user manual.
It is a collection of six simple tricks I use to give websites that
extra flair of functionality.

http://joot.com/dave/writings/articles/php-examples.shtml

I hope you find the auto-complete city and country is especially useful.

Sincerely,
Dave Jarvis

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



[PHP] Re: PHP Examples

2006-02-10 Thread Barry

Dave Jarvis wrote:

Hi,

I didn't quite know where this should go inside the PHP user manual.
It is a collection of six simple tricks I use to give websites that
extra flair of functionality.

http://joot.com/dave/writings/articles/php-examples.shtml

I hope you find the auto-complete city and country is especially useful.

Sincerely,
Dave Jarvis

Your site has an error.

The google ad overlaps the menu.

seen in FF 1.5

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



[PHP] Re: vaidation and mail function question

2006-02-10 Thread Manuel Lemos
Hello,

on 02/10/2006 05:48 AM Paul Goepfert said the following:
 I am beginnging to do vaidation on my web form and I know of a few
 functions to do this with.  For example the empty fuction and the is_
 functions.  Ok to give you a picture of what I am vaildating its just
 your basic form, Name, Address, Email.  I am obviously going to check
 for empty fields.  However I do want better error checking other then
 testing for emptty fields.  Can anyone help me with that?

You may want to try this popular forms generation and validation class.
It provides all you need to validate those field types.

http://www.phpclasses.org/formsgeneration



 After this form is finished vaildating I am going to be sending an
 email of the contents of the form to an email account.   I have seen
 in other messages on this board about the mail function.   I'm not
 sure about this but I think I read that in order for the mail function
 to work the webserver needs sendmail to make the mail function work. 
 Is this true?  I have looked at the phpinfo page on the targeted
 webserver and the sendmail value is missing.  I assume that is ok
 because the webserver is on a windows system rather then a unix
 system. I just want to be sure about this.

On Windows, it uses a SMTP server.

-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



[PHP] Debugging custom streams

2006-02-10 Thread Jared Williams


Hi,
Short version, is there any way of listing all open resources from 
within a PHP script? Think I may have a problem relating
to the object/resource shutdown order within PHP, but cant see which custom 
stream handler still has an open resource. 


Long version...

I've been attempting to write a Zip archive class, which uses streams 
for providing the individual files within the archive.
Gotten to the point where this code works as expected, producing a valid zip 
file, with 1 deflated file named digits.txt with
1234567890 as contents.

$zip = new ZipArchive('test.zip', 'w+');

$stream = $zip-create('digits.txt');
fputs($stream, '1234567890');
fclose($stream);

$zip-close();
unset($zip);

The problem is once go beyond 1 file per zip, as in

$zip = new ZipArchive('test.zip', 'w+');

$stream = $zip-create('digits.txt');
fputs($stream, '1234567890');
fclose($stream);

$stream = $zip-create('alpha.txt');
fputs($stream, 'abcdefghijklmnopqrstuvwxyz');
fclose($stream);

$zip-close();
unset($zip); 

I get an application exception on PHP shutdown, though the zip file is 
valid with 2 files. 

Jared
  

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



Re: [PHP] Debugging custom streams

2006-02-10 Thread Jochem Maas

Jared Williams wrote:


Hi,
Short version, is there any way of listing all open resources from 
within a PHP script? Think I may have a problem relating
to the object/resource shutdown order within PHP, but cant see which custom stream handler still has an open resource. 



Long version...

I've been attempting to write a Zip archive class, which uses streams 
for providing the individual files within the archive.
Gotten to the point where this code works as expected, producing a valid zip 
file, with 1 deflated file named digits.txt with
1234567890 as contents.

$zip = new ZipArchive('test.zip', 'w+');

$stream = $zip-create('digits.txt');
fputs($stream, '1234567890');
fclose($stream);

$zip-close();
unset($zip);

The problem is once go beyond 1 file per zip, as in

$zip = new ZipArchive('test.zip', 'w+');

$stream = $zip-create('digits.txt');
fputs($stream, '1234567890');
fclose($stream);

$stream = $zip-create('alpha.txt');
fputs($stream, 'abcdefghijklmnopqrstuvwxyz');
fclose($stream);

$zip-close();



I don't suppose that your closing a stream twice?
[ once with fclose() and one inside $zip-close() ]

unset($zip); 

	I get an application exception on PHP shutdown, though the zip file is valid with 2 files. 


what exactly is the exception?



Jared
  



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



Re: [PHP] Newbie Question Can't insert values into MySQL DB via PHP

2006-02-10 Thread Duggles Temple
...I knew I would forget something...

The echo statement show the values that I would input from the last page.
The MySQL error would be Query was empty.


RE: [PHP] Debugging custom streams

2006-02-10 Thread Jared Williams
 

 -Original Message-
 From: Jochem Maas [mailto:[EMAIL PROTECTED] 
 Sent: 10 February 2006 14:17
 To: [EMAIL PROTECTED]
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] Debugging custom streams
 
 Jared Williams wrote:
  
  Hi,
  Short version, is there any way of listing all open 
 resources from 
  within a PHP script? Think I may have a problem relating to 
 the object/resource shutdown order within PHP, but cant see 
 which custom stream handler still has an open resource.
  
  
  Long version...
  
  I've been attempting to write a Zip archive class, 
 which uses streams for providing the individual files within 
 the archive.
  Gotten to the point where this code works as expected, producing a 
  valid zip file, with 1 deflated file named digits.txt with 
 1234567890 as contents.
  
  $zip = new ZipArchive('test.zip', 'w+');
  
  $stream = $zip-create('digits.txt');
  fputs($stream, '1234567890');
  fclose($stream);
  
  $zip-close();
  unset($zip);
  
  The problem is once go beyond 1 file per zip, as in
  
  $zip = new ZipArchive('test.zip', 'w+');
  
  $stream = $zip-create('digits.txt');
  fputs($stream, '1234567890');
  fclose($stream);
  
  $stream = $zip-create('alpha.txt');
  fputs($stream, 'abcdefghijklmnopqrstuvwxyz'); fclose($stream);
  
  $zip-close();
 
 
 I don't suppose that your closing a stream twice?
 [ once with fclose() and one inside $zip-close() ]

$zip-close() doesn't (yet) ensure that internal streams are closed. So don't 
think it can be that.

 
  unset($zip);
  
  I get an application exception on PHP shutdown, though 
 the zip file is valid with 2 files. 
 
 what exactly is the exception?
 

---
php.exe - Application Error
---
The instruction at 0x100ac22f referenced memory at 0x004c. The memory 
could not be read. 
Click on OK to terminate the program
Click on CANCEL to debug the program
---
OK   Cancel   
---

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



RE: [PHP] Limitation on PEAR : Spreadsheet_Excel_Writer

2006-02-10 Thread Kristen G. Thorson
-Original Message-
From: Bagus Nugroho [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 09, 2006 5:48 PM
To: php-general
Subject: [PHP] Limitation on PEAR : Spreadsheet_Excel_Writer

Hello Everyone,
 
I'm succesfully generate report from mysql table using PEAR :
Spreadsheet_Excel_Writer, but I have problem to generate from table
which contain long text, the text is not download completely.
such as  blablabla.
it only contain  blab
 
How can manipulate PEAR, to get full text on excel sheet.
 
Thanks in advance
Bgs




MySQL fields can contain 65535 characters.  Excel fields can only hold
32767 characters.  If you have any text fields longer than 32767
characters, then they will be truncated by Excel.


kgt

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



Re: [PHP] Debugging custom streams

2006-02-10 Thread Jochem Maas

Jared Williams wrote:
 




-Original Message-
From: Jochem Maas [mailto:[EMAIL PROTECTED] 
Sent: 10 February 2006 14:17

To: [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Subject: Re: [PHP] Debugging custom streams

Jared Williams wrote:


Hi,
	Short version, is there any way of listing all open 


resources from 

within a PHP script? Think I may have a problem relating to 


the object/resource shutdown order within PHP, but cant see 
which custom stream handler still has an open resource.


why not let your zip class keep a list of opened streams (I can't
imagine that it's not doing that already) and write a function which
will output a list of 'registered' stream resources that are still open
[mis]using ftell() or feof() to check which streams are still 'active'.






...




I don't suppose that your closing a stream twice?
[ once with fclose() and one inside $zip-close() ]



$zip-close() doesn't (yet) ensure that internal streams are closed. So don't 
think it can be that.


was worth a guess :-)



 


unset($zip);

	I get an application exception on PHP shutdown, though 


the zip file is valid with 2 files. 


what exactly is the exception?




---
php.exe - Application Error
---
The instruction at 0x100ac22f referenced memory at 0x004c. The memory could not be read. 
Click on OK to terminate the program

Click on CANCEL to debug the program
---
OK   Cancel   
---


I have the same thing occur on windows machines with some setups (running 
certain code)
- and the same situation where the code seems to work regardless of the error.

I would suspect that it's an internal 'bug' and that there is nothing you can 
do at the
php level to fix it (at least there is nothing you should need to do - made 
there _is_ actually
something you can do at the php level).

have you tried running the code on a linux machine? (maybe using strace or gdb) 
- personally
I only use windows for preliminary development, all production machines are 
linux (and the odd
errors/exceptions that popup in windows never seem to have a corresponding 
problem in linux)





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



RE: [PHP] static variables

2006-02-10 Thread Miguel Guirao


and static variables do not lose it's value as long as the script is not
called again!!
Since you are calling the script again, that's why the static variables lose
it's value!!

Miguel Guirao

-Original Message-
From: Hugh Danaher [mailto:[EMAIL PROTECTED]
Sent: Viernes, 10 de Febrero de 2006 12:45 a.m.
To: php-general@lists.php.net
Cc: suresh kumar
Subject: Re: [PHP] static variables


Suresh,
You could use the link to pass your variable to the next page, or to the
same page:
Instead of
$count=0;
use
if (!isset($_GET['count'])) $count=0;
Then for your link use
print a href=http://www.whatever.com?count=$countlink to new
page/a
or use
print a href=.$_SERVER['PHP_SELF'].?count=$countlink to same
page/a
if you want to return to the same page with an updated count.
HTH
HTD
- Original Message -
From: suresh kumar [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Thursday, February 09, 2006 9:50 PM
Subject: [PHP] static variables


 hai everbody

i am facing a problem with static
 variable. i declared $count=0 as Static variable,when
 i click the link specified in anchor tag my page is
 refreshed again and static variable lose its value and
 assigned with 0.i want the logic code say  my stsic
 variable will not lose scope when i click next,i am
 looking forward reply from u.
   A.suresh



 __
 Yahoo! India Matrimony: Find your partner now. Go to
 http://yahoo.shaadi.com

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



 --
 No virus found in this incoming message.
 Checked by AVG Free Edition.
 Version: 7.1.375 / Virus Database: 267.15.4/255 - Release Date: 2/9/2006





--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.4/255 - Release Date: 2/9/2006


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

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

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



Re: [PHP] Newbie Question Can't insert values into MySQL DB via PHP

2006-02-10 Thread Jochem Maas

Duggles Temple wrote:

...I knew I would forget something...

The echo statement show the values that I would input from the last page.


I don't think so - you should be echo'ing a SQL statement that _contains_
the (sanitized???)


The MySQL error would be Query was empty.


how do you know? (I can't fathom how a non empty string passed to mysql_query()
can result in that error)





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



[PHP] Static and Global at the same time!

2006-02-10 Thread Miguel Guirao


Hello list!!

Can I have a variable that is static and global at the same time within a
function?
Let's say I have:

$data = ;

function newdata() {
  static global $data;
  $data [$i] = $newdatatobestored_inthearray;
}

Best Regards,

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


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

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

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



RE: [PHP] TMP directory

2006-02-10 Thread Miguel Guirao


ups, my finger did it's own thing!!
Thanks for the response!!

-Original Message-
From: Chris [mailto:[EMAIL PROTECTED]
Sent: Jueves, 09 de Febrero de 2006 07:36 p.m.
To: Miguel Guirao
Cc: PHP List
Subject: Re: [PHP] TMP directory


Hi,

Well, firstly there is no php 7..

By default it should be /tmp - but create a phpinfo page and check that.

Miguel Guirao wrote:

 Hello list,

 Does anybody know which is the TMP default directory when uploading file
to
 the server using PHP?

 PHP 7.1.2-7
 MySQL 3.23.49-3
 APACHE 1.3.23-11
 RED HAT LINUX 7.3


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

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

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



RE: [PHP] Limitation on PEAR : Spreadsheet_Excel_Writer

2006-02-10 Thread George Pitcher
Does your text get truncated or turned into hash '#' signs?

I know that Excel has some limits regarding how many characters will go into
a text column.

There is also a 64k row limit as well, but most sane people wouldn't use a
spreadsheet to handle such a dataset.

George

 -Original Message-
 From: Kristen G. Thorson [mailto:[EMAIL PROTECTED]
 Sent: 10 February 2006 2:41 pm
 To: Bagus Nugroho; php-general
 Subject: RE: [PHP] Limitation on PEAR : Spreadsheet_Excel_Writer


 -Original Message-
 From: Bagus Nugroho [mailto:[EMAIL PROTECTED]
 Sent: Thursday, February 09, 2006 5:48 PM
 To: php-general
 Subject: [PHP] Limitation on PEAR : Spreadsheet_Excel_Writer

 Hello Everyone,

 I'm succesfully generate report from mysql table using PEAR :
 Spreadsheet_Excel_Writer, but I have problem to generate from table
 which contain long text, the text is not download completely.
 such as  blablabla.
 it only contain  blab

 How can manipulate PEAR, to get full text on excel sheet.

 Thanks in advance
 Bgs




 MySQL fields can contain 65535 characters.  Excel fields can only hold
 32767 characters.  If you have any text fields longer than 32767
 characters, then they will be truncated by Excel.


 kgt

 --
 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] Static and Global at the same time!

2006-02-10 Thread Chris Boget

Can I have a variable that is static and global at the same time within a
function?
Let's say I have:
$data = ;
function newdata() {
 static global $data;
 $data [$i] = $newdatatobestored_inthearray;
}


Isn't a global variable static within the function by it's nature of being 
global?  Making it so that the static keyword is superfluous?


Hmmm...  Well, that is, of course, assuming that the function is the only 
place the variable is ever modified...


thnx,
Chris 


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



Re: [PHP] Static and Global at the same time!

2006-02-10 Thread Andrei


What's the use of global static variables?

Andy

Miguel Guirao wrote:


Hello list!!

Can I have a variable that is static and global at the same time within a
function?
Let's say I have:

$data = ;

function newdata() {
  static global $data;
  $data [$i] = $newdatatobestored_inthearray;
}

Best Regards,

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




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



Re: [PHP] Static and Global at the same time!

2006-02-10 Thread Jochem Maas

Miguel Guirao wrote:


Hello list!!


my name is not 'list' but I'll let you off this time.



Can I have a variable that is static and global at the same time within a
function?


here is some [linux] command line output that took about 30 seconds to 
generate, it
answers your question. you'll have to work out the answer yourself by reading 
the
output - next time why not run the test code yourself (unlike most people you 
actually
wrote some code to test) ???

$ php -r '
$data = ;
function newdata() { static $data; global $data; if (empty($data)) { $data = 
TEST; } return $data; }
var_dump($data, newdata(), $data, newdata());
'
string(0) 
string(4) TEST
string(4) TEST
string(4) TEST


$ php -r '
$data = ;
function newdata() { global $data; static $data; if (empty($data)) { $data = 
TEST; } return $data; }
var_dump($data, newdata(), $data, newdata());
'
string(0) 
string(4) TEST
string(0) 
string(4) TEST


$ php -r '
$data = ;
function newdata() { static global $data; if (!isset($data)) { $data = TEST; 
} return $data; }
var_dump($data, newdata(), $data, newdata());
'

Parse error: parse error, unexpected T_GLOBAL, expecting T_VARIABLE in Command 
line code on line 3



Let's say I have:

$data = ;

function newdata() {
  static global $data;
  $data [$i] = $newdatatobestored_inthearray;
}

Best Regards,

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










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



Re: [PHP] Static and Global at the same time!

2006-02-10 Thread Jochem Maas

Andrei wrote:


What's the use of global static variables?


humor small_print=no accounting for taste
heh! we need to teach them to test out their own basic questions
and assumptions before we move them onto real analysis  deduction.
/humor

I agree though that a 'global static' looks to be pointless, then again
the behaviour in my little test wasn't what I expected to see exactly:
namely that you can set a single variable to static and global one at
a time [inside a function] but that the order in which you do it affects
how the variable 'works'.

- see my other post in this thread



Andy

Miguel Guirao wrote:



Hello list!!

Can I have a variable that is static and global at the same time within a
function?
Let's say I have:

$data = ;

function newdata() {
  static global $data;
  $data [$i] = $newdatatobestored_inthearray;
}

Best Regards,

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






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



Re: [PHP] Newbie Question Can't insert values into MySQL DB via PHP

2006-02-10 Thread Duggles Temple
I WOULD tell you the exact string that the echo statement outpus, but the
SQL has chrashed and now PHP ownt interact (damn tin of worms i've opened
here). But, I know that if i send the data from the other page, it will
arrive to the addvalue.php page and be echoed successfully (do you really
think I would not send data to be processed by the addvalue.php page? now
really)...

The only problem is that the data received from the other page is not being
sent through the SQL statement at all, hence the Query was Empty error.

Well, there must be something wrong in my programming to make that
unfathomable error, and frankly, I can't see it.


RE: [PHP] Debugging custom streams

2006-02-10 Thread Jared Williams

  
 -Original Message-
 From: Jochem Maas [mailto:[EMAIL PROTECTED]
 Sent: 10 February 2006 14:17
 To: [EMAIL PROTECTED]
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] Debugging custom streams
 
 Jared Williams wrote:
 
 Hi,
Short version, is there any way of listing all open
 
 resources from
 
 within a PHP script? Think I may have a problem relating to
 
 the object/resource shutdown order within PHP, but cant see which 
 custom stream handler still has an open resource.
 
 why not let your zip class keep a list of opened streams (I 
 can't imagine that it's not doing that already) and write a 
 function which will output a list of 'registered' stream 
 resources that are still open [mis]using ftell() or feof() to 
 check which streams are still 'active'.

There can only be one open stream at a time, when writing, as a stream writes 
to what will be the final zip file, and if they were
not closed in the correct manner the resulting zip file wouldn't be valid.

Perhaps I should explain in abit more detail how this is working.

The ZipArchive creates two streams, one for the actual final zip, and the 
another for the central directories headers.

When fputs($stream, '0123456789') occurs the data goes through 2 custom 
streams, and an optional filter.

Zip custom stream - optional compression filter - Append custom stream - 
final zip file.

The Zip custom stream, handles writing the local header to the final zip file, 
calculating the compressed and uncompressed size, and
crc (using hash extension). Like so 

function stream_write($data)
{ 
$r = fwrite($this-compressedStream, $data);
$this-uncompressedSize += strlen($data);
hash_update($this-hashContext, $data);
return $r;
}

When the Zip custom stream is closed the zip local header is rewritten with the 
correct values, and a central directory header is
written to the central directory stream. So if any resource was left open, then 
an invalid zip file would result. 

All $zip-close() has left todo, is append the central directory stream 
contents to the final zip, add a central end directory
header and close both streams for a valid zip.

Jared

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



Re: [PHP] Static and Global at the same time!

2006-02-10 Thread Andrei


	A static defined variable used in a function will keep it's value each 
time the function is called, but this function is available only for 
function's scope.
	A global defined variable used in a function will keep it's values (as 
long as this value is not changed in body of the script or in other 
functions), and the variable is available for script scope.


Andy

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



Re: [PHP] Newbie Question Can't insert values into MySQL DB via PHP

2006-02-10 Thread Barry

Duggles Temple wrote:

I WOULD tell you the exact string that the echo statement outpus, but the
SQL has chrashed and now PHP ownt interact (damn tin of worms i've opened
here). But, I know that if i send the data from the other page, it will
arrive to the addvalue.php page and be echoed successfully (do you really
think I would not send data to be processed by the addvalue.php page? now
really)...

The only problem is that the data received from the other page is not being
sent through the SQL statement at all, hence the Query was Empty error.

Well, there must be something wrong in my programming to make that
unfathomable error, and frankly, I can't see it.



Than it's not enough code you have posted.

There must be a problem between
[Form of the page]  [PHP code]

Barry

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



RE: [PHP] Newbie Question Can't insert values into MySQL DB via PHP

2006-02-10 Thread Jim Moseby
 
 There must be a problem between
 [Form of the page]  [PHP code]
 

For me the problem is usually between
[Keyboard]  [Chair]

;-)

JM

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



RE: [PHP] Debugging custom streams

2006-02-10 Thread Jared Williams

 Ahha, after some rethinking, I've dropped the append custom stream, as its not 
really required.

And instead of using a custom in memory stream for handling the central 
directory stream, just using tmpfile(), the application
error has disappeared.

Jared


  Jared Williams wrote:
  
  Hi,
   Short version, is there any way of listing all open
  
  resources from
  
  within a PHP script? Think I may have a problem relating to
  
  the object/resource shutdown order within PHP, but cant see which 
  custom stream handler still has an open resource.
  
  why not let your zip class keep a list of opened streams (I can't 
  imagine that it's not doing that already) and write a 
 function which 
  will output a list of 'registered' stream resources that are still 
  open [mis]using ftell() or feof() to check which streams are still 
  'active'.
 
 There can only be one open stream at a time, when writing, as 
 a stream writes to what will be the final zip file, and if 
 they were not closed in the correct manner the resulting zip 
 file wouldn't be valid.
 
 Perhaps I should explain in abit more detail how this is working.
 
 The ZipArchive creates two streams, one for the actual final 
 zip, and the another for the central directories headers.
 
 When fputs($stream, '0123456789') occurs the data goes 
 through 2 custom streams, and an optional filter.
 
 Zip custom stream - optional compression filter - Append 
 custom stream - final zip file.
 
 The Zip custom stream, handles writing the local header to 
 the final zip file, calculating the compressed and 
 uncompressed size, and crc (using hash extension). Like so 
 
   function stream_write($data)
   { 
   $r = fwrite($this-compressedStream, $data);
   $this-uncompressedSize += strlen($data);
   hash_update($this-hashContext, $data);
   return $r;
   }
 
 When the Zip custom stream is closed the zip local header is 
 rewritten with the correct values, and a central directory 
 header is written to the central directory stream. So if any 
 resource was left open, then an invalid zip file would result. 
 
 All $zip-close() has left todo, is append the central 
 directory stream contents to the final zip, add a central end 
 directory header and close both streams for a valid zip.
 
 Jared

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



Re: [PHP] PHP Examples

2006-02-10 Thread Paul Novitski

At 04:08 AM 2/10/2006, Dave Jarvis wrote:

It is a collection of six simple tricks I use to give websites that
extra flair of functionality.

http://joot.com/dave/writings/articles/php-examples.shtml

I hope you find the auto-complete city and country is especially useful.



Nice collection, Dave.  I've got a few comments:

Why don't you make the table of contents at the top of the page a 
list of links for easier navigation?



XML Tag Parsing:

Your code assumes that the tag you're searching for is unique and 
doesn't have any attributes.  I'd think you'd want to use RegExp to 
search for something like this:


$tag( [^]*)*

= tagName followed by (zero or more groups of [a space followed by 
any number of characters that aren't a close-bracket]) followed by a 
close-bracket [1]


cf: PCRE regex pattern syntax
http://www.php.net/manual/en/reference.pcre.pattern.syntax.php

If you use preg_match() you can capture multiple instances of the tag 
and not just the first one.


cf: preg_match()
http://au.php.net/preg_match


Auto-complete City  Country:

These function references are undefined -- deliberately?

get_location_xml()
parse_city()
parse_country()

I have some suggestions for your country select list:

a) For greater compatibility with future markup (XHTML etc.) I 
suggest you change:

SELECTED='true'
to:
selected=selected

b) Your exhaustive list of if-tests is quite verbose and could be 
shrunk.  For example, you could throw the country abbreviations  
names into an array and then walk the array outputting the select 
options, including the selected attribute when there's a match with 
the target country.


c) You're mixing PHP logic with HTML markup more than is 
necessary.  Even including both in the same script you could separate 
them something like this:

__

$aNations = array(AU=Australia, CA=Canada, ...);
$sSelectedAttr =  selected=\selected\;

foreach ($aNations as $sNA = $sNation)
{
$sSelected = (($country == $sNA) ? $sSelectedAttr : );

echo  heredocNationOption
option value=$sNA$sSelected$sNation/option

heredocNationOption;
}
__

Performing the logic and outputting the markup as separate steps is 
my personal preference simply because it tends to make the code 
easier to modify in future.  More ideally, I'd remove the literal 
markup from the function entirely, passing it as template argument, 
and even further removing the markup completely from the PHP script 
to a separate template file, so that the user (developer) can tweak 
the markup independently of messing with the logic.  For example, if 
you pass the markup to the function as arguments (listBegin, 
listOption, listSelected, and listEnd) then you can output the list 
as a SELECT, OL, UL, TABLE, etc. without having to modify the script.


Regards,
Paul 


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



Re: [PHP] PHP Examples

2006-02-10 Thread tedd

Hi,

I didn't quite know where this should go inside the PHP user manual.
It is a collection of six simple tricks I use to give websites that
extra flair of functionality.

http://joot.com/dave/writings/articles/php-examples.shtml

I hope you find the auto-complete city and country is especially useful.

Sincerely,
Dave Jarvis


Dave:

Thanks for posting your code -- it works great!

However, I detected a slight problem, which can be corrected like so.

//---

function get_tag_contents( $xml, $tag )
{
$result = ;
$s_tag = $tag;
$s_offs = strpos( $xml, $s_tag );

// Note, use ===  because == will not work as expected.
// The position of the first character is zero not one.
if ($s_offs === false)
{
echo ((1) The needle was not found in the haystack \ $xml\.);
}
else
{
$e_tag = /$tag;
$e_offs = strpos( $xml, $e_tag, $s_offs );

// If we have both tags, then dig out the contents.
//
if( $e_offs === false )
{
echo ((2) The needle was not found in the haystack \ $xml\.);
}
else
{
$result = substr(
$xml,
$s_offs + strlen( $s_tag ),
$e_offs - $s_offs - strlen( $e_tag ) + 1 );
}

}

return $result;
}
//---

tedd
--

http://sperling.com/

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



[PHP] php versions between os/platform

2006-02-10 Thread pedro mpa
Greetings!

I am building a website using PHP 5.1.2 and MySQL 5.0.18 and I am using
windows xp with IIS.
All the hosting companies I have contacted are using php 4.x.x and mysql
4.x.x or 3.x.x, on linux I suppose.

Are php versions the same for every os/platform?

Thanks in advance.

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



Re: [PHP] gettting last assigned key in an array

2006-02-10 Thread Evan Priestley

function get_last_key( $array ) {
// end( $array ); return key( $array );
return array_search(
 reset( array_reverse( array_values( array_flip( $array ) ) ) )
,array_reverse( array_values( array_flip( $array ) ) )
,true
);
}


On Feb 10, 2006, at 2:39 PM, jonathan wrote:



im mapping some data from a sql select into a custom object that  
will have a couple associative arrays. I have some code that I  
think looks a little ugly such as:


$x=0;
if($row['slot']=2)
{
$this-menu_item[$x]['item_id']=$row['item_id'];
$this-menu_item[$x]['name']=$row['name'];
$this-menu_item[$x]['item_price']=$row['item_price'];
$x++;
}

I'd rather do something like this:
if($row['slot']=2)
{
$this-menu_item[]['item_id']=$row['item_id'];
$y=get_last_key();
$this-menu_item[$y]['name']=$row['name'];
$this-menu_item[$y]['item_price']=$row['item_price'];
}

but don't know if php has a built in for the get_last_key(); any  
thoughts would be appreciated (including whether you think the  
original code snippet is fine.


-jonathan

--
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] gettting last assigned key in an array

2006-02-10 Thread Curt Zirzow
On Fri, Feb 10, 2006 at 11:39:13AM -0800, jonathan wrote:
 
 im mapping some data from a sql select into a custom object that  
 will have a couple associative arrays. I have some code that I think  
 looks a little ugly such as:
 
 $x=0;
   if($row['slot']=2)
   {
   $this-menu_item[$x]['item_id']=$row['item_id'];
 $this-menu_item[$x]['name']=$row['name'];
   $this-menu_item[$x]['item_price']=$row['item_price'];
   $x++;
   }
 
 I'd rather do something like this:
   if($row['slot']=2)
   {
   $this-menu_item[]['item_id']=$row['item_id'];
 $y=get_last_key();
 $this-menu_item[$y]['name']=$row['name'];
   $this-menu_item[$y]['item_price']=$row['item_price'];
   }
 
 but don't know if php has a built in for the get_last_key(); any  
 thoughts would be appreciated (including whether you think the  
 original code snippet is fine.

To get the last key:
  end($array);
  $last_key = key($array);

How i would approach the above code:

  $this-menu_item[] = $row;

Or/And if $row had more fields you really wanted to name them
differently:

  $item['item_id'] = $row['item_id'];
  $item['name']= $row['name'];
  $item['price']   = $row['item_name'];
  $this-menu_item[] = $item;


Curt.
-- 
cat .signature: No such file or directory

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



Re: [PHP] php versions between os/platform

2006-02-10 Thread Dan Trainor

pedro mpa wrote:

Greetings!

I am building a website using PHP 5.1.2 and MySQL 5.0.18 and I am using
windows xp with IIS.
All the hosting companies I have contacted are using php 4.x.x and mysql
4.x.x or 3.x.x, on linux I suppose.

Are php versions the same for every os/platform?

Thanks in advance.



Hi -

It's been my experience that, yes, this is the case.  However, there may 
be other modules which versions differ from platform to platform.


Take, for instance, PHP's download page.  One version is offerend for 
both Windows and Linux/BSD/Whatever.  This is how I came to this conclusion.


Hope that helps...
-dant

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



Re: [PHP] php versions between os/platform

2006-02-10 Thread Richard Lynch
On Fri, February 10, 2006 2:01 pm, pedro mpa wrote:
 I am building a website using PHP 5.1.2 and MySQL 5.0.18 and I am
 using
 windows xp with IIS.
 All the hosting companies I have contacted are using php 4.x.x and
 mysql
 4.x.x or 3.x.x, on linux I suppose.

 Are php versions the same for every os/platform?

The PHP version numbers are the same for every os/platform.  Ditto for
MySQL.

There are a handful of Linux-only functions, and possibly a handful of
Windows-only functions for PHP.

I don't think MySQL has any OS-specific functions/features...

You're probably not using anything OS-specific, but always check the
docs on new-to-you features/functions to see restrictions.

If you NEED 5.x, there are hosts who have it deployed on [some] servers.

http://hostbaby.com springs to mind, but I'm biased, as that's my
favorite hosting company. :-)  They also have MySQL going all UTF-8,
which is a Good Thing for your long-term survival in today's WORLD
wide web.

I think http://webmasters.com is upgrading to PHP 5 within the next
week or so.

I'm betting that you can get PHP 5.x out of http://pair.com, since
they host http://php.net and you gotta figure they're on top of things
like that, eh?

YMMV
NAIAA
IANAL

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

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



Re: [PHP] gettting last assigned key in an array

2006-02-10 Thread Richard Lynch
On Fri, February 10, 2006 1:39 pm, jonathan wrote:
 im mapping some data from a sql select into a custom object that
 will have a couple associative arrays. I have some code that I think
 looks a little ugly such as:

  $x=0;
   if($row['slot']=2)
   {
   $this-menu_item[$x]['item_id']=$row['item_id'];
  $this-menu_item[$x]['name']=$row['name'];
   $this-menu_item[$x]['item_price']=$row['item_price'];
   $x++;
   }

This seems more clear than the one below.

 I'd rather do something like this:
   if($row['slot']=2)
   {
   $this-menu_item[]['item_id']=$row['item_id'];
  $y=get_last_key();
  $this-menu_item[$y]['name']=$row['name'];
   $this-menu_item[$y]['item_price']=$row['item_price'];
   }

http://php.net/end

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

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



Re: [PHP] Static and Global at the same time!

2006-02-10 Thread Richard Lynch
On Fri, February 10, 2006 9:07 am, Miguel Guirao wrote:
 Can I have a variable that is static and global at the same time
 within a
 function?
 Let's say I have:

 $data = ;

 function newdata() {
   static global $data;
   $data [$i] = $newdatatobestored_inthearray;
 }

No.

But if you need external access, global is the way to go...

I can't think of any inherent property to 'static' that is not already
encompassed by 'global'...  Am I missing something?

Initializing $data to  and then adding to it as an array is pretty
ugly code, imho.  Initialize it to an array() not  if it's an array.

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

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



RE: [PHP] Debugging custom streams

2006-02-10 Thread Richard Lynch
WILD GUESS!!!

Since you're NOT closing off the streams, PHP is trying to close them
for you, but you've unset various variables and whatnot, and confused
PHP into fclose()ing the WRONG thing.

Try closing your own files.

If that doesn't do it, just for fun, tack on an exit; at the very
end of the script.  This might get PHP to close the streams earlier
than it normally would.  This is a total hack, but there it is.

File a bug report.
http://bugs.php.net

You seem to have a pretty clear-cut simple code-base to demonstrate
the problem, so if you can provide that, it's odds-on that somebody on
PHP Dev Team can fix it.

On Fri, February 10, 2006 9:40 am, Jared Williams wrote:

 
 -Original Message-
 From: Jochem Maas [mailto:[EMAIL PROTECTED]
 Sent: 10 February 2006 14:17
 To: [EMAIL PROTECTED]
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] Debugging custom streams
 
 Jared Williams wrote:
 
 Hi,
   Short version, is there any way of listing all open
 
 resources from
 
 within a PHP script? Think I may have a problem relating to
 
 the object/resource shutdown order within PHP, but cant see which
 custom stream handler still has an open resource.

 why not let your zip class keep a list of opened streams (I
 can't imagine that it's not doing that already) and write a
 function which will output a list of 'registered' stream
 resources that are still open [mis]using ftell() or feof() to
 check which streams are still 'active'.

 There can only be one open stream at a time, when writing, as a stream
 writes to what will be the final zip file, and if they were
 not closed in the correct manner the resulting zip file wouldn't be
 valid.

 Perhaps I should explain in abit more detail how this is working.

 The ZipArchive creates two streams, one for the actual final zip, and
 the another for the central directories headers.

 When fputs($stream, '0123456789') occurs the data goes through 2
 custom streams, and an optional filter.

 Zip custom stream - optional compression filter - Append custom
 stream - final zip file.

 The Zip custom stream, handles writing the local header to the final
 zip file, calculating the compressed and uncompressed size, and
 crc (using hash extension). Like so

   function stream_write($data)
   {
   $r = fwrite($this-compressedStream, $data);
   $this-uncompressedSize += strlen($data);
   hash_update($this-hashContext, $data);
   return $r;
   }

 When the Zip custom stream is closed the zip local header is rewritten
 with the correct values, and a central directory header is
 written to the central directory stream. So if any resource was left
 open, then an invalid zip file would result.

 All $zip-close() has left todo, is append the central directory
 stream contents to the final zip, add a central end directory
 header and close both streams for a valid zip.

 Jared

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




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

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



Re: [PHP] PHP Examples

2006-02-10 Thread Richard Lynch
On Fri, February 10, 2006 1:36 pm, Paul Novitski wrote:
 At 04:08 AM 2/10/2006, Dave Jarvis wrote:
It is a collection of six simple tricks I use to give websites that
extra flair of functionality.

http://joot.com/dave/writings/articles/php-examples.shtml

I hope you find the auto-complete city and country is especially
 useful.

While we're at it, I'd recommend a cron job to check the ISO (?)
reference standard of countries and country codes to re-populate your
data every month or so.

After all, the list of countries *DOES* change, and your site should
be current, no?

I forget exactly where I found the standard list, as I coded it and
forgot it and it's worked fine for many years now.
http://info.com/country+codes+reference+standard

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

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



RE: [PHP] Debugging custom streams

2006-02-10 Thread Jared Williams

 WILD GUESS!!!
 
 Since you're NOT closing off the streams, PHP is trying to 
 close them for you, but you've unset various variables and 
 whatnot, and confused PHP into fclose()ing the WRONG thing.

Hmm, I said all streams are getting closed. 
If they were not then a malformed zip would be created.
As only when a stream is closed that you can determine the size and crc, to 
write to zip headers.

Jared

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



RE: [PHP] Static and Global at the same time!

2006-02-10 Thread Miguel Guirao


Thanks for all your suggestions!! specially to list!!

Regards,
Miguel Guirao

-Original Message-
From: Richard Lynch [mailto:[EMAIL PROTECTED]
Sent: Viernes, 10 de Febrero de 2006 03:20 p.m.
To: Miguel Guirao
Cc: PHP List
Subject: Re: [PHP] Static and Global at the same time!


On Fri, February 10, 2006 9:07 am, Miguel Guirao wrote:
 Can I have a variable that is static and global at the same time
 within a
 function?
 Let's say I have:

 $data = ;

 function newdata() {
   static global $data;
   $data [$i] = $newdatatobestored_inthearray;
 }

No.

But if you need external access, global is the way to go...

I can't think of any inherent property to 'static' that is not already
encompassed by 'global'...  Am I missing something?

Initializing $data to  and then adding to it as an array is pretty
ugly code, imho.  Initialize it to an array() not  if it's an array.

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



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

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

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



[PHP] Weirdness with PHP FreeBSD/OSX/Linux headers already sent

2006-02-10 Thread Eric Butera
PHP List,

Perhaps one of you might know the answer to this, because I certainly do
not, nor do any of my coworkers.  The problem is that scripts on our OSX
10.4 (our local development machines) and RedHat/Debian linux servers do not
throw the headers already sent message.  I could have an entire page of
html, php code, whatever I wish and call session_start() at the bottom of
the page and everything would be fine.  No errors on screen, in error_log,
or anywhere else.

I know this is invalid and so do most webservers/environments because
everywhere else I have ever coded I see the headers already sent, output
started at message.  I have used Windows, Linux, and FreeBSD versions of
PHP with Apache 1.3 and 2 and had the error print out as expected.

I want to know if any of you know the reason why this is happening.  I would
prefer the strict error messages to help keep everyones coding in check.
Unfortunately I cannot for the life of me seem to find any configuration
settings which point to this.  Any pointers or help would be greatly
appreciated.

Thank you in advance!


Re: [PHP] php versions between os/platform

2006-02-10 Thread Kevin Kinsey

pedro mpa wrote:


Greetings!

I am building a website using PHP 5.1.2 and MySQL 5.0.18 and I am using
windows xp with IIS.
All the hosting companies I have contacted are using php 4.x.x and mysql
4.x.x or 3.x.x, on linux I suppose.

Are php versions the same for every os/platform?

Thanks in advance.




PHP 5.1.2 is the 'latest and greatest', or pretty close to it.

For various reasons, hosting companies tend to be reluctant
to upgrade such things; the old (USA, anyway) engineer's
adage if it ain't broke, don't fix it comes to mind --- and
these hosting companies figure that it's working and they
don't want to take chances, IMHO.

An even greater reason behind this fact/trend that you notice
is that PHP has become so well-known that websites of all
types are using it, even those whose webmasters don't know
much about how to write in/use the language; therefore they
are using c'n'p ed scripts from the net that may date back
some distance in Net-Time; register_globals must be on,
long global arrays (although they're pretty much backwards-
compatible with PHP 5.X), etc., and deprecated $foo ad nauseum.
The hosting companies don't want their helpdesks flooded with
calls of OMG my site is down!, and Why doesn't my shopping cart |
contact form | uploader | downloader | gallery | ... work???

During my last local update of PHP I finally updated php.ini
as well; took me quite a while to get my business interface
running probably again because I'd written the first scripts
with short tags years ago.  That's the sort of thing they don't
want to have to deal with just yet.  Of course, the day will come
anyway, so they'd better be getting ready

Richard Lynch wrote:

] I'm betting that you can get PHP 5.x out of http://pair.com, since
] they host http://php.net and you gotta figure they're on top of things
] like that, eh?

Pair.com would probably be an excellent choice.  Not only do they
host php.net, but they are very supportive of the Open-Source
movement as a whole, flamebaitand run the best OS on the planet /fb.

] YMMV
] NAIAA
] IANAL

Neither am I.  TIFWIW 

Kevin Kinsey

--
Although the moon is smaller than the earth, it is farther away.

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



[PHP] Updated PHP Examples

2006-02-10 Thread Dave Jarvis
Hi, folks.

A few of you provided me with some great feedback. I've encorporated
most of the suggestions into the examples. There is a bug fix in
there, too (get_tag_contents()), so be sure to check it out. =)

http://www.joot.com/dave/writings/articles/php-examples.shtml

Now that we all know how to auto-complete city and country, let's use
it. ;-) If anyone can find a royalty-free way to automatically
complete region (provice/state), that'd be great. E-mail me directly,
as I've removed myself from the mailing list (too much traffic).

Thanks for all the help!

Dave

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



[PHP] SQL request on DBase file...

2006-02-10 Thread David BERCOT
Hi,

I have to rewrite an application from ASP. In this application, I
receive DBase files which may be saved into Oracle.
In ASP, I used a generic driver and I made SQL requests on these files.
It is possible with PHP on Linux ?
Do you have some examples ?

Thank you very much.

David.


signature.asc
Description: Ceci est une partie de message	numériquement signée


Re: [PHP] Weirdness with PHP FreeBSD/OSX/Linux headers already sent

2006-02-10 Thread Curt Zirzow
On Fri, Feb 10, 2006 at 05:44:26PM -0500, Eric Butera wrote:
 PHP List,
 
 Perhaps one of you might know the answer to this, because I certainly do
 not, nor do any of my coworkers.  The problem is that scripts on our OSX
 10.4 (our local development machines) and RedHat/Debian linux servers do not
 throw the headers already sent message.  I could have an entire page of
 html, php code, whatever I wish and call session_start() at the bottom of
 the page and everything would be fine.  No errors on screen, in error_log,
 or anywhere else.
 ...
 
 I want to know if any of you know the reason why this is happening.  I would
 prefer the strict error messages to help keep everyones coding in check.
 Unfortunately I cannot for the life of me seem to find any configuration
 settings which point to this.  Any pointers or help would be greatly
 appreciated.

To check were the php.ini file is suppose to be, create a page
called like phpinfo.php and put the line:
  ?php phpinfo();

That will have a section showing where the Configuration file php
is looking for. if it just specifies a directory, then it mean
there is no php.ini file in that directory an php is just using all
the default values.

The things that would cause the error message not to show up would
be things like:
  'php.ini:display_errors' if set to Off, it wont show any errors

  'php.ini:output_buffering' if is set to something other than Off
  then there is a chance that php got lucky and didn't send any
  data yet by the time it got to the session_start() call.

Curt.
-- 
cat .signature: No such file or directory

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



Re: [PHP] Weirdness with PHP FreeBSD/OSX/Linux headers already sent

2006-02-10 Thread Kevin Kinsey

Eric Butera wrote:


PHP List,

Perhaps one of you might know the answer to this, because I certainly do
not, nor do any of my coworkers.  The problem is that scripts on our OSX
10.4 (our local development machines) and RedHat/Debian linux servers do not
throw the headers already sent message.  I could have an entire page of
html, php code, whatever I wish and call session_start() at the bottom of
the page and everything would be fine.  No errors on screen, in error_log,
or anywhere else.

I know this is invalid and so do most webservers/environments because
everywhere else I have ever coded I see the headers already sent, output
started at message.  I have used Windows, Linux, and FreeBSD versions of
PHP with Apache 1.3 and 2 and had the error print out as expected.

I want to know if any of you know the reason why this is happening.  I would
prefer the strict error messages to help keep everyones coding in check.
Unfortunately I cannot for the life of me seem to find any configuration
settings which point to this.  Any pointers or help would be greatly
appreciated.

Thank you in advance!
 



Mostly out of curiosity, but also somewhat out of my
troll-like and pedantic nature, what happens if you
start your scripts with:

?php

   error_reporting(E_STRICT);


??

And, the obvious troll question:  you do have session
support compiled?

Kevin Kinsey

--
Anyone who has had a bull by the tail
knows five or six more things than someone who hasn't.
-- Mark Twain

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



Re: [PHP] Newbie Question Can't insert values into MySQL DB via PHP

2006-02-10 Thread Kevin Kinsey

Jochem Maas wrote:


Duggles Temple wrote:



I am having a problem with a shop system. I can't add values into the 
MySQL
DB via a PHP statement. The values are being transferred from one 
page to

another (know that from the echo statement), but the SQL statement isn't
working.

The statement is as follows:

$conn = mysql_connect($DBhost,$DBuser,$DBpass) or die('Unable to 
connect to

database');
$t = $_GET['newdvdtitle'];
$y = $_GET['newdvdyear'];
$c = $_GET['newdvdcost'];
$p = $_GET['newdvdpurchased'];
@mysql_select_db($DBName) or die(Unable to select database $DBName);
$sqladd = INSERT INTO 'dvd' ('id', 'title', 'year','cost','purchased')
VALUES (  NULL , '$t', '$y', '$c' , '$p' );
echo $sqladd;



using echo to find out whats' in your variable is a good start, also
take a look a print_r() and var_dump() - they given more feedback 
regarding

passed in vars.

it would have been useful if you had actually posted the output of the
echo statement.


$result = mysql_query($sqladd);



try adding something like:

if (!$result) {
die(mysql_errno($conn) . :  . mysql_error($conn) . \n)
}



Very good habit to be into.  Also, adding the query will help during
the debugging phase of development.  I generally use something like:

mysql_query($query) or die(Error in query: query was $query and MySql 
sez: .mysql_error());


If, as the continuing thread suggests, the query is actually empty,
the above would make that rather obvious right away.

HTH,

Kevin Kinsey

--
Adler's Distinction:
Language is all that separates us from the lower animals,
and from the bureaucrats.

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



[PHP] how to learn php

2006-02-10 Thread /dev/null

hello

i have been trying to learn php.

what is the best approach to learning php for someone who has no 
programming experience?


i am very familiar with html, xhtml, and css. i'm not an idiot when it 
comes to using computers.
i have bought several books and have subscribed to a couple of the php 
mailing lists, but i feel that i could be doing more to learn php.


what approach (and steps) did you take in learning this really cool 
scripting language? should i look into taking classes or stick with an 
autodidact approach?


any advice and/or opinions would be greatly appreciated.

thanks.

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



Re: [PHP] how to learn php

2006-02-10 Thread Philip Hallstrom

i have been trying to learn php.

what is the best approach to learning php for someone who has no programming 
experience?


i am very familiar with html, xhtml, and css. i'm not an idiot when it comes 
to using computers.
i have bought several books and have subscribed to a couple of the php 
mailing lists, but i feel that i could be doing more to learn php.


what approach (and steps) did you take in learning this really cool scripting 
language? should i look into taking classes or stick with an autodidact 
approach?


well, this is free...

http://www.hudzilla.org/phpbook/

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



Re: [PHP] SQL request on DBase file...

2006-02-10 Thread Miles Thompson

At 07:27 PM 2/10/2006, David BERCOT wrote:


Hi,

I have to rewrite an application from ASP. In this application, I
receive DBase files which may be saved into Oracle.
In ASP, I used a generic driver and I made SQL requests on these files.
It is possible with PHP on Linux ?
Do you have some examples ?

Thank you very much.

David.


Come on -- read the manual. There's a section .dbf files.

Miles 



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.1.375 / Virus Database: 267.15.4/255 - Release Date: 2/9/2006

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



[PHP] Oracle buying out Zend ... how does that affect PHP?

2006-02-10 Thread Marc G. Fournier


http://www.businessweek.com/technology/content/feb2006/tc20060209_810527.htm

Also in Oracle's crosshairs: closely held Zend, based in Cupertino, 
Calif. Zend's PHP software language is one of the most prevalent on the 
Web, present in more than 18 million Web sites. The company, which snared 
headlines last year when Netscape co-founder Marc Andreessen joined its 
board, has been trying to extend its success with the Web into business 
applications. Zend could sell for $200 million, according to one source.




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

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



Re: [PHP] how to learn php

2006-02-10 Thread Kim Briggs
On 2/10/06, /dev/null [EMAIL PROTECTED] wrote:

 hello

 i have been trying to learn php.

 what is the best approach to learning php for someone who has no
 programming experience?

 i am very familiar with html, xhtml, and css. i'm not an idiot when it
 comes to using computers.
 i have bought several books and have subscribed to a couple of the php
 mailing lists, but i feel that i could be doing more to learn php.

 what approach (and steps) did you take in learning this really cool
 scripting language? should i look into taking classes or stick with an
 autodidact approach?

 any advice and/or opinions would be greatly appreciated.

 thanks.

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

 I think I won't be the only one that says the best way to learn is by some
experience.  A simple but effective way is to choose something that
interests you, create a small database and then a PHP interface to fill it
up and display information out.  If you can't think of an interest, ask your
friends and family for something they want to keep records of.

Load the free (as in beer) software you need on your computer (LAMP or
WAMP?) and start making examples.  If you can't seem to get motivated on
your own, involving someone else who really wants to see results is probably
the best motivation.

Keep in mind the goal of learning PHP and not making the best display, user
interface, database tables, security (at first), etc.  Getting some results
will probably help motivate you further.   Don't wait to finish the books
before you start. You won't remember it all anyway, so just skim the books
and use as references.

good luck,
--
http://kimbriggs.com


[PHP] Re: Clone of the concurrent users limit of Zend Encoder 4.0 ?

2006-02-10 Thread HoWang Wang
HoWang Wang wrote:
 Hi all,
 
 The Zend Encoder 4.0 (beta) have a new function in the license manager
 which can limit the number of concurrent users. I have wriiten something
 to work like it. But I found a problem. My script can limit the number
 of concurrent running script only. When the script ends, there is some
 data remain in the buffer (of Apache, I think) and the client connection
 is still active! How can I solve this? Please help, Thanks.
 
 Regards

Is it really impossible? Can I do it with Connection Handling?
?php
set_time_limit(0);
ignore_user_abort(true);
// add 1 to the number of concurrent users
// the rest of code
while (!connection_aborted()) {
// keep on locking
} else {
// release lock
}
?

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



Re: [PHP] how to learn php

2006-02-10 Thread Murray @ PlanetThoughtful

On 11/02/2006 10:10 AM, /dev/null wrote:

hello

i have been trying to learn php.

what is the best approach to learning php for someone who has no 
programming experience?


i am very familiar with html, xhtml, and css. i'm not an idiot when it 
comes to using computers.
i have bought several books and have subscribed to a couple of the php 
mailing lists, but i feel that i could be doing more to learn php.


what approach (and steps) did you take in learning this really cool 
scripting language? should i look into taking classes or stick with an 
autodidact approach?


any advice and/or opinions would be greatly appreciated.

thanks.



I honestly believe the best way to learn any programming language, aside 
from perhaps tertiary study (and then only perhaps), is to start out 
with a project and ask the questions you need to solve as you build that 
project.


It should quickly become obvious which things you need to learn, as you 
plan and pursue the project.


Some of those questions might be:

- I need to access data in a database. How do I do that?
- I need to be able to carry data from one page to another, how do I do 
that?
- I need to be able to store 'stuff' at one point in a page (ie, maybe 
data I got from the database) so I can use it again at another point in 
the page.


And so on.

Armed with those questions, you can go through your books, go through 
helpful web sites (don't underestimate the quality of the docs and 
comments on php.net) and ask questions in forums like this one.


Another useful way of picking up knowledge that might not be relevant to 
you right now, but will probably be handy to know later, is reading 
threads in this mailing list. That way you learn about the kinds of 
problems others have encountered, and the suggestions for solving them 
they have received.


Much warmth,

Murray
---
Lost in thought
http://www.planetthoughtful.org

Urban legends, superstitions, ghost
stories and folklore
http://www.ulblog.org

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