Jump to content

The Spook

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Posts posted by The Spook

  1. Also, you can store arrays in a database with JSON (req PHP 5.2+ or JSON lib).

     

    $array = array("some", "random", "text");
    $sql = "INSERT INTO table (column) VALUES ('".mysql_real_escape_string(json_encode($array))."')";

     

    And to retrieve the value back into an array:

     

    $result = mysql_query("SELECT column FROM table WHERE ID=1");
    $row = mysql_fetch_array($result);
    $array = json_decode($row['column']);
    print_r($array);

×
×
  • 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.