Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6019651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:27:09+00:00 2026-05-23T03:27:09+00:00

I am newer for php. I want make php page cache, query data from

  • 0

I am newer for php. I want make php page cache, query data from mysql and store data into json format.

I have many questions:

  1. which type of file should I store? .json or .txt or .cache? for I also need use json decode return datas into page.

  2. I want use cron tab, make many mysql queries and write into one json file. what write code should I choose? fopen, fwrite or file_get_contents or other command? (do not cover the data, but continue write. I will deleted the file and renewer it at the next cron time)

  3. If a multi write into a json data (10 or more mysql query at the same time and write into a same json file, each json child format like {name: ".$row['name']."}), how to completed a top { and bottom } to make a standad json data format?

    { //how to add this one

    {name: “.$row[‘name’].”}

    {name: “.$row[‘name’].”}

    // many name from 10 more mysql queries

    } //and this one

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T03:27:09+00:00Added an answer on May 23, 2026 at 3:27 am

    which type of file should I store

    It doesn’t matter. There is no fixed extension, but I would pick .json just to make it clear what the file is supposed to contain.

    what write code should I choose?

    Just use file_put_contents to put the JSON string (see next section) into a file.

    each json child format like

    You really do not want to use that method. It might work for a while, but becomes very complex when you need to handle things like quoting and special-character escapes. Instead of re-inventing the wheel, use PHP’s built-in JSON functions for this.

    Create the data-structure you want using PHP’s strings, numbers, and arrays, and then rely on json_encode to turn it into a string.

    The main thing to be careful of is that depending on how your php array() looks, you might get JSON [] versus {}.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to select records that are 1 month old or newer. The query
I'm writing a PHP script that I want to disable from web access (I
I have a webapp written in PHP using a MySQL database backend. This question
i've never created a shopping cart, or forum in php. aside from viewing and
I have a folder checked out using TortoiseSVN. If I copy a newer version
Never used a cache like this before. The problem is that I want to
I never actually thought I'd run into speed-issues with python, but I have. I'm
I have a form that onsubmit calls an ajaxFunction()... The ajaxfunction calls a php
Part 1 I want to build a PHP Zend Framework application that users can
I want to make IE 8 understand my site as IE8. And not in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.