[PHP-DB] Optimizing Tables

2007-04-01 Thread Anna V

Hello group,

I just have a quick question for you all. Here is it... Is it advisable to
run optimize table after each deletion of a record?

Thanks in advance,

Anna Vester


Re: [PHP-DB] Optimizing Tables

2007-04-01 Thread Anna V

On 4/1/07, Bastien Koert [EMAIL PROTECTED] wrote:


I would say no, due to the overhead. What I would recommned is setting
that
up as a cron task and running it on a scheduled basis, usually when the
server is liightly loaded. Monitor the server and pick an optimal time.
This
is the same for all server mainenance type situations like index
monitoring
etc.



That sounds reasonable. Thanks alot for your quick response.


Re: [PHP-DB] Re: Showing various result from a mysql query

2005-10-05 Thread annA

Hi Juan,

Micah is correct.  You must try it in the Flash environment.

As I was lazy and didn't want to check all your php, I created a simple 
test file from your mail:


?php Header(Content-type: application/x-www-urlform-encoded);?
n=1Hora0=17:30:43Apellido0=garofaloId0=6Dia0=28Mes0=9Ano0=2005Nombre0=cristianDestinatario0=martan=1Hora0=17:30:43Apellido0=garofaloId0=6Dia0=28Mes0=9Ano0=2005Nombre0=cristianReceptor0=marilun=1Hora0=17:30:43Apellido0=garofaloId0=6Dia0=28Mes0=9Ano0=2005Nombre0=cristianDestinatario0=martan=1Hora0=17:30:43Apellido0=garofaloId0=6Dia0=28Mes0=9Ano0=2005Nombre0=cristian

Flash read it  seemed to parse the variables just fine.  That indicates 
that your php output is well-formed from the Flash point of view - well 
in the example given anyway!  ;)


If, after adding the header, you still have problems reading in the data 
in the example then the problem is more likely in the actionscript.


hth,
anna


---
Micah Stevens wrote:

Yes, that sounds correct, when flash requests the page directly, it will
realize it's URLEncoded (or should) and read the variables correctly.

Your browser on the other hand isn't built to display this information, 
so it

wants you to tell it where to save it.

-Micah

On Tuesday 04 October 2005 9:43 am, Juan Stiller wrote:
 Hi anna,

 Thanks for the suggestion, but it didn't worked, when
 i try it on the browser, it ask me if i want to
 download , open the file.

 Any other sugg?

  --- annA [EMAIL PROTECTED] escribi�:
  Hi Juan,
 
  I haven't read the list for a 'few' days so I'm
  sorry if you've been
  sweating over this, but if you haven't yet solved it
  then make sure you
  send a
 
  Header(Content-type:
  application/x-www-urlform-encoded);
 
  before your
 
  echo $rString;
 
  annA

 
---

-

  Subject:
  Showing various result from a mysql query
  From:
  Juan Stiller [EMAIL PROTECTED]
  Date:
  Thu, 29 Sep 2005 20:11:27 + (GMT)
  To:
  php-db@lists.php.net
 
  Hi, im working on a php file that its supposed to
  retrieve data from a mysql database, to send it to a
  flash animation to show the results. Thing is that
  im
  testing some modifications to the code, so if there
  is
  more than one entry, it shows all the results.
 
  For some reason probably a mistake on the code im
  getting this output when i try the muestra.php file
  on
  the browser:

 
n=1Hora0=17:30:43Apellido0=garofaloId0=6Dia0=28Mes0=9Ano0=2005Nombre

