Jump to content

PHP & MySQL issue - Results from query but no output


merc123

Recommended Posts

Hey guys had a problem that has me stumped.

 

I've got a MySQL DB with the table called scr_results with the fields date, SLM and LLM.  I just want the date field and to output it so I've tried the following below.

 

It shows I have 2 results but it doesn't display anything and I can't remember an alternative to print_r to see the array of the query.

 

Also, there are no errors.

 

  include_once("../connect.php");  //Connect to DB
  $query= mysql_query("SELECT `date` FROM `scr_results`") or die(mysql_error());
  $result= mysql_numrows($query);  //Return 2 fields
  if ($result == '0') { echo "No results found.  You need to add some first."; echo "<HR><a href=>Back to Administration Console</a><BR>"; exit; }
  if ($result == '1') {
  while ($row=mysql_fetch_array($query))
  {

   echo $row['date'];

  }
}

Archived

This topic is now archived and is closed to further replies.

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