foreach

2 views
Skip to first unread message

Luis Fernando Gramajo P.

unread,
Dec 16, 2009, 5:46:57 PM12/16/09
to ph...@googlegroups.com
Saludos a todos!!

Tengo el siguiente codigo, en el cual no se porque !#"$&/ no me
muestra todos los valores del arreglo, solo me repite el valor del
primero. Se que tiene que ser algo sencillo, pero ya estoy turneo de
ver el codigo. Talvez alguien con la cabeza fresca vea el error en un
par de segundos... gracias.

if(is_array($_data))
{
foreach($_data as $ft_table_name => $_temp)
{
?>
<tr>
<td><?php echo $ft_table_name; ?></td>
<td align="right" nowrap="nowrap"><?php echo (int)$_temp->Rows; ?></td>
<td align="right" nowrap="nowrap"><?php echo
size_readable(($_temp->Data_length + $_temp->Index_length), null,
'bi', '%01.2f %s'); ?></td>
<td align="right" nowrap="nowrap"><?php echo
size_readable($_temp->Data_free, null, 'bi', '%01.2f %s'); ?></td>
</tr>
<?php
} // end foreach
?>
</tbody>
</table>
<?php
} // end if
} // end if


--~--~---------~--~---------~--~---------~--~---------~--~---------~--~-------
-- Luis Fernando Gramajo P.

http://www.guatewireless.org
--~--~---------~--~---------~--~---------~--~---------~--~---------~--~-------

Attakinsky

unread,
Dec 16, 2009, 6:58:36 PM12/16/09
to ph...@googlegroups.com
no lo tengo claro, pero como comentario adicional, te recomendaria cambiar los 
 } // end foreach y
 } // end if
por 
endforeach; // y
endif; // respectivamente
así tu codigo mezclado con html se hace un poco mas facil de leer

·_  _  _  ·_  _·_  ··  _·  ···  _·_  _·__
José Blanco - Web Developer
____________________________________
Follow me: http://twitter.com/attakinsky
http://attakinsky.com - Programación, no diseño
http://www.cule100x100.com - Mi opinión sobre el FC Barcelona
http://alapin.wordpress.com/ - Aplicación de la teoría ajedrecística


2009/12/16 Luis Fernando Gramajo P. <fhe...@gmail.com>

--
PHPGT :: Grupo de PHPeros de Guatemala
email: ph...@googlegroups.com
www:   http://php.develsystems.com | http://groups.google.com/group/phpgt/

Stuardo -StR- Rodríguez

unread,
Dec 16, 2009, 7:09:23 PM12/16/09
to ph...@googlegroups.com
Si, como dice blanco.. es mas legible

http://slexy.org/view/s20qF8acON

que lo anterior.. Así me di cuenta que sobraba un cierre de if.. pero el código lo veo bien. Seguro tu helper está bien?

2009/12/16 Attakinsky <josebl...@gmail.com>

Luis Fernando Gramajo P.

unread,
Dec 17, 2009, 10:43:39 AM12/17/09
to ph...@googlegroups.com
Si definitivamente se ve mejor, gracias. Pero si dicen que no ven nada
raro con mi codigo, no entiendo porque no recorre e imprime el
arreglo.


--~--~---------~--~---------~--~---------~--~---------~--~---------~--~-------
-- Luis Fernando Gramajo P.

http://www.guatewireless.org
--~--~---------~--~---------~--~---------~--~---------~--~---------~--~-------


2009/12/16 Stuardo -StR- Rodríguez <s...@maphpia.com>:

Attakinsky

unread,
Dec 17, 2009, 10:47:50 AM12/17/09
to ph...@googlegroups.com
pos es q ni hemos visto el dump del arreglo, o una parte de el como para saber q onda :P

Attakinsky

unread,
Dec 17, 2009, 10:49:24 AM12/17/09
to ph...@googlegroups.com
otra cosa, Str te preguntaba si estabas seguro que tu helper (size_readable asumo yo) funcionaba bien


·_  _  _  ·_  _·_  ··  _·  ···  _·_  _·__
José Blanco - Web Developer
____________________________________
Follow me: http://twitter.com/attakinsky
http://attakinsky.com - Programación, no diseño
http://www.cule100x100.com - Mi opinión sobre el FC Barcelona
http://alapin.wordpress.com/ - Aplicación de la teoría ajedrecística


2009/12/17 Attakinsky <josebl...@gmail.com>

