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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:27:43+00:00 2026-06-15T17:27:43+00:00

it is my php read database file: <?php // read_My_Task.php /* * Following code

  • 0

it is my php read database file:

 <?php
// read_My_Task.php


/*
 * Following code will get single task details
 * A task_detail is identified by task id (cid)
 */

// array for JSON response
$response = array();

// include db connect class
require_once __DIR__ . '/db_connect.php';

// connecting to db
$db = new DB_CONNECT();

// check for post data
if (isset($_GET["cid"])) {
    $cid = $_GET['cid'];

    // get a task from my-task table
    $result = mysql_query("SELECT *FROM my_task WHERE cid = $cid");

    if (!empty($result)) {
        // check for empty result
        if (mysql_num_rows($result) > 0) {

            $result = mysql_fetch_array($result);

            $my_task = array();
            $my_task["cid"] = $result["cid"];
            $my_task["cus_name"] = $result["cus_name"];
            $my_task["contact_number"] = $result["contact_number"];
            $my_task["ticket_no"] = $result["ticket_no"];
            $my_task["task_detail"] = $result["task_detail"];

            // user node
            $response["my_task"] = array();

            array_push($response["my_task"], $my_task);
            // echoing JSON response
            echo json_encode($response);         
             }            

        else {
            // no task found
            $response["success"] = 0;
            $response["message"] = "No task found";

            // echo no users JSON
            echo json_encode($response);
        }
    } else {
        // no task found
        $response["success"] = 0;
        $response["message"] = "No task found";

        // echo no users JSON
        echo json_encode($response);
    }
} else {
    // required field is missing
    $response["success"] = 0;
    $response["message"] = "Required field(s) is missing";

    // echoing JSON response
    echo json_encode($response);
}

?>

Database have alot of data but it always display result that “{“success”:0,”message”:”Required field(s) is missing”}”

How to display data that is saved in MySql database

  • 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-15T17:27:44+00:00Added an answer on June 15, 2026 at 5:27 pm

    Your error message is at the end of your script in an else. If you check the corresponding if it is :

    if (isset($_GET["cid"])) {
    

    That means that for you this value is not set. You just need to call your script with an argument in the URL like this :

    http://yourroot/read_My_Task.php?cid=XXX
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

how to make php can read log file in /var/log/.... I tried this code
I'm using PHP to read if an entry in my table on the database
I read data from a mysql database that has is filled by php scripts.
i'm toying around with a php filesystem: my php file: <html> <head> <title>Text Database
I want to make a flat files database which will use .php files to
Does anyone have any idea why my server cannot read the database file? No
I'm planning to code a search engine in PHP that will allow my company
Similar questions: Some characters in CSV file are not read during PHP fgetcsv() ,
I have a string that I want to have PHP read as a piece
I'm using PHP to read the current CPU usage. I'm on a vServer, so

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.