0=cristianDestinatario0=martan=1Hora0=17:30:43Apellido0=garofaloId0=6Di
a0=28Mes0=9Ano0=2005Nombre0=cristianReceptor0=marilun=1Hora0=17:30:43A
pellido0=garofaloId0=6Dia0=28Mes0=9Ano0=2005Nombre0=cristianDestinatar
io0=martan=1Hora0=17:30:43Apellido0=garofaloId0=6Dia0=28Mes0=9Ano0=200
5Nombre0=cristian

  This might not be wrong, but when i show info on the
  flash animation i get eg:
 
  Apellido0=garofalo , i dont want to get the n=x on
  the
  output, its supposed to be just an internal thing to
  tell flash that for the variable Apellido(lastname)
  there is more than one result and then to show all
  of
  them.
 
 
  This is the php code:
 
  ?php
  $conn = @mysql_connect(localhost, blah,
  blah23);
 
  if (!$conn) {
  echo( PNo se pudo conectar  .
  al servidor MySQL./P );
  exit();
  }
 
  if (! @mysql_select_db(llamadas) ) {
  echo( PNo se puede encontrar  .
  la base de datos clientes!/P );
  exit();
  }
 
  $qr = mysql_query(select * from datos);
  $nrows =
  mysql_num_rows($qr);
  $rString = n=.$nrows;
  for ($i=0; $i  $nrows; $i++) {
  $row = mysql_fetch_array($qr);
  $rstring .= Id.$i.=.$row['id'];
  $rString .=

 
Dia.$i.=.$row['dia'].Mes.$i.=.$row['mes'].Ano.$i.=.$row['ano

'];

  $rString .=

 Hora.$i.=.$row['hora'].Minutos.$i.=.$row['minutos'];

  $rString .= Receptor.$i.=.$row['receptor'].
  $rString .=
  Destinatario.$i.=.$row['destinatario'].
  $rString .= Apellido.$i.=.$row['apellido'].
  $rstring .= Nombre.$i.=.$row['nombre'];
  $rstring .= Telefono.$i.=.$row['telefono'];
  $rstring .= Asunto.$i.=.$row['asunto'];
  }
  echo $rString;
  mysql_free_result($qr);
  ?
 
  Also, i was told that including password and user to
  connect to mysql server sholdn´t be shown on the php
  file, so i have to use include_one and the file, but
  i
  don´t know exaclty the syntax, can anybody help me
  with it?
 
  Thanks in advance.

 ___
 1GB gratis, Antivirus y Antispam
 Correo Yahoo!, el mejor correo web del mundo
 http://correo.yahoo.com.ar

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



Re: [PHP-DB] Re: Showing various result from a mysql query

2005-10-05 Thread annA

Hi Juan

I'd put it at the beginning of the php script if it's always going to be 
sending its data to Flash, and certainly before ANY output:


?php
header(Content-type:application/x-www-urlform-encoded);
$conn = @mysql_connect(localhost, blah,blah23);


header is pretty useful: http://uk2.php.net/manual/en/function.header.php

By the way the mysql-related error messages in your script such as 
PNo se pudo conectar al servidor MySQL./P aren't going to be shown 
in Flash as there's no variable=.


It looks like the code was used for sending html to a browser and is in 
the process of being adapted for Flash.  Not too far to go now...


anNa



Juan Stiller wrote:

Hi Anna:

I feel kinda stupid, asking the same thing more than
twice, but should i add:

?php
Header(Content-type:application/x-www-urlform-encoded);
?

On the php script? or on the as code of the
animation??

Thanks for the patience and the help.

Juan.

 --- annA [EMAIL PROTECTED] escribió:



Hi Juan,

Micah is correct.  You must try it in the Flash
environment.

As I was lazy and didn't want to check all your php,
I created a simple 
test file from your mail:


?php Header(Content-type:
application/x-www-urlform-encoded);?


n=1Hora0=17:30:43Apellido0=garofaloId0=6Dia0=28Mes0=9Ano0=2005Nombre0=cristianDestinatario0=martan=1Hora0=17:30:43Apellido0=garofaloId0=6Dia0=28Mes0=9Ano0=2005Nombre0=cristianReceptor0=marilun=1Hora0=17:30:43Apellido0=garofaloId0=6Dia0=28Mes0=9Ano0=2005Nombre0=cristianDestinatario0=martan=1Hora0=17:30:43Apellido0=garofaloId0=6Dia0=28Mes0=9Ano0=2005Nombre0=cristian


Flash read it  seemed to parse the variables just
fine.  That indicates 
that your php output is well-formed from the Flash
point of view - well 
in the example given anyway!  ;)


If, after adding the header, you still have problems
reading in the data 
in the example then the problem is more likely in

the actionscript.

hth,
anna





---


Micah Stevens wrote:

Yes, that sounds correct, when flash requests the
page directly, it will
realize it's URLEncoded (or should) and read the
variables correctly.

Your browser on the other hand isn't built to
display this information, 
so it

wants you to tell it where to save it.

-Micah

On Tuesday 04 October 2005 9:43 am, Juan Stiller
wrote:
 Hi anna,

 Thanks for the suggestion, but it didn't worked,
when
 i try it on the browser, it ask me if i want to
 download , open the file.

 Any other sugg?

  --- annA [EMAIL PROTECTED] escribi�:
  Hi Juan,
 
  I haven't read the list for a 'few' days so I'm
  sorry if you've been
  sweating over this, but if you haven't yet
solved it
  then make sure you
  send a
 
  Header(Content-type:
  application/x-www-urlform-encoded);
 
  before your
 
  echo $rString;
 
  annA

 