Stuardo -StR- Rodríguez

unread,
Dec 17, 2009, 10:52:24 AM12/17/09
to ph...@googlegroups.com
y también dije que vi que sobraba un cierre  }  (endif creo?)

2009/12/17 Attakinsky <josebl...@gmail.com>

Luis Fernando Gramajo P.

unread,
Dec 17, 2009, 10:54:24 AM12/17/09
to ph...@googlegroups.com
si es que viene de hasta arriba ese if, pero ahora les mando el bloque


--~--~---------~--~---------~--~---------~--~---------~--~---------~--~-------
-- Luis Fernando Gramajo P.

http://www.guatewireless.org
--~--~---------~--~---------~--~---------~--~---------~--~---------~--~-------


2009/12/17 Stuardo -StR- Rodríguez <s...@maphpia.com>:

Luis Fernando Gramajo P.

unread,
Dec 17, 2009, 11:08:02 AM12/17/09
to ph...@googlegroups.com
Ok llega el codigo,

http://slexy.org/view/s2FSkiQwK4


Hasta arriba esta la funcion que tome prestada.

--~--~---------~--~---------~--~---------~--~---------~--~---------~--~-------
-- Luis Fernando Gramajo P.

http://www.guatewireless.org
--~--~---------~--~---------~--~---------~--~---------~--~---------~--~-------

Luis Fernando Gramajo P.

unread,
Dec 17, 2009, 11:08:48 AM12/17/09
to ph...@googlegroups.com
Y aca el display

Database Tables
Table Rows Size Overhead
comments 7 8.70 KiB 0.00 B
links 7 8.70 KiB 0.00 B
options 7 8.70 KiB 0.00 B
postmeta 7 8.70 KiB 0.00 B
posts 7 8.70 KiB 0.00 B
term_relationships 7 8.70 KiB 0.00 B
term_taxonomy 7 8.70 KiB 0.00 B
terms 7 8.70 KiB 0.00 B
usermeta 7 8.70 KiB 0.00 B
users 7 8.70 KiB 0.00 B


--~--~---------~--~---------~--~---------~--~---------~--~---------~--~-------
-- Luis Fernando Gramajo P.

http://www.guatewireless.org
--~--~---------~--~---------~--~---------~--~---------~--~---------~--~-------


On Thu, Dec 17, 2009 at 10:08 AM, Luis Fernando Gramajo P.

Stuardo Rodriguez

unread,
Dec 17, 2009, 11:34:58 AM12/17/09
to ph...@googlegroups.com
Si te das cuenta, la llave si cambia, osea que el foreach está bien. Parece ser que todos los elementos de tu arrelgo tienen los mismos valores..

Vardumpeá $_array despueś de asignarlo y peganos tu dump para ver que tiene el arreglo?

$_array = mysql_tables();
vardump_(
$_array);

Luis Fernando Gramajo P.

unread,
Dec 17, 2009, 11:54:31 AM12/17/09
to ph...@googlegroups.com
Esto salio con el vardump

array(10) { ["comments"]=> string(11) "wp_comments" ["links"]=>
string(8) "wp_links" ["options"]=> string(10) "wp_options"
["postmeta"]=> string(11) "wp_postmeta" ["posts"]=> string(8)
"wp_posts" ["term_relationships"]=> string(21)
"wp_term_relationships" ["term_taxonomy"]=> string(16)
"wp_term_taxonomy" ["terms"]=> string(8) "wp_terms" ["usermeta"]=>
string(11) "wp_usermeta" ["users"]=> string(8) "wp_users" }


gracias por la ayuda.

A decir verdad el output que les mande anteriormente despliega el
nombre de las tablas correctamente. Pero cuando el resultado del
size_redable es el que no cambia.

--~--~---------~--~---------~--~---------~--~---------~--~---------~--~-------
-- Luis Fernando Gramajo P.

http://www.guatewireless.org
--~--~---------~--~---------~--~---------~--~---------~--~---------~--~-------


2009/12/17 Stuardo Rodriguez <s...@strgt.cjb.net>:

Luis Fernando Gramajo P.

unread,
Dec 17, 2009, 12:02:30 PM12/17/09
to ph...@googlegroups.com
Puse el vardump tambien aca

# Ir por las tablas del MySQL

$_array = mysql_tables();
var_dump($_array);

if(is_array($_array))

