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 9148807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:22:20+00:00 2026-06-17T11:22:20+00:00

I have a website in which I have a very simple html form that

  • 0

I have a website in which I have a very simple html form that I can fill out. The page was made using php and mysql, so it is also password protected. On this form, I accept input for “Data” and “Activity”. With this very small system:

  • I can log in with a password
  • Enter a “Date” and “Activity”
  • The “Date” and “Activity” are stored in a MySQL database

At this point, I think I will just have to build a JSON parser, which there already are many tutorials on this. Such as this and this. what’s confusing to me is how to create this JSON page. None of the tutorials really show you how to create a JSON array of the data you are looking for.

This may be a very basic question, but I still very new to Java, PHP, MySQL and totally new to JSON. Please educate me on this topic.

Update:

This code worked for me in the end

<?php
 $link = mysql_connect("localhost", "my_db", "password");

   mysql_select_db("my_table") or die(mysql_error());


$sql=mysql_query("select * from activity");
while($row=mysql_fetch_assoc($sql)){
$output[]=$row;
}
print(json_encode($output));
mysql_close();
?>
  • 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-06-17T11:22:22+00:00Added an answer on June 17, 2026 at 11:22 am

    Try the built-in PHP function json_encode

    You can read about it here: http://php.net/manual/en/function.json-encode.php

    If you run a query from PHP like this: SELECT Activity, Date from YourTable where field = value

    Then you can use json_encode: echo json_encode($result)

    It will output something like this {"Activity":"Activity Text","Date":"ExampleDate"}

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

Sidebar

Related Questions

I have a simple php script which I use in form on my website.
I have this html form which calls a php file . The index.html ->
I have a website which contains a small Silverlight plugin that calls a very
I have a website which using active directory authorization on a windows server in
I have a website which works with PHP on the server side. Users access
I have a website which uses Spring Security. I have realized that when I
I have a very simple WebView in my app which displays a Welcome dialog.
One of our customers said they have a very simple script which uses fsockopen()
I have a jQuery form wizard which I plugged to my website. What I
Basically, I have a very simple website where the root directory looks like: /images/

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.