---


-

  Subject:
  Showing various result from a mysql query
  From:
  Juan Stiller [EMAIL PROTECTED]
  Date:
  Thu, 29 Sep 2005 20:11:27 + (GMT)
  To:
  php-db@lists.php.net
 
  Hi, im working on a php file that its supposed
to
  retrieve data from a mysql database, to send it
to a
  flash animation to show the results. Thing is
that
  im
  testing some modifications to the code, so if
there
  is
  more than one entry, it shows all the results.
 
  For some reason probably a mistake on the code
im
  getting this output when i try the muestra.php
file
  on
  the browser:

 



n=1Hora0=17:30:43Apellido0=garofaloId0=6Dia0=28Mes0=9Ano0=2005Nombre



0=cristianDestinatario0=martan=1Hora0=17:30:43Apellido0=garofaloId0=6Di


a0=28Mes0=9Ano0=2005Nombre0=cristianReceptor0=marilun=1Hora0=17:30:43A


pellido0=garofaloId0=6Dia0=28Mes0=9Ano0=2005Nombre0=cristianDestinatar


io0=martan=1Hora0=17:30:43Apellido0=garofaloId0=6Dia0=28Mes0=9Ano0=200
5Nombre0=cristian

  This might not be wrong, but when i show info
on the
  flash animation i get eg:
 
  Apellido0=garofalo , i dont want to get the n=x
on
  the
  output, its supposed to be just an internal
thing to
  tell flash that for the variable
Apellido(lastname)
  there is more than one result and then to show
all
  of
  them.
 
 
  This is the php code:
 
  ?php
  $conn = @mysql_connect(localhost, blah,
  blah23);
 
  if (!$conn) {
  echo( PNo se pudo conectar  .
  al servidor MySQL./P );
  exit();
  }
 
  if (! @mysql_select_db(llamadas) ) {
  echo( PNo se puede encontrar  .
  la base de datos clientes!/P );
  exit();
  }
 
  $qr = mysql_query(select * from datos);
  $nrows =
  mysql_num_rows($qr);
  $rString = n=.$nrows;
  for ($i=0; $i  $nrows; $i++) {
  $row = mysql_fetch_array($qr);
  $rstring .= Id.$i.=.$row['id'];
  $rString .=

 



Dia.$i.=.$row['dia'].Mes.$i.=.$row['mes'].Ano.$i.=.$row['ano


'];

  $rString .=




Hora.$i.=.$row['hora'].Minutos.$i.=.$row['minutos'];



  $rString .=
Receptor.$i.=.$row['receptor'].
  $rString .=
  Destinatario.$i.=.$row['destinatario'].
  $rString

[PHP-DB] Re: Showing various result from a mysql query

2005-10-03 Thread annA

Hi Juan,

I haven't read the list for a 'few' days so I'm sorry if you've been 
sweating over this, but if you haven't yet solved it then make sure you 
send a


Header(Content-type: application/x-www-urlform-encoded);

before your

echo $rString;

annA


Subject:
Showing various result from a mysql query
From:
Juan Stiller [EMAIL PROTECTED]
Date:
Thu, 29 Sep 2005 20:11:27 + (GMT)
To:
php-db@lists.php.net

Hi, im working on a php file that its supposed to
retrieve data from a mysql database, to send it to a
flash animation to show the results. Thing is that im
testing some modifications to the code, so if there is
more than one entry, it shows all the results.

For some reason probably a mistake on the code im
getting this output when i try the muestra.php file on
the browser:

n=1Hora0=17:30:43Apellido0=garofaloId0=6Dia0=28Mes0=9Ano0=2005Nombre0=cristianDestinatario0=martan=1Hora0=17:30:43Apellido0=garofaloId0=6Dia0=28Mes0=9Ano0=2005Nombre0=cristianReceptor0=marilun=1Hora0=17:30:43Apellido0=garofaloId0=6Dia0=28Mes0=9Ano0=2005Nombre0=cristianDestinatario0=martan=1Hora0=17:30:43Apellido0=garofaloId0=6Dia0=28Mes0=9Ano0=2005Nombre0=cristian

This might not be wrong, but when i show info on the
flash animation i get eg:

Apellido0=garofalo , i dont want to get the n=x on the
output, its supposed to be just an internal thing to
tell flash that for the variable Apellido(lastname)
there is more than one result and then to show all of
them.


This is the php code:

?php
$conn = @mysql_connect(localhost, blah, blah23);

if (!$conn) {
echo( PNo se pudo conectar  .
al servidor MySQL./P );
exit();
}

if (! @mysql_select_db(llamadas) ) {
echo( PNo se puede encontrar  .
la base de datos clientes!/P );
exit();
}

$qr = mysql_query(select * from datos);
$nrows =
mysql_num_rows($qr);
$rString = n=.$nrows;
for ($i=0; $i  $nrows; $i++) {
$row = mysql_fetch_array($qr);
$rstring .= Id.$i.=.$row['id'];
$rString .=
Dia.$i.=.$row['dia'].Mes.$i.=.$row['mes'].Ano.$i.=.$row['ano'];
$rString .=
Hora.$i.=.$row['hora'].Minutos.$i.=.$row['minutos'];
$rString .= Receptor.$i.=.$row['receptor'].
$rString .=
Destinatario.$i.=.$row['destinatario'].
$rString .= Apellido.$i.=.$row['apellido'].
$rstring .= Nombre.$i.=.$row['nombre'];
$rstring .= Telefono.$i.=.$row['telefono'];
$rstring .= Asunto.$i.=.$row['asunto'];
}
echo $rString;
mysql_free_result($qr);
?

Also, i was told that including password and user to
connect to mysql server sholdn´t be shown on the php
file, so i have to use include_one and the file, but i
don´t know exaclty the syntax, can anybody help me
with it?

Thanks in advance.








___
1GB gratis, Antivirus y Antispam
Correo Yahoo!, el mejor correo web del mundo
http://correo.yahoo.com.ar

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



Re: [PHP-DB] Duplicate record

2005-08-03 Thread annA
Hello,
How about this for a different method:

The php that displays the form writes an extra hidden field to the
form, containing a random string value.  It also writes that random
string along with a timestamp to a database table, called say,
form_control.  The form action sends to a separate php page.

The receiving php page does a delete from form_control where
control_string = $sanitisedhiddenformfield.
If mysql_affected_rows() == 1 then go ahead and perform the user
data insert.
If it's not 1 then you either have a duplicate submit/refresh (as
the control record has already been deleted) or you have a hacker
calling your processing php directly.
So this is nice to deter them too.  You can also add another where
clause based on the timestamp if you wish to time out forms that have
been sitting around.  Other refinements are possible but that's the
bare bones.

To clean up unsubmitted form control strings either of the php
processes can do an additional 'delete from form_control where
timestampcolumn  ' whenever  (sorry I can't remember datetime
functions off the top of my head!).