{

foreach($_array as $key => $ft_table_name)

{

$_temp = $wpdb->get_row("SHOW TABLE STATUS ");

$overhead = $overhead + (int)$_temp->Data_free;

$_data[$key] = $_temp;
----------> echo("<br/>"); echo("<br/>");
var_dump($_data[$key]);

} // end foreach

asort($_data); //NO LO CONSIDERO NECESARIO testing
echo("<br/>"); echo("<br/>");
--------> var_dump($_data);
echo("<br/>"); echo("<br/>");


Y del dump me despliega lo mismo una y orta vez... aca esta el clavo entonces:

array(10) { ["comments"]=> object(stdClass)#148 (18) { ["Name"]=>
string(11) "fh_comments" ["Engine"]=> string(6) "MyISAM"
["Version"]=> string(2) "10" ["Row_format"]=> string(7) "Dynamic"
["Rows"]=> string(1) "7" ["Avg_row_length"]=> string(3) "395"
["Data_length"]=> string(4) "2768" ["Max_data_length"]=> string(15)
"281474976710655" ["Index_length"]=> string(4) "6144" ["Data_free"]=>
string(1) "0" ["Auto_increment"]=> string(5) "14369"
["Create_time"]=> string(19) "2009-12-15 17:26:33" ["Update_time"]=>
string(19) "2009-12-15 17:26:34" ["Check_time"]=> NULL
["Collation"]=> string(17) "latin1_swedish_ci" ["Checksum"]=> NULL
["Create_options"]=> string(0) "" ["Comment"]=> string(0) "" }
["links"]=> object(stdClass)#158 (18) { ["Name"]=> string(11)
"fh_comments" ["Engine"]=> string(6) "MyISAM" ["Version"]=>
string(2) "10" ["Row_format"]=> string(7) "Dynamic" ["Rows"]=>
string(1) "7" ["Avg_row_length"]=> string(3) "395" ["Data_length"]=>
string(4) "2768" ["Max_data_length"]=> string(15) "281474976710655"
["Index_length"]=> string(4) "6144" ["Data_free"]=> string(1) "0"
["Auto_increment"]=> string(5) "14369" ["Create_time"]=> string(19)
"2009-12-15 17:26:33" ["Update_time"]=> string(19) "2009-12-15
17:26:34" ["Check_time"]=> NULL ["Collation"]=> string(17)
"latin1_swedish_ci" ["Checksum"]=> NULL ["Create_options"]=>
string(0) "" ["Comment"]=> string(0) "" } ["options"]=>
object(stdClass)#159 (18) { ["Name"]=> string(11) "fh_comments"
["Engine"]=> string(6) "MyISAM" ["Version"]=> string(2) "10"
["Row_format"]=> string(7) "Dynamic" ["Rows"]=> string(1) "7"
["Avg_row_length"]=> string(3) "395" ["Data_length"]=> string(4)
"2768" ["Max_data_length"]=> string(15) "281474976710655"
["Index_length"]=> string(4) "6144" ["Data_free"]=> string(1) "0"
["Auto_increment"]=> string(5) "14369" ["Create_time"]=> string(19)
"2009-12-15 17:26:33" ["Update_time"]=> string(19) "2009-12-15
17:26:34" ["Check_time"]=> NULL ["Collation"]=> string(17)
"latin1_swedish_ci" ["Checksum"]=> NULL ["Create_options"]=>
string(0) "" ["Comment"]=> string(0) "" } ["postmeta"]=>
object(stdClass)#160 (18) { ["Name"]=> string(11) "fh_comments"
["Engine"]=> string(6) "MyISAM" ["Version"]=> string(2) "10"
["Row_format"]=> string(7) "Dynamic" ["Rows"]=> string(1) "7"
["Avg_row_length"]=> string(3) "395" ["Data_length"]=> string(4)
"2768" ["Max_data_length"]=> string(15) "281474976710655"
["Index_length"]=> string(4) "6144" ["Data_free"]=> string(1) "0"
["Auto_increment"]=> string(5) "14369" ["Create_time"]=> string(19)
"2009-12-15 17:26:33" ["Update_time"]=> string(19) "2009-12-15
17:26:34" ["Check_time"]=> NULL ["Collation"]=> string(17)
"latin1_swedish_ci" ["Checksum"]=> NULL ["Create_options"]=>
string(0) "" ["Comment"]=> string(0) "" } ["posts"]=>

