Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I want to show WordPress meta values that look like this:

a:2:{i:0;a:5:{s:4:"name";s:2:"11";s:6:"takht1";s:2:"12";s:6:"takht2";s:2:"13";s:11:"takhtkoodak";s:2:"14";s:13:"takhtbikoodak";s:2:"15";}i:2;a:5:{s:4:"name";s:2:"21";s:6:"takht1";s:2:"22";s:6:"takht2";s:2:"23";s:11:"takhtkoodak";s:2:"24";s:13:"takhtbikoodak";s:2:"25";}}

I want show this in a table.

share|improve this question
3  
That is a serialize array. unserialize it and you can loop through and create your table. Are you asking someone to create the code to output that table? That isn't even possible without knowing what the table should look like. – s_ha_dum Nov 2 '12 at 0:28
how do i convert this array to unserialize ? – Mojtaba Nov 2 '12 at 8:01
'unserialize' is a PHP function. I linked to the documentation for that function. Read that documentation. – s_ha_dum Nov 2 '12 at 14:00
thanks , how do show it after conversion ? – Mojtaba Nov 3 '12 at 8:44
OK. This really isn't a WordPress question anymore... maybe never really was. This is a straight PHP question and it has become apparent that you don't know the language. I'm sorry and no offense, but perhaps you should take the time to learn the very basics of PHP. Looping through an array certainly qualifies as a basic skill. – s_ha_dum Nov 3 '12 at 13:52

closed as off topic by toscho Mar 29 at 22:33

Questions on WordPress Answers are expected to relate to WordPress within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

1 Answer

Yeah right , but my code like this :

    $tourhotel = get_post_meta($post->ID,'tourhotel',true);

    $c = 0;

    if(is_array($tourhotel)){
    foreach( $tourhotel as $hotel ) {
        if ( isset( $hotel['name'] ) || isset( $hotel['takht1'] ) || isset( $hotel['takht2'] ) || isset( $hotel['takhtkoodak'] ) || isset( $hotel['takhtbikoodak'] ) ) {
            printf( '<p>
                        <input type="text" name="tourhotel[%1$s][name]" value="%2$s" />
                        <input type="text" name="tourhotel[%1$s][takht1]" value="%3$s" />
                        <input type="text" name="tourhotel[%1$s][takht2]" value="%4$s" />
                        <input type="text" name="tourhotel[%1$s][takhtkoodak]" value="%5$s" />
                        <input type="text" name="tourhotel[%1$s][takhtbikoodak]" value="%6$s" />
                        <span class="remove_price">%7$s</span>
                    </p>', 
                    $c, $hotel['name'], $hotel['takht1'], $hotel['takht2'], $hotel['takhtkoodak'], $hotel['takhtbikoodak'], 'پاک کردن' );
            $c = $c +1;
        }
    }
}

if i know where this array save , i can convert to unserialize thanks alot , sorry

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.