RE: [PHP] optimizing tables

2004-02-16 Thread Daniel Perez Clavero
Hola Diana,

$optimize_tabla_acl = OPTIMIZE TABLE '$tbl_acl';
mysql_query($optimize_tabla_acl,$conexion) or die(No he podido
optimizar la tabla.);

Salu2

-Original Message-
From: Diana Castillo [mailto:[EMAIL PROTECTED] 
Sent: lunes, 16 de febrero de 2004 10:38
To: [EMAIL PROTECTED]
Subject: [PHP] optimizing tables


is there a way to optimize individual tables in a php script?


--
Diana Castillo
Global Reservas, S.L.
C/Granvia 22 dcdo 4-dcha
28013 Madrid-Spain
Tel : 00-34-913604039 ext 214
Fax : 00-34-915228673
email: [EMAIL PROTECTED]
Web : http://www.hotelkey.com
  http://www.destinia.com

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

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



RE: [PHP] [SOLVED] Extract of a Paragraph

2004-02-05 Thread Daniel Perez Clavero
Oops, I forget to consider, what would happened with HTML tags. Thank you
Justin. Finally I did a function similar to yours, but the addition of the
TAG control is almost perfect solution. (To trunk a word of two or three
words, does not worth. No need such complicated script (with dictionary) for
that)

Cheers!

-Original Message-
From: Justin French [mailto:[EMAIL PROTECTED]
Sent: jueves, 05 de febrero de 2004 0:59
To: Brian Paulson
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP] Extract of a Paragraph


On Thursday, February 5, 2004, at 02:35  AM, Brian Paulson wrote:

 $string = substr($stringname,0,50);

 echo $string;

 http://www.php.net/substr

No, that's 50 *characters* -- he wanted 50 *words*.  A quick and
reasonably accurate[1] solution would be this:

Daniel,

There's a few things you need to look out for.  If there's tags (like
b or a) in the text, and you chop the text inside an open tag, it
will break your pages, cause them to be invalid, and make them look
really strange.  So the first thing you want to do with the text is
strip the tags.

I'd say the next issue is to only append the 'read more' link if the
article is great than the teaser limit -- that way 'read more' only
appears when it's correct.

You should wrap it in a function so that you only ever write this code
once too.

Here's a stripped-down version of what I use:

?
function chopper($input,$wordcount,$append='')
{
$input = trim(strip_tags($input));
$words = explode(' ',$input);
$output = '';
for($i=0; $i=$wordcount; $i++)
{
$output .= $words[$i].' ';
}
trim($output);
if( ($i == $wordcount)  (!empty($append)) )
{
$output .= $append;
}
return $output;
}
echo chopper($myText,50,... a href='foo'read more/a);
?


[1]: It's reasonably accurate in that it breaks words on spaces, then
glues them back together up to the limit.  However, there are some
words which you may consider to have a space in them, but still be
considered one word.  A perfect example would be Leonardo da Vinci
which the above function will see as 3 words, and you may consider it
to be 2.


Justin French

--
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] Extract of a Paragraph

2004-02-04 Thread Daniel Perez Clavero
Hi list,

I would like to show a extract (first 50 words of a text), in order to
construct something similar to articles view with read more link.

To Extract the first 50 words, should I use str_word_count, and
explode/implode or there´s another way, much simple.

Any sample would be apreciated.
Regards

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



[PHP] Error fread() after switching Register Globals Off

2004-01-29 Thread Daniel Perez Clavero
Hi there,

I´m getting this error and I can´t find what the problem is..

Warning: fread(): supplied argument is not a valid stream resource in
c:\program files\apache group\apache\htdocs\dpc\modulos\mod_ins_doc.php on
line 13

I´ve got a form that calls a module to insert data. IT WAS WORKING before I
switched the Register Globals to Off value. I made the proper chages to
recieve variables, but i cannot make it work. Here is the code of the insert
module.

?
$dbhost=localhost;
$dbusuario=user;
$dbpassword=password;
$db=database;
$conexion = mysql_connect($dbhost,$dbusuario,$dbpassword);
mysql_select_db($db,$conexion);