--~--~---------~--~---------~--~---------~--~---------~--~---------~--~-------
-- Luis Fernando Gramajo P.

http://www.guatewireless.org
--~--~---------~--~---------~--~---------~--~---------~--~---------~--~-------


2009/12/17 Luis Fernando Gramajo P. <fhe...@gmail.com>:

Stuardo -StR- Rodríguez

unread,
Dec 17, 2009, 1:56:50 PM12/17/09
to ph...@googlegroups.com
Stá medio pizado leer el vardump.. podrías  c&p con espacios y todo  para que sea mas fácil leerlo?

2009/12/17 Luis Fernando Gramajo P. <fhe...@gmail.com>
Puse el vardump tambien aca

array(10) { ["comments"]=>  object(stdClass)#148 (18) { ["Name"]=>
string(11) "fh_comments" ["Engine"]=>  string(6) "MyISAM"
["Version"]=>  string(2) "10" ["Row_format"]=>  string(7) "Dynamic"
["Rows"]=>  string(1) "7" ["Avg_row_length"]=>  string(3) "395"
["Data_length"]=>  string(4) "2768" ["Max_data_length"]=>  string(15)
"281474976710655" ["Index_length"]=>  string(4) "6144" ["Data_free"]=>
 string(1) "0" ["Auto_increment"]=>  string(5) "14369"
["Create_time"]=>  string(19) "2009-12-15 17:26:33" ["Update_time"]=>
string(19) "2009-12-15 17:26:34" ["Check_time"]=>  NULL ......

elMaxx!

unread,
Dec 17, 2009, 1:58:23 PM12/17/09
to ph...@googlegroups.com
mas facil...

echo '<pre />'; var_dump($var); die();
--
[Citation Needed]



--

Luis Fernando Gramajo P.

unread,
Dec 17, 2009, 3:11:21 PM12/17/09
to ph...@googlegroups.com
Ok, gracias por el consejo.. ahi va.

array(10) {
["comments"]=>
string(11) "wp_comments"
["links"]=>
string(8) "wp_links"
["options"]=>
string(10) "wp_options"
["postmeta"]=>
string(11) "wp_postmeta"
["posts"]=>
string(8) "wp_posts"
["term_relationships"]=>
string(21) "wp_term_relationships"
["term_taxonomy"]=>
string(16) "wp_term_taxonomy"
["terms"]=>
string(8) "wp_terms"
["usermeta"]=>
string(11) "wp_usermeta"
["users"]=>
string(8) "wp_users"
}


Pero si dicen que el codigo anterior esta bien, sospecho que va por la
funcion para sacar las tablas.

--~--~---------~--~---------~--~---------~--~---------~--~---------~--~-------
-- Luis Fernando Gramajo P.

http://www.guatewireless.org
--~--~---------~--~---------~--~---------~--~---------~--~---------~--~-------

Luis Fernando Gramajo P.

unread,
Dec 17, 2009, 3:17:48 PM12/17/09
to ph...@googlegroups.com
Puse un vardump para $_temp dentro del for que despleiga la info de las tablas


<?php if(is_array($_data)) :?>
<?php foreach($_data as $ft_table_name => $_temp) :?>
<tr>
<? echo '<pre />'; var_dump($_temp); ?>


<td><?php echo $ft_table_name; ?></td>
<td align="right" nowrap="nowrap">
<?php echo (int)$_temp->Rows; ?>
</td>
<td align="right" nowrap="nowrap">
<?php echo size_readable(($_temp->Data_length
+ $_temp->Index_length), null, 'bi', '%01.2f %s'); ?>
</td>
<td align="right" nowrap="nowrap">
<?php echo size_readable($_temp->Data_free,
null, 'bi', '%01.2f %s'); ?>
</td>
</tr>

<?php endforeach; ?>
</tbody>
</table>
<?php endif;

Y me despleiga lo siguiente:


object(stdClass)#148 (18) {
["Name"]=>
string(11) "wp_comments"


["Engine"]=>
string(6) "MyISAM"
["Version"]=>
string(2) "10"
["Row_format"]=>
string(7) "Dynamic"
["Rows"]=>

string(1) "1"
["Avg_row_length"]=>
string(3) "232"
["Data_length"]=>
string(3) "232"


["Max_data_length"]=>
string(15) "281474976710655"
["Index_length"]=>
string(4) "6144"
["Data_free"]=>
string(1) "0"
["Auto_increment"]=>

string(1) "2"
["Create_time"]=>
string(19) "2009-12-15 16:38:30"
["Update_time"]=>
string(19) "2009-12-15 16:38:30"
["Check_time"]=>
string(19) "2009-12-15 17:18:27"
["Collation"]=>
string(15) "utf8_general_ci"


["Checksum"]=>
NULL
["Create_options"]=>
string(0) ""
["Comment"]=>
string(0) ""
}