This method is nice as it doesn't affect the real user data table or
indexes and has anti-hacker side benefits.

anNa

 From: Hallvard [EMAIL PROTECTED]
 To: php-db@lists.php.net
 Date: Sat, 30 Jul 2005 12:17:16 +0200
 Subject: Duplicate record
 I have a page that posts data from a form to a mysql database.
 
 The problem is that if the user hits the reload button on the browser, the
 data will be posted again, resulting in a duplicate record.
 
 How can I avoid that?

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



RE: [PHP-DB] MYSQL Maximum Time Exceeded

2004-12-16 Thread aNNa
 This not be what you need, but I think there are some squiggle brackets
missing.

The curly brackets aren't the problem as they're not needed for just
one statement.

Examples at: 
http://www.php.net/manual/en/language.control-structures.php#control-structures.if

anna

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



Re: [PHP-DB] PHP-HTML-select deny

2004-12-13 Thread aNNa
Hi,

sorry this is a bit late - just got back from holiday :)

Don't forget css can be disabled very easily in Firefox  Opera.

So to disable printing too, if you're using the Flash method, then put
an empty frame in the movie and make it the only printable frame
(label #p).  Then what the site visitor sees is the text but the
player will only give the blank frame for printing.

Of course there's still the Print Screen button... ;)

Sorry this is getting OT, extreme requirements lead to odd solutions...

anna


 this bit of .css
 
 @media print { body { display:  none; } }
 
 Then viewer can't print the page. We do this because only certain
 subscribers have printing privileges.

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


RE: [PHP-DB] PHP-HTML-select deny

2004-12-01 Thread aNNa
 Hi, what can i do, where users can't select and copy my text from
 web-page.

Not that I've ever seen the need but this would deter casual copying:

Make a Flash movie with a dynamic, non-selectable text field.  The
movie can load the text (actionscript command is loadVariables) from a
database or a text file via php (or other server side language), or
directly from a text file (but beware of the text file being directly
accessible to a browser).

It's crackable but depends on whether it's worth the effort.

Overkill? Quite probably!

anna

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