$farchivo=$_POST['farchivo'];

$binary = addslashes (fread(fopen($farchivo, rb), filesize($farchivo)));

$nombre=$_POST['fnombre'];
$descripcion=$_POST['fdescripcion'];
$insert_data = INSERT INTO
documentos (id, nombre, descripcion, fichero, nomfichero, tamfichero,
tipofichero)
VALUES ('', '$nombre','$descripcion','$binary', '$farchivo_name',
'$farchivo_size', '$farchivo_type');
mysql_query($insert_data,$conexion) or die(Couldn't insert data.);
header(Location: ../index.php?sec=doc0);
?

The code of the form is correct. This is the name of the input fields.

INPUT TYPE=\text\ NAME=\fnombre\ SIZE=\20\
CLASS=\identificationfield\;
TEXTAREA name=\fdescripcion\ cols=\40\ rows=\3\
CLASS=\identificationfield\/textarea;
INPUT type=\file\ name=\farchivo\ size=\30\
CLASS=\identificationfield\;

Any ideas?
Thank You.

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



RE: [PHP] PHP Installation Problems

2003-10-13 Thread Daniel Perez Clavero
RE: [PHP] PHP Installation ProblemsThis is my experience, I never chose the
PHP installation pack, I prefer the uncompressed version, modify the php.ini
and put the right dlls into the WINNT\System32 folder... I do not know what
windows is going to permit to the installation program (registry entries,
dlls substitution, etc).

I am running PHP 4.3.0 over W2K Advanced Server, but not using IIS, i´m
using Apache 1.3.27 as web server. Everything works fine.

I suggest that.

1.- Try to execute from the command line an easy script such php_info(),
Hello world or something like that in order to see if PHP is working.
2.- Try to lauch web browser and go to the root of the server in order to
see if webserver is working properly

If both are working, i suposed the error is that the webserver is not able
to understand that this request has to managed by php.exe

review this useful article por PHP on IIS

http://www.onlamp.com/pub/a/php/2000/12/14/php_admin.html

if you are running Apache, review the paths and extensions of httpd.conf
specially theese entries.

ServerRoot
LoadModule php4_module [path of the php4apache.dll)
AddModule mod_php4.c
Port
DocumentRoot
Directory and DirectoryIndex
AddType application/x-httpd-php .php

Regards.

This mesage is going to be forwarded to the list in order to let other
members sugest or add coments to your thread.

   -Original Message-
  From: Andrew Woolley [mailto:[EMAIL PROTECTED]
  Sent: lunes, 13 de octubre de 2003 14:05
  To: 'Daniel Perez Clavero'
  Subject: RE: [PHP] PHP Installation Problems


  Ok, Well I tried to install php 4.3.3 on a windows 2000 advanced server
box and it said that some ocx file was missing and I needed to set some
permissions.  So I set the permissions both in active directory on the
domain controller and on the local machine I had just installed php on.  Php
sccripts then loaded in IE as plain text (i could see the code).  I ran a
windows update on the server box and that has fixed the missing ocx file so
I can't tell you what that file was exactly.  However upon re-installation
of php 4.3.3 I was told at the end of the install process that again I had
to set the correct permissions.  These are set.  The confusing thing is that
now I cannot even open the php pages as plain text in IE, instead the
browser tells me that the page doesn't exist.  Please try and shed some
light on the situations as the company I am working for so far has only a
mailto: link in the contact page because I can't program asp.

  Please Help



  Thanks and Kind Regards



  Andrew Woolley
  168 Technology Ltd

  -Original Message-
  From: Daniel Perez Clavero [mailto:[EMAIL PROTECTED]
  Sent: 10 October 2003 13:42
  To: Andrew R. Woolley; [EMAIL PROTECTED]
  Subject: RE: [PHP] PHP Installation Problems



  Can you be a bit more explicit about errors? I´ve got some apache+PHP
  running on W2K Server box...

  -Original Message-
  From: Andrew Woolley [mailto:[EMAIL PROTECTED]
  Sent: viernes, 10 de octubre de 2003 14:11
  To: [EMAIL PROTECTED]
  Subject: [PHP] PHP Installation Problems





  -Original Message-
  From: Mehdi Achour [mailto:[EMAIL PROTECTED]
  Sent: 10 October 2003 12:28
  To: Andrew R. Woolley
  Cc: [EMAIL PROTECTED]
  Subject: Re: PHP Installation Problems



  Hi Andrew,

  Please ask support questions at [EMAIL PROTECTED]

  didou

   I use php a lot myself but have only ever installed it on my office pc
   (Win2K-Pro) and my home pc (WinXP-Pro).  However the company I work for
is
   now hosting there own site on one and the Win2K Advanved Server systems
in
   our comms room.  I have had problems installing PHP on this system but
  have
   no problems installing it on a workstation.  Is php compatible with the
   server software or do I have to run it on a linux box for this to work.
  
  
   Thanks and Kind Regards
  
  
  
   Andrew Woolley
   168 Technology Ltd
  
  
   HYPERLINK mailto:[EMAIL PROTECTED][EMAIL PROTECTED]
   +44 161 975 6260
   +44 7766513134
  
  
   ---
   Outgoing mail is certified Virus Free.
   Checked by AVG anti-virus system (http://www.grisoft.com).
   Version: 6.0.516 / Virus Database: 313 - Release Date: 01/09/2003
  
  



  ---
  Incoming mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.516 / Virus Database: 313 - Release Date: 01/09/2003



  ---
  Outgoing mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.516 / Virus Database: 313 - Release Date: 01/09/2003



  ---
  Incoming mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.516 / Virus Database: 313 - Release Date: 01/09/2003


  ---
  Outgoing mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.516 / Virus Database: 313 - Release Date: 01/09/2003



RE: [PHP] PHP Installation Problems

2003-10-10 Thread Daniel Perez Clavero
Can you be a bit more explicit about errors? I´ve got some apache+PHP
running on W2K Server box...

-Original Message-
From: Andrew Woolley [mailto:[EMAIL PROTECTED]
Sent: viernes, 10 de octubre de 2003 14:11
To: [EMAIL PROTECTED]
Subject: [PHP] PHP Installation Problems




-Original Message-
From: Mehdi Achour [mailto:[EMAIL PROTECTED]
Sent: 10 October 2003 12:28
To: Andrew R. Woolley
Cc: [EMAIL PROTECTED]
Subject: Re: PHP Installation Problems


Hi Andrew,

Please ask support questions at [EMAIL PROTECTED]

didou

 I use php a lot myself but have only ever installed it on my office pc
 (Win2K-Pro) and my home pc (WinXP-Pro).  However the company I work for is
 now hosting there own site on one and the Win2K Advanved Server systems in
 our comms room.  I have had problems installing PHP on this system but
have
 no problems installing it on a workstation.  Is php compatible with the
 server software or do I have to run it on a linux box for this to work.


 Thanks and Kind Regards



 Andrew Woolley
 168 Technology Ltd


 HYPERLINK mailto:[EMAIL PROTECTED][EMAIL PROTECTED]
 +44 161 975 6260
 +44 7766513134


 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.516 / Virus Database: 313 - Release Date: 01/09/2003




---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.516 / Virus Database: 313 - Release Date: 01/09/2003


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.516 / Virus Database: 313 - Release Date: 01/09/2003

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



RE: [PHP] Echo $PHP_SELF not working

2003-10-10 Thread Daniel Perez Clavero
try to use $_SERVER['PHP_SELF'] instead of.


-Original Message-
From: Jeff McKeon [mailto:[EMAIL PROTECTED]
Sent: viernes, 10 de octubre de 2003 14:09
To: php
Subject: [PHP] Echo $PHP_SELF not working


I've just published a new website and something is wrong.  I suspect the
PHP.ini on the server but I can't seem to find anything.

The line:

form method='post' action='?PHP ECHO $PHP_SELF ?'

Doesn't seem to work.  If I look at the view source from the web
browser I see this..

form method='post' action=''

On the development server I see this...

form method='post' action='/auth_user.php'

On the dev server ECHO $PHP_SELF seems to work but not on the
production one.  Any ideas what I've missed?

Thanks,

Jeff

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

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



RE: [PHP] array_diff()

2003-10-01 Thread Daniel Perez Clavero
No, but need to have same data types. You cannot compare String against
Integers and so

Regards

-Original Message-
From: Angelo Zanetti [mailto:[EMAIL PROTECTED]
Sent: miércoles, 01 de octubre de 2003 11:49
To: [EMAIL PROTECTED]
Subject: [PHP] array_diff()


HI all,

I looked at the PHP manual and it doesnt say much about this function. what
I want to know is that, do the 2 arrays have to have the same length of
number of elements?

TIA

--
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] removing an element from an array

2003-10-01 Thread Daniel Perez Clavero
Angelo,
Given array1 extract array2 from there, and put it into $array_result.

$array2[0]=Value to extract;
$array_result = array_diff ($array1, $array2);

Should work.
Rgrds.

-Original Message-
From: Angelo Zanetti [mailto:[EMAIL PROTECTED]
Sent: miércoles, 01 de octubre de 2003 12:25
To: [EMAIL PROTECTED]
Subject: [PHP] removing an element from an array


Hi

If I have an array and want to remove and element from this array. correct
me if this is the wrong approach:

create a temporary array with 1 element less than the origional array, get
the position of the element ( is there a function for this?) and then run
through the origional array copying all elements besides the element which
is meant to be removed.

Is there no function to do this? It seems like alot of overhead to do this
process, especially if the array is big. comments?

Angelo

--
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] removing an element from an array

2003-10-01 Thread Daniel Perez Clavero
Copy/Paste to a php file, and observe how it works. Maybe could be usefull
for u

?

$array1[0]=Red;
$array1[1]=Blue;
$array1[2]=White;
$array1[3]=Black;

$array2[0]=Blue;
$array2[1]=Black;

$array1_result_diff=array_diff($array1, $array2);

echo This is an array with colors not starting with B\B\/B;
echo BR;
echo var_dump($array1_result_diff);
echo BR;
echo BR;
echo BR;

$array2_result_diff=array_intersect($array1, $array2);
echo This is an array with colors starting with B\B\/B;
echo BR;
echo var_dump($array2_result_diff);
?



-Original Message-
From: Angelo Zanetti [mailto:[EMAIL PROTECTED]
Sent: miércoles, 01 de octubre de 2003 12:25
To: [EMAIL PROTECTED]
Subject: [PHP] removing an element from an array


Hi

If I have an array and want to remove and element from this array. correct
me if this is the wrong approach:

create a temporary array with 1 element less than the origional array, get
the position of the element ( is there a function for this?) and then run
through the origional array copying all elements besides the element which
is meant to be removed.

Is there no function to do this? It seems like alot of overhead to do this
process, especially if the array is big. comments?

Angelo

--
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] removing an element from an array

2003-10-01 Thread Daniel Perez Clavero
I know but was just a sample, try to use $array1 instead of $array_result.
Note: keys remain the same.

$array2[0]=Value to extract;
$array1 = array_diff ($array1, $array2);

-Original Message-
From: Dennis Sterzenbach [mailto:[EMAIL PROTECTED]
Sent: miércoles, 01 de octubre de 2003 13:24
To: [EMAIL PROTECTED]
Subject: Re: [PHP] removing an element from an array


Daniel Perez Clavero [EMAIL PROTECTED] wrote in
message
news:[EMAIL PROTECTED]
 Angelo,
 Given array1 extract array2 from there, and put it into $array_result.

 $array2[0]=Value to extract;
 $array_result = array_diff ($array1, $array2);

 Should work.
 Rgrds.

Well this only returns the differences between $array1 and $array2.
But it doesn't touch/change the arrays themselves.

--
 Dennis Sterzenbach
 www.darknoise.de

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