object(stdClass)#157 (18) {
["Name"]=>
string(11) "wp_comments"


["Engine"]=>
string(6) "MyISAM"
["Version"]=>
string(2) "10"
["Row_format"]=>
string(7) "Dynamic"
["Rows"]=>

string(1) "1"
["Avg_row_length"]=>
string(3) "232"
["Data_length"]=>
string(3) "232"


["Max_data_length"]=>
string(15) "281474976710655"
["Index_length"]=>
string(4) "6144"
["Data_free"]=>
string(1) "0"
["Auto_increment"]=>

string(1) "2"
["Create_time"]=>
string(19) "2009-12-15 16:38:30"
["Update_time"]=>
string(19) "2009-12-15 16:38:30"
["Check_time"]=>
string(19) "2009-12-15 17:18:27"
["Collation"]=>
string(15) "utf8_general_ci"


["Checksum"]=>
NULL
["Create_options"]=>
string(0) ""
["Comment"]=>
string(0) ""
}

object(stdClass)#158 (18) {
["Name"]=>
string(11) "wp_comments"


["Engine"]=>
string(6) "MyISAM"
["Version"]=>
string(2) "10"
["Row_format"]=>
string(7) "Dynamic"
["Rows"]=>

string(1) "1"
["Avg_row_length"]=>
string(3) "232"
["Data_length"]=>
string(3) "232"


["Max_data_length"]=>
string(15) "281474976710655"
["Index_length"]=>
string(4) "6144"
["Data_free"]=>
string(1) "0"
["Auto_increment"]=>

string(1) "2"
["Create_time"]=>
string(19) "2009-12-15 16:38:30"
["Update_time"]=>
string(19) "2009-12-15 16:38:30"
["Check_time"]=>
string(19) "2009-12-15 17:18:27"
["Collation"]=>
string(15) "utf8_general_ci"


["Checksum"]=>
NULL
["Create_options"]=>
string(0) ""
["Comment"]=>
string(0) ""
}

object(stdClass)#159 (18) {
["Name"]=>
string(11) "wp_comments"


["Engine"]=>
string(6) "MyISAM"
["Version"]=>
string(2) "10"
["Row_format"]=>
string(7) "Dynamic"
["Rows"]=>

string(1) "1"
["Avg_row_length"]=>
string(3) "232"
["Data_length"]=>
string(3) "232"


["Max_data_length"]=>
string(15) "281474976710655"
["Index_length"]=>
string(4) "6144"
["Data_free"]=>
string(1) "0"
["Auto_increment"]=>

string(1) "2"
["Create_time"]=>
string(19) "2009-12-15 16:38:30"
["Update_time"]=>
string(19) "2009-12-15 16:38:30"
["Check_time"]=>
string(19) "2009-12-15 17:18:27"
["Collation"]=>
string(15) "utf8_general_ci"


["Checksum"]=>
NULL
["Create_options"]=>
string(0) ""
["Comment"]=>
string(0) ""
}

object(stdClass)#160 (18) {
["Name"]=>
string(11) "wp_comments"


["Engine"]=>
string(6) "MyISAM"
["Version"]=>
string(2) "10"
["Row_format"]=>
string(7) "Dynamic"
["Rows"]=>

string(1) "1"
["Avg_row_length"]=>
string(3) "232"
["Data_length"]=>
string(3) "232"


["Max_data_length"]=>
string(15) "281474976710655"
["Index_length"]=>
string(4) "6144"
["Data_free"]=>
string(1) "0"
["Auto_increment"]=>

string(1) "2"
["Create_time"]=>
string(19) "2009-12-15 16:38:30"
["Update_time"]=>
string(19) "2009-12-15 16:38:30"
["Check_time"]=>
string(19) "2009-12-15 17:18:27"
["Collation"]=>
string(15) "utf8_general_ci"


["Checksum"]=>
NULL
["Create_options"]=>
string(0) ""
["Comment"]=>
string(0) ""
}

object(stdClass)#161 (18) {
["Name"]=>
string(11) "wp_comments"


