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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T20:00:01+00:00 2026-06-08T20:00:01+00:00

I am getting data from mysql data base using php script problem is that

  • 0

I am getting data from mysql data base using php script problem is that in table there is data but when i fetch returen NO only

it shows following error

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/content/i/h/u/ihus235/html/cs/emrapp/surveyDescription.php on line 73

[]

HTML CODE

  <html<body>
   <INPUT TYPE = "Text" VALUE ="user_id" NAME = "user_id"> This form allows you to connect to the server.<br>
   <form action="surveyDescription.php" method="post" enctype="multipart/form-data"><br>

   Type (or select) Filename: 
    <input type="submit" value="submit">
    </html>

PHP CODE

   <?php 
   $host = "********"; 
   $user = "********"; 
   $pass = "********"; 
   $database = "****"; 

   $linkID = mysql_connect($host, $user, $pass) or die("Could not connect to host."); 
   mysql_select_db($database, $linkID) or die("Could not find database."); 

  if (!function_exists('json_encode'))
  {
   function json_encode($a=false)
  {
  if (is_null($a)) return 'null';
  if ($a === false) return 'false';
  if ($a === true) return 'true';
  if (is_scalar($a))
   {
    if (is_float($a))
    {
    // Always use "." for floats.
    return floatval(str_replace(",", ".", strval($a)));
    }

    if (is_string($a))
    {
    static $jsonReplaces = array(array("\\", "/", "\n", "\t", "\r", "\b", "\f", '"'), array('\\\\', '\\/', '\\n', '\\t', '\\r', '\\b', '\\f', '\"'));
    return '"' . str_replace($jsonReplaces[0], $jsonReplaces[1], $a) . '"';
    }
    else
    return $a;
    }
    $isList = true;
    for ($i = 0, reset($a); $i < count($a); $i++, next($a))
    {
    if (key($a) !== $i)
    {
     $isList = false;
     break;
     }
     }
     $result = array();
     if ($isList)
     {
     foreach ($a as $v) $result[] = json_encode($v);
     return '[' . join(',', $result) . ']';
     }
     else
     {
     foreach ($a as $k => $v) $result[] = json_encode($k).':'.json_encode($v);
     return '{' . join(',', $result) . '}';
     }
     }
     }



   $user_id=$_POST['user_id'];
   $query = mysql_query("SELECT s.*, u.user_id FROM survey_master AS s 
   JOIN user_profile AS u on u.user_id = s.user_id where s.user_id=$user_id");

   $rows = array();
 while($row = mysql_fetch_assoc($query)) {
 $rows[] = $row;
 }
echo json_encode($rows);

  ?> 
  • 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-08T20:00:04+00:00Added an answer on June 8, 2026 at 8:00 pm

    Problem is in

    $query = mysql_query("SELECT s.*, u.user_id FROM survey_master AS s 
    JOIN user_profile AS u on u.user_id = s.user_id where s.user_id=$user_id");
    

    May be $user_id don’t have any value.please check that.

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

Sidebar

Related Questions

I'm using php to fetch the data from mysql database and then use that
I am getting data from iphone using php but when i insert post data
It is like continue getting data from mysql using PHP and simultaneously stream out
Currently I am getting data from a mysql database using jquery, but I would
I'm getting data from a MySQL table that has 2 columns (idDoc, tag) describing
I have a serious problem with getting data from a sql query in php
I am getting some data from the table in WinForms (MySQL Connector) and would
Im using ajax to load some data from a mysql database... my problem is,
When im using Select statement for displaying data from Mysql Db. Im getting Duplicate
I have a php script to retrieve data from a MysQL databse following an

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.