Jump to content

Jessica

Staff Alumni
  • Posts

    8,968
  • Joined

  • Last visited

  • Days Won

    41

Posts posted by Jessica

  1. I'm sorry, but you're not really explaining the problem, and your code is not commented, so I have no idea what it's doing.

     

    Forget what you've tried already. Just try assigning the value you want to the variable you're using. Like I did above.

  2. Do you have error reporting turned on? If not, it would be wise to turn that on.

    for one, you are missing semi colons. (';') on the echo's

     

    and using var_dump() instead of echo is much better in cases like this.

     

     

    While it's a bad idea, it's perfectly valid syntax.

     

    <?php echo 'foo' ?>
    <?php echo 'bar' ?>
    

     

     

     

    foobar
  3. If you are about suggest an ORM , I am not gonna do that. I only just started using PDO and I really dont feel like two those two things at a time right now.

     

    Here is an example of $structure:

    Array
    (
      [0] => Array
      (
        [structure] => row
        [cards] => Array
        (
          [0] => Array
          (
            [view_id] => 4
            [card_id] => 4
            [status] => 1
            [name] => city_profile_general_info
            [title] => Information
            [card_min_status] => 1
            [cache_time] => 1800
            [col_span] => 2
            [order_by] => 1
            [info] => Array
            (
              [city] => Array
              (
                  [id] => 9
                  [type] => city
                  [title] => Paris
                  [city] => Array
                      (
                          [id] => 9
                          [name] => Paris
                      )
    
                  [state] => Array
                      (
                          [id] => 
                          [name] => 
                      )
    
                  [country] => Array
                      (
                          [id] => 76
                          [name] => France
                      )
    
                  [img_src] => http://trekeffect.images.user_images.s3.amazonaws.com/4_93.jpg
                  [url] => /show.php?type=city&id=9
                  [master_url] => /location/france/paris/9
              )
            )
          )
        )
      )
    )
    

    so in the database I store something like :title, so now I want the php to replace :title with the city title "$structure[0][cards][0][info][city][title]".

     

    And what is the problem with writing that out?

     

    Are you stuck on using a loop to do it for each one? This is not a problem that requires variable variables.

  4. Okay, I am experiencing a really weird where this gives different results:

    $str = 'structure[0]';
    var_dump(isset($structure[0])); // bool(true)
    var_dump(isset($$str)); // bool(false)

    Does anyone know how this could be caused? Am I missing something?!

     

    To answer the original question: structure[0] is not a variable, so you cannot use it as a variable variable.

     

    If you post the actual array, we can help.

     

     

    <?php
    $structure = array('foo');
    $str = 'structure[0]';
    var_dump($structure[0]); // bool(true)
    var_dump($$str); // bool(false)
    ?>
    

     

    string(3) "foo"

    PHP Notice:  Undefined variable: structure[0] in C:\wamp\www\c.php on line 5

    PHP Stack trace:

    PHP   1. {main}() C:\wamp\www\c.php:0

     

    Notice: Undefined variable: structure[0] in C:\wamp\www\c.php on line 5

     

    Call Stack:

        0.0004     230856   1. {main}() C:\wamp\www\c.php:0

     

    NULL

    [/code]

  5. Executing a script is not the same thing as reading a file. It doesn't matter if you know what you're asking if the people you're asking don't know what you mean.

     

    I had no idea what a .so file was, but one quick Google search gave me the explanation of what it was, and adding the term "PHP" to that same search gave me the exact code to load a .so file.

     

    We are not google. We don't appreciate people who don't do basic research, and waste our time with poor communication. Take responsibility for your part in getting help, and you'll actually get some.

  6. The code you've posted doesn't demonstrate anything to do with output.

     

    What you're asking is a very simple thing. Select your categories, then for each one list the three options. Zebra-striping is another easy concept, you can find tutorials for that by googling.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.