["Engine"]=>
string(6) "MyISAM"
["Version"]=>
string(2) "10"
["Row_format"]=>
string(7) "Dynamic"
["Rows"]=>

string(1) "1"
["Avg_row_length"]=>
string(3) "232"
["Data_length"]=>
string(3) "232"


["Max_data_length"]=>
string(15) "281474976710655"
["Index_length"]=>
string(4) "6144"
["Data_free"]=>
string(1) "0"
["Auto_increment"]=>

string(1) "2"
["Create_time"]=>
string(19) "2009-12-15 16:38:30"
["Update_time"]=>
string(19) "2009-12-15 16:38:30"
["Check_time"]=>
string(19) "2009-12-15 17:18:27"
["Collation"]=>
string(15) "utf8_general_ci"


["Checksum"]=>
NULL
["Create_options"]=>
string(0) ""
["Comment"]=>
string(0) ""
}

object(stdClass)#162 (18) {
["Name"]=>
string(11) "wp_comments"


["Engine"]=>
string(6) "MyISAM"
["Version"]=>
string(2) "10"
["Row_format"]=>
string(7) "Dynamic"
["Rows"]=>

string(1) "1"
["Avg_row_length"]=>
string(3) "232"
["Data_length"]=>
string(3) "232"


["Max_data_length"]=>
string(15) "281474976710655"
["Index_length"]=>
string(4) "6144"
["Data_free"]=>
string(1) "0"
["Auto_increment"]=>

string(1) "2"
["Create_time"]=>
string(19) "2009-12-15 16:38:30"
["Update_time"]=>
string(19) "2009-12-15 16:38:30"
["Check_time"]=>
string(19) "2009-12-15 17:18:27"
["Collation"]=>
string(15) "utf8_general_ci"


["Checksum"]=>
NULL
["Create_options"]=>
string(0) ""
["Comment"]=>
string(0) ""
}

object(stdClass)#163 (18) {
["Name"]=>
string(11) "wp_comments"


["Engine"]=>
string(6) "MyISAM"
["Version"]=>
string(2) "10"
["Row_format"]=>
string(7) "Dynamic"
["Rows"]=>

string(1) "1"
["Avg_row_length"]=>
string(3) "232"
["Data_length"]=>
string(3) "232"


["Max_data_length"]=>
string(15) "281474976710655"
["Index_length"]=>
string(4) "6144"
["Data_free"]=>
string(1) "0"
["Auto_increment"]=>

string(1) "2"
["Create_time"]=>
string(19) "2009-12-15 16:38:30"
["Update_time"]=>
string(19) "2009-12-15 16:38:30"
["Check_time"]=>
string(19) "2009-12-15 17:18:27"
["Collation"]=>
string(15) "utf8_general_ci"


["Checksum"]=>
NULL
["Create_options"]=>
string(0) ""
["Comment"]=>
string(0) ""
}

object(stdClass)#164 (18) {
["Name"]=>
string(11) "wp_comments"


["Engine"]=>
string(6) "MyISAM"
["Version"]=>
string(2) "10"
["Row_format"]=>
string(7) "Dynamic"
["Rows"]=>

string(1) "1"
["Avg_row_length"]=>
string(3) "232"
["Data_length"]=>
string(3) "232"


["Max_data_length"]=>
string(15) "281474976710655"
["Index_length"]=>
string(4) "6144"
["Data_free"]=>
string(1) "0"
["Auto_increment"]=>

string(1) "2"
["Create_time"]=>
string(19) "2009-12-15 16:38:30"
["Update_time"]=>
string(19) "2009-12-15 16:38:30"
["Check_time"]=>
string(19) "2009-12-15 17:18:27"
["Collation"]=>
string(15) "utf8_general_ci"


["Checksum"]=>
NULL
["Create_options"]=>
string(0) ""
["Comment"]=>
string(0) ""
}

object(stdClass)#165 (18) {
["Name"]=>
string(11) "wp_comments"


["Engine"]=>
string(6) "MyISAM"
["Version"]=>
string(2) "10"
["Row_format"]=>
string(7) "Dynamic"
["Rows"]=>

string(1) "1"
["Avg_row_length"]=>
string(3) "232"
["Data_length"]=>
string(3) "232"


["Max_data_length"]=>
string(15) "281474976710655"
["Index_length"]=>
string(4) "6144"
["Data_free"]=>
string(1) "0"
["Auto_increment"]=>

string(1) "2"
["Create_time"]=>
string(19) "2009-12-15 16:38:30"
["Update_time"]=>
string(19) "2009-12-15 16:38:30"
["Check_time"]=>
string(19) "2009-12-15 17:18:27"
["Collation"]=>
string(15) "utf8_general_ci"


["Checksum"]=>
NULL
["Create_options"]=>
string(0) ""
["Comment"]=>
string(0) ""
}

--~--~---------~--~---------~--~---------~--~---------~--~---------~--~-------
-- Luis Fernando Gramajo P.

http://www.guatewireless.org
--~--~---------~--~---------~--~---------~--~---------~--~---------~--~-------

Stuardo Rodriguez

unread,
Dec 17, 2009, 3:17:57 PM12/17/09
to ph...@googlegroups.com
No, porque si te das cuenta en tu var dump estás escupiendo un arreglo donde todos son strings, tanto las llaves como los valores...

Tenés
"comments" ->  "wp_cpmments"
"links" -> "wp_links"

etc...   si te das cuenta en tu foreach estás sacando la llave como string, pero el valor asociado lo estás usando como objeto.. no como string..

pero en el vardump todo apretujado que pusiste si usás objetos

{ ["comments"]=>  object(stdClass)#148 (18) { ["Name"]=>....

tu var_dump está mal

Stuardo Rodriguez

unread,
Dec 17, 2009, 4:42:50 PM12/17/09
to ph...@googlegroups.com
Vardumpeá antes del foreach, vardumpeá toda la data...

Luis Fernando Gramajo P.

unread,
Dec 17, 2009, 6:24:53 PM12/17/09
to ph...@googlegroups.com
Ok, resolvi lo anterior. Eso del var dump ayudo mucho para hacer en 20
lineas lo que tenia como en 80. Ahora bien, quiero hacer esto
if ($gain == 0){
echo "<tr". $alternate .">
<td class='column-name'>". $row[0] ."</td>
<td class='column-name'>".echo size_readable($total, null, 'bi',
'%01.2f %s');."</td>
<td class='column-name'>" . __('Already Optimized') . "</td>
<td class='column-name'>0 Kb</td>
</tr>\n";
} else
{

pero le pela la estaca, justo cal agregar el size. Gracias


--~--~---------~--~---------~--~---------~--~---------~--~---------~--~-------
-- Luis Fernando Gramajo P.

http://www.guatewireless.org
--~--~---------~--~---------~--~---------~--~---------~--~---------~--~-------

Luis Fernando Gramajo P.

unread,
Dec 17, 2009, 6:31:28 PM12/17/09
to ph...@googlegroups.com
Listo olvidenlo... ya estamos gracias!


--~--~---------~--~---------~--~---------~--~---------~--~---------~--~-------
-- Luis Fernando Gramajo P.

http://www.guatewireless.org
--~--~---------~--~---------~--~---------~--~---------~--~---------~--~-------


On Thu, Dec 17, 2009 at 5:24 PM, Luis Fernando Gramajo P.

Attakinsky

unread,
Dec 17, 2009, 7:42:38 PM12/17/09
to ph...@googlegroups.com
weno, q bien q ya resolviste, pero epílogo dejame darte otro consejo:

si un dato no es null, en PHP el 0 equivale a False y el True, es todo lo q no sea cero

por lo tanto en lugar de  if ($gain == 0){ podes hacer  if ( !$gain ){ 
osease, es lo meesmo q comparar if(0==0), tons mejor if(false)

·_  _  _  ·_  _·_  ··  _·  ···  _·_  _·__
José Blanco - Web Developer
____________________________________
Follow me: http://twitter.com/attakinsky
http://attakinsky.com - Programación, no diseño
http://www.cule100x100.com - Mi opinión sobre el FC Barcelona
http://alapin.wordpress.com/ - Aplicación de la teoría ajedrecística


Luis Fernando Gramajo P.

unread,
Dec 18, 2009, 1:52:16 PM12/18/09
to ph...@googlegroups.com
Ah buena onda, voy a tratar de aplicarlo para la proxima.


--~--~---------~--~---------~--~---------~--~---------~--~---------~--~-------
-- Luis Fernando Gramajo P.

http://www.guatewireless.org
--~--~---------~--~---------~--~---------~--~---------~--~---------~--~-------

Reply all
Reply to author
Forward
0 new messages